Class: ApRubySdk::Collection
- Inherits:
-
Object
- Object
- ApRubySdk::Collection
- Defined in:
- lib/ap_ruby_sdk/collection.rb
Instance Attribute Summary collapse
-
#items ⇒ Object
Returns the value of attribute items.
-
#pagination ⇒ Object
Returns the value of attribute pagination.
Instance Method Summary collapse
- #attributes=(attributes) ⇒ Object
-
#initialize(attributes = {}) ⇒ Collection
constructor
A new instance of Collection.
- #to_json ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Collection
Returns a new instance of Collection.
10 11 12 |
# File 'lib/ap_ruby_sdk/collection.rb', line 10 def initialize(attributes={}) self.attributes = attributes end |
Instance Attribute Details
#items ⇒ Object
Returns the value of attribute items.
3 4 5 |
# File 'lib/ap_ruby_sdk/collection.rb', line 3 def items @items end |
#pagination ⇒ Object
Returns the value of attribute pagination.
3 4 5 |
# File 'lib/ap_ruby_sdk/collection.rb', line 3 def pagination @pagination end |
Instance Method Details
#attributes=(attributes) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/ap_ruby_sdk/collection.rb', line 14 def attributes=(attributes) if attributes.respond_to?(:each) attributes.each do |key, value| writer = (key == 'type' ? 'kind=' : "#{key}=") if respond_to?(writer) send(writer, value) end end else attributes end end |
#to_json ⇒ Object
27 28 29 30 31 |
# File 'lib/ap_ruby_sdk/collection.rb', line 27 def to_json hash = {} instance_variables.each { |var| hash[var.to_s.delete("@")] = instance_variable_get(var) } hash.to_json end |