Class: BestBuy::CollectionsResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/best_buy/models/collections_response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#collectionObject (readonly)

Returns the value of attribute collection.



7
8
9
# File 'lib/best_buy/models/collections_response.rb', line 7

def collection
  @collection
end

#headerObject (readonly)

Returns the value of attribute header.



7
8
9
# File 'lib/best_buy/models/collections_response.rb', line 7

def header
  @header
end