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

- (SimpleItem) initialize(hash)

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

- (Object) raw (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

- (Object) amount



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

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

- (Object) asin



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

def asin
  @raw.ASIN
end

- (Object) details_url



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

def details_url
  @raw.DetailPageURL
end

- (Object) image_url



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

def image_url
  @raw.LargeImage!.URL
end

- (Object) review



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

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

- (Object) title



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

def title
  @raw.ItemAttributes!.Title
end