Class: ASIN::SimpleItem
- Inherits:
-
Object
- Object
- ASIN::SimpleItem
- 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
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
Instance Method Summary collapse
- #amount ⇒ Object
- #asin ⇒ Object
- #details_url ⇒ Object
- #image_url ⇒ Object
-
#initialize(hash) ⇒ SimpleItem
constructor
A new instance of SimpleItem.
- #review ⇒ Object
- #title ⇒ Object
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
#raw ⇒ Object (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
#amount ⇒ Object
27 28 29 |
# File 'lib/asin/simple_item.rb', line 27 def amount @raw.ItemAttributes!.ListPrice!.Amount.to_i end |
#asin ⇒ Object
19 20 21 |
# File 'lib/asin/simple_item.rb', line 19 def asin @raw.ASIN end |
#details_url ⇒ Object
31 32 33 |
# File 'lib/asin/simple_item.rb', line 31 def details_url @raw.DetailPageURL end |
#image_url ⇒ Object
39 40 41 |
# File 'lib/asin/simple_item.rb', line 39 def image_url @raw.LargeImage!.URL end |
#review ⇒ Object
35 36 37 |
# File 'lib/asin/simple_item.rb', line 35 def review @raw.EditorialReviews!.EditorialReview!.Content end |
#title ⇒ Object
23 24 25 |
# File 'lib/asin/simple_item.rb', line 23 def title @raw.ItemAttributes!.Title end |