Class: KlaviyoAPI::Collections::PaginatedCollection
- Inherits:
-
ActiveResource::Collection
- Object
- ActiveResource::Collection
- KlaviyoAPI::Collections::PaginatedCollection
- Defined in:
- lib/klaviyo_api/collections/paginated_collection.rb
Overview
This collection is used for item types that rely on pagination and provide ‘page`, `page_size`, etc.
Instance Attribute Summary collapse
-
#end ⇒ Object
Returns the value of attribute end.
-
#page ⇒ Object
Returns the value of attribute page.
-
#page_size ⇒ Object
Returns the value of attribute page_size.
-
#start ⇒ Object
Returns the value of attribute start.
-
#total ⇒ Object
Returns the value of attribute total.
Instance Method Summary collapse
-
#initialize(response = {}) ⇒ PaginatedCollection
constructor
A new instance of PaginatedCollection.
Constructor Details
#initialize(response = {}) ⇒ PaginatedCollection
Returns a new instance of PaginatedCollection.
9 10 11 12 13 14 15 16 17 |
# File 'lib/klaviyo_api/collections/paginated_collection.rb', line 9 def initialize(response = {}) @total = response.delete 'total' @page = response.delete 'page' @page_size = response.delete 'page_size' @start = response.delete 'start' @end = response.delete 'end' @elements = response['data'] || [] end |
Instance Attribute Details
#end ⇒ Object
Returns the value of attribute end.
7 8 9 |
# File 'lib/klaviyo_api/collections/paginated_collection.rb', line 7 def end @end end |
#page ⇒ Object
Returns the value of attribute page.
7 8 9 |
# File 'lib/klaviyo_api/collections/paginated_collection.rb', line 7 def page @page end |
#page_size ⇒ Object
Returns the value of attribute page_size.
7 8 9 |
# File 'lib/klaviyo_api/collections/paginated_collection.rb', line 7 def page_size @page_size end |
#start ⇒ Object
Returns the value of attribute start.
7 8 9 |
# File 'lib/klaviyo_api/collections/paginated_collection.rb', line 7 def start @start end |
#total ⇒ Object
Returns the value of attribute total.
7 8 9 |
# File 'lib/klaviyo_api/collections/paginated_collection.rb', line 7 def total @total end |