Class: Malartu::MalartuObject
- Inherits:
-
Object
- Object
- Malartu::MalartuObject
- Defined in:
- lib/malartu/malartu_object.rb
Direct Known Subclasses
Connection, Dashboard, Metric, Portfolio, Schedule, Snapshot, Tracking::Data
Instance Attribute Summary collapse
-
#json ⇒ Object
Returns the value of attribute json.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(json) ⇒ MalartuObject
constructor
A new instance of MalartuObject.
Constructor Details
#initialize(json) ⇒ MalartuObject
Returns a new instance of MalartuObject.
4 5 6 7 8 9 |
# File 'lib/malartu/malartu_object.rb', line 4 def initialize(json) json.each do |k, v| define_singleton_method(k) { v } end @json = json end |
Instance Attribute Details
#json ⇒ Object
Returns the value of attribute json.
3 4 5 |
# File 'lib/malartu/malartu_object.rb', line 3 def json @json end |
Class Method Details
.paginate?(response) ⇒ Boolean
11 12 13 14 15 16 17 |
# File 'lib/malartu/malartu_object.rb', line 11 def self.paginate?(response) page = response['page'].to_i limit = response['limit'].to_i found = response['found'].to_i count = response['count'].to_i ((page - 1) * limit) + count < found end |