Class: Besepa::Collection
- Inherits:
-
Object
- Object
- Besepa::Collection
- Includes:
- Enumerable
- Defined in:
- lib/besepa/collection.rb
Instance Attribute Summary collapse
-
#current_page ⇒ Object
Returns the value of attribute current_page.
-
#items ⇒ Object
Returns the value of attribute items.
-
#pages ⇒ Object
Returns the value of attribute pages.
-
#pagination ⇒ Object
readonly
Returns the value of attribute pagination.
-
#per_page ⇒ Object
Returns the value of attribute per_page.
-
#total ⇒ Object
Returns the value of attribute total.
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize(response, klass) ⇒ Collection
constructor
A new instance of Collection.
Constructor Details
#initialize(response, klass) ⇒ Collection
Returns a new instance of Collection.
7 8 9 10 11 |
# File 'lib/besepa/collection.rb', line 7 def initialize(response, klass) @pagination = false @items = [] process_response(response, klass) end |
Instance Attribute Details
#current_page ⇒ Object
Returns the value of attribute current_page.
4 5 6 |
# File 'lib/besepa/collection.rb', line 4 def current_page @current_page end |
#items ⇒ Object
Returns the value of attribute items.
4 5 6 |
# File 'lib/besepa/collection.rb', line 4 def items @items end |
#pages ⇒ Object
Returns the value of attribute pages.
4 5 6 |
# File 'lib/besepa/collection.rb', line 4 def pages @pages end |
#pagination ⇒ Object (readonly)
Returns the value of attribute pagination.
5 6 7 |
# File 'lib/besepa/collection.rb', line 5 def pagination @pagination end |
#per_page ⇒ Object
Returns the value of attribute per_page.
4 5 6 |
# File 'lib/besepa/collection.rb', line 4 def per_page @per_page end |
#total ⇒ Object
Returns the value of attribute total.
4 5 6 |
# File 'lib/besepa/collection.rb', line 4 def total @total end |
Instance Method Details
#each(&block) ⇒ Object
13 14 15 |
# File 'lib/besepa/collection.rb', line 13 def each &block @items.each{|item| block.call(item)} end |