module Github::Result

def body

Returns raw body
def body
  loaded? ? @env[:body] : nil
end

def content_length

def content_length
  loaded? ? @env[:response_headers][CONTENT_LENGTH] : nil
end

def content_type

def content_type
  loaded? ? @env[:response_headers][CONTENT_TYPE] : nil
end

def date

def date
  loaded? ? @env[:response_headers][DATE] : nil
end

def each_page

iterate over this method will return nothing.
Iterator like each for response pages. If there are no pages to
def each_page
  yield self.body
  while page_iterator.has_next?
    yield next_page
  end
end

def etag

def etag
  loaded? ? @env[:response_headers][ETAG] : nil
end

def first_page

or there are no pages at all in the result.
no first page - either because you are already on the first page
Retrives the result of the first page. Returns nil if there is
def first_page
  first_request = page_iterator.first
  self.instance_eval { @env = first_request.env } if first_request
  self.body
end

def has_next_page?

otherwise false
Returns true if there is another page in the result set,
def has_next_page?
  page_iterator.has_next?
end

def last_page

there is only one page or there are no pages at all in the result.
no last page - either because you are already on the last page,
Retrives the result of the last page. Returns nil if there is
def last_page
  last_request = page_iterator.last
  self.instance_eval { @env = last_request.env } if last_request
  self.body
end

def links

Return page links
def links
  @@links = Github::PageLinks.new(@env[:response_headers])
end

def loaded?

def loaded?
  !!@env
end

def next_page

no next page or no pages at all.
Retrives the result of the next page. Returns nil if there is
def next_page
  next_request = page_iterator.next
  self.instance_eval { @env = next_request.env } if next_request
  self.body
end

def page(page_number)

there is only one page, this method returns nil
that does not exist will return Github API error. Consequently, if
The page_number parameter is not validate, hitting a page
Retrives a specific result for a page given page number.
def page(page_number)
  request = page_iterator.get_page(page_number)
  self.instance_eval { @env = request.env } if request
  self.body
end

def page_iterator # :nodoc:

:nodoc:
Internally used page iterator
def page_iterator # :nodoc:
  @@page_iterator = Github::PageIterator.new(@env)
end

def prev_page

no previous page or no pages at all.
Retrives the result of the previous page. Returns nil if there is
def prev_page
  prev_request = page_iterator.prev
  self.instance_eval { @env = prev_request.env } if prev_request
  self.body
end

def ratelimit_limit

Requests are limited to API v3 to 5000 per hour.
def ratelimit_limit
  loaded? ? @env[:response_headers][RATELIMIT_LIMIT] : nil
end

def ratelimit_remaining

def ratelimit_remaining
  loaded? ? @env[:response_headers][RATELIMIT_REMAINING] : nil
end

def reset

Repopulates objects for new values
def reset
  nil
end

def server

def server
  loaded? ? @env[:response_headers][SERVER] : nil
end

def status

def status
  loaded? ? @env[:status] : nil
end

def success?

def success?
  (200..299).include? status
end