Class: Github::PageLinks Private

Inherits:
Object
  • Object
show all
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

','.freeze
/<([^>]+)>; 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

Instance Method Summary collapse

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

Parameters:

  • response_headers (Hash)


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

#firstObject

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

#lastObject

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

#nextObject

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

#prevObject

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