Module: ShopifyAPI::PaginatedCollection::CollectionPagination
- Included in:
- ShopifyAPI::PaginatedCollection
- Defined in:
- lib/shopify_api/paginated_collection.rb
Instance Method Summary collapse
- #fetch_next_page ⇒ Object
- #fetch_previous_page ⇒ Object
- #initialize(args) ⇒ Object
- #next_page? ⇒ Boolean
- #next_page_info ⇒ Object
- #previous_page? ⇒ Boolean
- #previous_page_info ⇒ Object
Instance Method Details
#fetch_next_page ⇒ Object
22 23 24 |
# File 'lib/shopify_api/paginated_collection.rb', line 22 def fetch_next_page fetch_page(@next_url) end |
#fetch_previous_page ⇒ Object
26 27 28 |
# File 'lib/shopify_api/paginated_collection.rb', line 26 def fetch_previous_page fetch_page(@previous_url) end |
#initialize(args) ⇒ Object
6 7 8 9 10 |
# File 'lib/shopify_api/paginated_collection.rb', line 6 def initialize(args) @next_url = pagination_link_headers.next_link&.url&.to_s @previous_url = pagination_link_headers.previous_link&.url&.to_s super(args) end |
#next_page? ⇒ Boolean
12 13 14 15 |
# File 'lib/shopify_api/paginated_collection.rb', line 12 def next_page? ensure_available @next_url.present? end |
#next_page_info ⇒ Object
30 31 32 |
# File 'lib/shopify_api/paginated_collection.rb', line 30 def next_page_info extract_page_info(@next_url) end |
#previous_page? ⇒ Boolean
17 18 19 20 |
# File 'lib/shopify_api/paginated_collection.rb', line 17 def previous_page? ensure_available @previous_url.present? end |
#previous_page_info ⇒ Object
34 35 36 |
# File 'lib/shopify_api/paginated_collection.rb', line 34 def previous_page_info extract_page_info(@previous_url) end |