Class: Fortnox::Collection
- Inherits:
-
Object
- Object
- Fortnox::Collection
- Extended by:
- Forwardable
- Includes:
- Enumerable
- 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.
Constructor Details
#initialize(items, total: nil, pages: nil, current_page: nil) ⇒ Collection
Returns a new instance of Collection.
16 17 18 19 20 21 |
# File 'lib/fortnox/collection.rb', line 16 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.
14 15 16 |
# File 'lib/fortnox/collection.rb', line 14 def current_page @current_page end |
#pages ⇒ Object (readonly)
Returns the value of attribute pages.
14 15 16 |
# File 'lib/fortnox/collection.rb', line 14 def pages @pages end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
14 15 16 |
# File 'lib/fortnox/collection.rb', line 14 def total @total end |