19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/acts_as_amazon_product.rb', line 19
def acts_as_amazon_product(options = {})
defaults = {
:asin => 'asin',
:name => 'name',
:access_key => ENV['AMAZON_ACCESS_KEY_ID'],
:associate_tag => ENV['AMAZON_ASSOCIATE_TAG'],
:search_index => 'Books'
}
options = defaults.merge options
Amazon::Ecs.options = {:aWS_access_key_id => options[:access_key], :associate_tag => options[:associate_tag] }
write_inheritable_attribute(:amazon_asin, options[:asin])
write_inheritable_attribute(:amazon_name, options[:name])
write_inheritable_attribute(:amazon_search_index, options[:search_index])
write_inheritable_attribute(:amazon_associate_key, options[:associate_key])
class_inheritable_reader :amazon_asin, :amazon_name, :amazon_search_index, :amazon_associate_key
has_one :amazon_product, :as => :amazonable include Netphase::Acts::Amazonable::InstanceMethods
extend Netphase::Acts::Amazonable::SingletonMethods
end
|