Class: Github::PageLinks Private
- Inherits:
-
Object
- Object
- Github::PageLinks
- Includes:
- Constants
- Defined in:
- lib/github_api/page_links.rb
Overview
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.
Determines the links in the current response link header to be used to find the links to other pages of request responses. These will only be present if the result set size exceeds the per page limit.
Constant Summary collapse
- DELIM_LINKS =
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.
:nodoc:
','.freeze
- LINK_REGEX =
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.
/<([^>]+)>; rel=\"([^\"]+)\"/
Constants included from Constants
Constants::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
Instance Attribute Summary collapse
-
#first ⇒ Object
private
Hold the extracted values for URI from the Link header for the first, last, next and previous page.
-
#last ⇒ Object
private
Hold the extracted values for URI from the Link header for the first, last, next and previous page.
-
#next ⇒ Object
private
Hold the extracted values for URI from the Link header for the first, last, next and previous page.
-
#prev ⇒ Object
private
Hold the extracted values for URI from the Link header for the first, last, next and previous page.
Instance Method Summary collapse
-
#initialize(response_headers) ⇒ PageLinks
constructor
private
Parses links from executed request.
Constructor Details
#initialize(response_headers) ⇒ PageLinks
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.
Parses links from executed request
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/github_api/page_links.rb', line 27 def initialize(response_headers) link_header = response_headers[HEADER_LINK] if link_header && link_header =~ /(next|first|last|prev)/ extract_links(link_header) else # When on the first page self.next = response_headers[HEADER_NEXT] self.last = response_headers[HEADER_LAST] end end |
Instance Attribute Details
#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.
Hold the extracted values for URI from the Link header for the first, last, next and previous page.
18 19 20 |
# File 'lib/github_api/page_links.rb', line 18 def first @first 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.
Hold the extracted values for URI from the Link header for the first, last, next and previous page.
18 19 20 |
# File 'lib/github_api/page_links.rb', line 18 def last @last 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.
Hold the extracted values for URI from the Link header for the first, last, next and previous page.
18 19 20 |
# File 'lib/github_api/page_links.rb', line 18 def next @next 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.
Hold the extracted values for URI from the Link header for the first, last, next and previous page.
18 19 20 |
# File 'lib/github_api/page_links.rb', line 18 def prev @prev end |