Class: Flavordb::Business

Inherits:
Base
  • Object
show all
Defined in:
lib/flavordb/business.rb

Instance Attribute Summary

Attributes inherited from Base

#id, #name, #resource

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

get_or_create

Class Method Details

.object_cacheObject



7
8
9
10
# File 'lib/flavordb/business.rb', line 7

def object_cache
  @object_cache = {} if @object_cache.nil?
  @object_cache
end

Instance Method Details

#products(opts = {}) ⇒ Object



13
14
15
16
17
# File 'lib/flavordb/business.rb', line 13

def products(opts = {})
  client = opts[:client] || Flavordb::Client.default_client
  product_data = client.get_object_data_by_path "#{self.resource}/products"
  product_data['data'].map {|p| Flavordb::Product.get_or_create p}
end