Method: Circuitdata::Product.from_data

Defined in:
lib/circuitdata/product.rb

.from_data(data) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/circuitdata/product.rb', line 17

def self.from_data(data)
  products_hash = data.dig(*BASE_PATH)
  return [] if products_hash.nil?
  products_hash.keys.map do |k|
    self.new(id: k, data: data)
  end
end