Class: Fortnox::Collection
- Inherits:
-
Object
- Object
- Fortnox::Collection
- Extended by:
- Forwardable
- Includes:
- Enumerable, RailsSerialisation::CollectionMethods, Serialisation::CollectionJSON
- Defined in:
- lib/fortnox/collection.rb
Overview
An iterable wrapper around a list of resource instances that also carries the pagination metadata Fortnox returns alongside collection responses.
Instance Attribute Summary collapse
-
#current_page ⇒ Object
readonly
Returns the value of attribute current_page.
-
#pages ⇒ Object
readonly
Returns the value of attribute pages.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
Instance Method Summary collapse
-
#initialize(items, total: nil, pages: nil, current_page: nil) ⇒ Collection
constructor
A new instance of Collection.
Methods included from RailsSerialisation::CollectionMethods
Methods included from Serialisation::CollectionJSON
Constructor Details
#initialize(items, total: nil, pages: nil, current_page: nil) ⇒ Collection
Returns a new instance of Collection.
17 18 19 20 21 22 |
# File 'lib/fortnox/collection.rb', line 17 def initialize(items, total: nil, pages: nil, current_page: nil) @items = items @total = total @pages = pages @current_page = current_page end |
Instance Attribute Details
#current_page ⇒ Object (readonly)
Returns the value of attribute current_page.
15 16 17 |
# File 'lib/fortnox/collection.rb', line 15 def current_page @current_page end |
#pages ⇒ Object (readonly)
Returns the value of attribute pages.
15 16 17 |
# File 'lib/fortnox/collection.rb', line 15 def pages @pages end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
15 16 17 |
# File 'lib/fortnox/collection.rb', line 15 def total @total end |