Class: ASIN::SimpleItem

Inherits:
Object
  • Object
show all
Defined in:
lib/asin/simple_item.rb

Overview

SimpleItem

The SimpleItem class is a wrapper for the Amazon XML-REST-Response.

A Hashie::Mash is used for the internal data representation and can be accessed over the raw attribute.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ SimpleItem

Returns a new instance of SimpleItem.



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

def initialize(hash)
  @raw = Hashie::Mash.new(hash)
end

Instance Attribute Details

#rawObject (readonly)

Returns the value of attribute raw.



13
14
15
# File 'lib/asin/simple_item.rb', line 13

def raw
  @raw
end

Instance Method Details

#amountObject



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

def amount
  @raw.ItemAttributes!.ListPrice!.Amount.to_i
end

#asinObject



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

def asin
  @raw.ASIN
end

#details_urlObject



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

def details_url
  @raw.DetailPageURL
end

#image_urlObject



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

def image_url
  @raw.LargeImage!.URL
end

#reviewObject



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

def review
   @raw.EditorialReviews!.EditorialReview!.Content
end

#titleObject



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

def title
  @raw.ItemAttributes!.Title
end