class BestBuy::CollectionsResponse

Attributes

collection[R]
header[R]

Public Class Methods

new(response:, collection_name:, collection_type:) click to toggle source
# 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