Class: Flavordb::Product

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

Instance Attribute Summary collapse

Attributes inherited from Base

#id, #name, #resource

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

get_or_create

Instance Attribute Details

#business_idObject (readonly)

Returns the value of attribute business_id.



5
6
7
# File 'lib/flavordb/product.rb', line 5

def business_id
  @business_id
end

#product_category_idObject (readonly)

Returns the value of attribute product_category_id.



5
6
7
# File 'lib/flavordb/product.rb', line 5

def product_category_id
  @product_category_id
end

Class Method Details

.object_cacheObject



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

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

Instance Method Details

#business(opts = {}) ⇒ Object



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

def business(opts={})
  client = opts[:client] || Flavordb::Client.default_client
  client.get_business(business_id)
end

#product_category(opts = {}) ⇒ Object



18
19
20
21
# File 'lib/flavordb/product.rb', line 18

def product_category(opts={})
  client = opts[:client] || Flavordb::Client.default_client
  client.get_product_category(product_category_id)
end