module Github::Result
def body
def body loaded? ? @env[:body] : nil end
def cache_control
def cache_control loaded? ? @env[:response_headers][CACHE_CONTROL] : 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
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
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?
Returns true if there is another page in the result set,
def has_next_page? page_iterator.has_next? end
def last_page
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
def links @@links = Github::PageLinks.new(@env[:response_headers]) end
def loaded?
def loaded? !!@env end
def location
def location loaded? ? @env[:response_headers][LOCATION] : nil end
def next_page
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)
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:
Internally used page iterator
def page_iterator # :nodoc: @@page_iterator = Github::PageIterator.new(@env) end
def prev_page
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
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
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