Class: BestBuy::CollectionsResponse
- Inherits:
-
Object
- Object
- BestBuy::CollectionsResponse
- Defined in:
- lib/best_buy/models/collections_response.rb
Instance Attribute Summary collapse
-
#collection ⇒ Object
readonly
Returns the value of attribute collection.
-
#header ⇒ Object
readonly
Returns the value of attribute header.
Instance Method Summary collapse
-
#initialize(response:, collection_name:, collection_type:) ⇒ CollectionsResponse
constructor
A new instance of CollectionsResponse.
Constructor Details
#initialize(response:, collection_name:, collection_type:) ⇒ CollectionsResponse
Returns a new instance of CollectionsResponse.
9 10 11 12 13 14 15 16 17 |
# File 'lib/best_buy/models/collections_response.rb', line 9 def initialize(response:, collection_name:, collection_type:) header_hash = response.except(collection_name) collection_hash = response[collection_name] @header = CollectionHeader.new(header_hash) @collection = collection_hash.map do |collection_item| collection_type.new(collection_item) end end |
Instance Attribute Details
#collection ⇒ Object (readonly)
Returns the value of attribute collection.
7 8 9 |
# File 'lib/best_buy/models/collections_response.rb', line 7 def collection @collection end |
#header ⇒ Object (readonly)
Returns the value of attribute header.
7 8 9 |
# File 'lib/best_buy/models/collections_response.rb', line 7 def header @header end |