Class: HipcallSdk::Collection
- Inherits:
-
Object
- Object
- HipcallSdk::Collection
- Defined in:
- lib/hipcall/collection.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#meta ⇒ Object
readonly
Returns the value of attribute meta.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(data:, meta:) ⇒ Collection
constructor
A new instance of Collection.
Constructor Details
#initialize(data:, meta:) ⇒ Collection
Returns a new instance of Collection.
13 14 15 16 |
# File 'lib/hipcall/collection.rb', line 13 def initialize(data:, meta:) @data = data @meta = end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
3 4 5 |
# File 'lib/hipcall/collection.rb', line 3 def data @data end |
#meta ⇒ Object (readonly)
Returns the value of attribute meta.
3 4 5 |
# File 'lib/hipcall/collection.rb', line 3 def @meta end |
Class Method Details
.from_response(response, key:, type:) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/hipcall/collection.rb', line 5 def self.from_response(response, key:, type:) body = response.body new( data: body[key].map { |attrs| type.new(attrs) }, meta: body["meta"], ) end |