This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
A class responsible for requesting resources through page links
Constant Summary collapseThis constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Setup attribute accesor for all the link types
[META_FIRST, META_NEXT, META_PREV, META_LAST]
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
'master'
Github::PagedRequest::FIRST_PAGE, Github::PagedRequest::NOT_FOUND, Github::PagedRequest::PER_PAGE
Constants included from ConstantsConstants::ACCEPT, Constants::ACCEPTED_OAUTH_SCOPES, Constants::ACCEPT_CHARSET, Constants::CACHE_CONTROL, Constants::CONTENT_LENGTH, Constants::CONTENT_TYPE, Constants::DATE, Constants::ETAG, Constants::HEADER_LAST, Constants::HEADER_LINK, Constants::HEADER_NEXT, Constants::LOCATION, Constants::META_FIRST, Constants::META_LAST, Constants::META_NEXT, Constants::META_PREV, Constants::META_REL, Constants::OAUTH_SCOPES, Constants::PARAM_PAGE, Constants::PARAM_PER_PAGE, Constants::PARAM_START_PAGE, Constants::RATELIMIT_LIMIT, Constants::RATELIMIT_REMAINING, Constants::RATELIMIT_RESET, Constants::SERVER, Constants::USER_AGENT
Constants included from Utils::UrlUtils::Url::DEFAULT_QUERY_SEP, Utils::Url::KEY_VALUE_SEP
Instance Attribute Summary collapsePerform http get request for the first resource.
Returns the result for a specific page.
A new instance of PageIterator.
Perform http get request for the last resource.
Perform http get request for the next resource.
Perform http get request for the previous resource.
#default_page, #default_page_size, #page_request
Methods included from Utils::Url#build_query, #escape, #escape_uri, #normalize, #parse_query, #parse_query_for_param, #unescape
Constructor Details #initialize(links, current_api) ⇒ PageIteratorThis method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of PageIterator.
29 30 31 32 33
# File 'lib/github_api/page_iterator.rb', line 29 def initialize(links, current_api) @links = links @current_api = current_api update_page_links(@links) endInstance Attribute Details #current_api ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29
# File 'lib/github_api/page_iterator.rb', line 27 def current_api @current_api endInstance Method Details #count ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
39 40 41
# File 'lib/github_api/page_iterator.rb', line 39 def count parse_query(URI(last_page_uri).query)['page'] if last_page_uri end#first ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Perform http get request for the first resource
45 46 47
# File 'lib/github_api/page_iterator.rb', line 45 def first perform_request(first_page_uri) if first_page_uri end#get_page(page_number) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the result for a specific page.
69 70 71 72 73 74 75 76
# File 'lib/github_api/page_iterator.rb', line 69 def get_page(page_number) page_uri = first_page_uri || last_page_uri return nil unless page_uri perform_request(page_uri, page_number) end#last ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Perform http get request for the last resource
63 64 65
# File 'lib/github_api/page_iterator.rb', line 63 def last perform_request(last_page_uri) if last_page_uri end#next ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Perform http get request for the next resource
51 52 53
# File 'lib/github_api/page_iterator.rb', line 51 def next perform_request(next_page_uri) if next? end#next? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
35 36 37
# File 'lib/github_api/page_iterator.rb', line 35 def next? next_page == 0 || !next_page_uri.nil? end#prev ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Perform http get request for the previous resource
57 58 59
# File 'lib/github_api/page_iterator.rb', line 57 def prev perform_request(prev_page_uri) if prev_page_uri end
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4