Class: AmazonProduct

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/amazon_product.rb

Instance Method Summary collapse

Instance Method Details

#authorObject



23
24
25
# File 'lib/amazon_product.rb', line 23

def author
  hdoc("itemattributes/author")
end

#bindingObject



27
28
29
# File 'lib/amazon_product.rb', line 27

def binding
  hdoc("itemattributes/binding")
end

#detail_urlObject



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

#isbnObject



15
16
17
# File 'lib/amazon_product.rb', line 15

def isbn
  hdoc("itemattributes/isbn")
end

#large_image_urlObject



47
48
49
# File 'lib/amazon_product.rb', line 47

def large_image_url
  hdoc("largeimage/url")
end

#medium_image_urlObject



43
44
45
# File 'lib/amazon_product.rb', line 43

def medium_image_url
  hdoc("mediumimage/url")
end

#pagesObject



35
36
37
# File 'lib/amazon_product.rb', line 35

def pages
  hdoc("itemattributes/numberofpages")
end

#priceObject



31
32
33
# File 'lib/amazon_product.rb', line 31

def price
  hdoc("itemattributes/listprice/amount")
end

#small_image_urlObject



39
40
41
# File 'lib/amazon_product.rb', line 39

def small_image_url
  hdoc("smallimage/url")
end

#titleObject



19
20
21
# File 'lib/amazon_product.rb', line 19

def title
  hdoc("itemattributes/title")
end