Class: AmazonProduct
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- AmazonProduct
- Defined in:
- lib/amazon_product.rb
Instance Method Summary collapse
- #author ⇒ Object
- #binding ⇒ Object
- #detail_url ⇒ Object
- #get(key) ⇒ Object
-
#hdoc(key) ⇒ Object
belongs_to :amazonable, :polymorphic => true.
- #isbn ⇒ Object
- #large_image_url ⇒ Object
- #medium_image_url ⇒ Object
- #pages ⇒ Object
- #price ⇒ Object
- #small_image_url ⇒ Object
- #title ⇒ Object
Instance Method Details
#author ⇒ Object
23 24 25 |
# File 'lib/amazon_product.rb', line 23 def hdoc("itemattributes/author") end |
#binding ⇒ Object
27 28 29 |
# File 'lib/amazon_product.rb', line 27 def binding hdoc("itemattributes/binding") end |
#detail_url ⇒ Object
51 52 53 |
# File 'lib/amazon_product.rb', line 51 def detail_url hdoc("detailpageurl") end |
#get(key) ⇒ Object
11 12 13 |
# File 'lib/amazon_product.rb', line 11 def get(key) hdoc(key) end |
#hdoc(key) ⇒ Object
belongs_to :amazonable, :polymorphic => true
6 7 8 9 |
# File 'lib/amazon_product.rb', line 6 def hdoc(key) @doc ||= Hpricot.XML(xml) @doc.at(key).inner_html end |
#isbn ⇒ Object
15 16 17 |
# File 'lib/amazon_product.rb', line 15 def isbn hdoc("itemattributes/isbn") end |
#large_image_url ⇒ Object
47 48 49 |
# File 'lib/amazon_product.rb', line 47 def large_image_url hdoc("largeimage/url") end |
#medium_image_url ⇒ Object
43 44 45 |
# File 'lib/amazon_product.rb', line 43 def medium_image_url hdoc("mediumimage/url") end |
#pages ⇒ Object
35 36 37 |
# File 'lib/amazon_product.rb', line 35 def pages hdoc("itemattributes/numberofpages") end |
#price ⇒ Object
31 32 33 |
# File 'lib/amazon_product.rb', line 31 def price hdoc("itemattributes/listprice/amount") end |
#small_image_url ⇒ Object
39 40 41 |
# File 'lib/amazon_product.rb', line 39 def small_image_url hdoc("smallimage/url") end |
#title ⇒ Object
19 20 21 |
# File 'lib/amazon_product.rb', line 19 def title hdoc("itemattributes/title") end |