Class: Marver::DataContainer
- Inherits:
-
Object
- Object
- Marver::DataContainer
- Defined in:
- lib/marver/data_container.rb
Instance Attribute Summary collapse
-
#limit ⇒ Object
readonly
Returns the value of attribute limit.
-
#offset ⇒ Object
readonly
Returns the value of attribute offset.
-
#results ⇒ Object
readonly
Returns the value of attribute results.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
Instance Method Summary collapse
-
#initialize(response) ⇒ DataContainer
constructor
A new instance of DataContainer.
Constructor Details
#initialize(response) ⇒ DataContainer
Returns a new instance of DataContainer.
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/marver/data_container.rb', line 5 def initialize(response) json_results = response.data @offset = json_results['offset'].to_i @limit = json_results['limit'].to_i @total = json_results['total'].to_i if @total == 1 @results = json_results['results'].first else @results = json_results['results'] end end |
Instance Attribute Details
#limit ⇒ Object (readonly)
Returns the value of attribute limit.
3 4 5 |
# File 'lib/marver/data_container.rb', line 3 def limit @limit end |
#offset ⇒ Object (readonly)
Returns the value of attribute offset.
3 4 5 |
# File 'lib/marver/data_container.rb', line 3 def offset @offset end |
#results ⇒ Object (readonly)
Returns the value of attribute results.
3 4 5 |
# File 'lib/marver/data_container.rb', line 3 def results @results end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
3 4 5 |
# File 'lib/marver/data_container.rb', line 3 def total @total end |