Class: EPlat::Collection
- Inherits:
-
ActiveResource::Collection
- Object
- ActiveResource::Collection
- EPlat::Collection
- Defined in:
- lib/e_plat/resource/collection.rb
Constant Summary collapse
- SHOPIFY_GRAPHQL_PAGINATABLE_CLASSES =
%w( EPlat::Product EPlat::Product::Variant EPlat::Shopify::Product EPlat::Shopify::Product::Variant )
Instance Method Summary collapse
- #fetch_next_page ⇒ Object
- #fetch_previous_page ⇒ Object
-
#initialize(parsed = {}) ⇒ Collection
constructor
A new instance of Collection.
- #next_page? ⇒ Boolean
- #next_page_info ⇒ Object
- #paginates_via_graphql? ⇒ Boolean
- #previous_page? ⇒ Boolean
- #previous_page_info ⇒ Object
Constructor Details
#initialize(parsed = {}) ⇒ Collection
Returns a new instance of Collection.
12 13 14 |
# File 'lib/e_plat/resource/collection.rb', line 12 def initialize(parsed = {}) super parsed end |
Instance Method Details
#fetch_next_page ⇒ Object
36 37 38 39 |
# File 'lib/e_plat/resource/collection.rb', line 36 def fetch_next_page return unless pagination_available? fetch_page(@next) end |
#fetch_previous_page ⇒ Object
41 42 43 44 |
# File 'lib/e_plat/resource/collection.rb', line 41 def fetch_previous_page return unless pagination_available? fetch_page(@previous) end |
#next_page? ⇒ Boolean
16 17 18 19 |
# File 'lib/e_plat/resource/collection.rb', line 16 def next_page? return false unless pagination_available? @next.present? end |
#next_page_info ⇒ Object
26 27 28 29 |
# File 'lib/e_plat/resource/collection.rb', line 26 def next_page_info return unless pagination_available? extract_page_info(@next) end |
#paginates_via_graphql? ⇒ Boolean
46 47 48 49 50 |
# File 'lib/e_plat/resource/collection.rb', line 46 def paginates_via_graphql? return unless SHOPIFY_GRAPHQL_PAGINATABLE_CLASSES.include? resource_class.to_s client.shopify? && client.api_version != "2024_01" end |
#previous_page? ⇒ Boolean
21 22 23 24 |
# File 'lib/e_plat/resource/collection.rb', line 21 def previous_page? return false unless pagination_available? @previous.present? end |
#previous_page_info ⇒ Object
31 32 33 34 |
# File 'lib/e_plat/resource/collection.rb', line 31 def previous_page_info return unless pagination_available? extract_page_info(@previous) end |