Class: ShopifyAPI::PaginationLinkHeaders

Inherits:
Object
  • Object
show all
Defined in:
lib/shopify_api/pagination_link_headers.rb

Defined Under Namespace

Classes: LinkHeader

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(link_header) ⇒ PaginationLinkHeaders

Returns a new instance of PaginationLinkHeaders.


8
9
10
11
12
# File 'lib/shopify_api/pagination_link_headers.rb', line 8

def initialize(link_header)
  links = parse_link_header(link_header)
  @previous_link = links.find { |link| link.rel == :previous }
  @next_link = links.find { |link| link.rel == :next }
end

Instance Attribute Details

Returns the value of attribute next_link


6
7
8
# File 'lib/shopify_api/pagination_link_headers.rb', line 6

def next_link
  @next_link
end

Returns the value of attribute previous_link


6
7
8
# File 'lib/shopify_api/pagination_link_headers.rb', line 6

def previous_link
  @previous_link
end