Class: Amazonian::Item

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

Overview

Item

The Item class is used to neatly box up the Amazon REST API responses into an Object.

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) ⇒ Item

Returns a new instance of Item.



208
209
210
# File 'lib/amazonian.rb', line 208

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

Instance Attribute Details

#rawObject (readonly)



207
208
209
# File 'lib/amazonian.rb', line 207

def raw
  @raw
end

Instance Method Details

#titleObject



212
213
214
215
216
217
218
# File 'lib/amazonian.rb', line 212

def title
  if @raw.ItemAttributes && @raw.ItemAttributes.Title
    @raw.ItemAttributes.Title
  else
    nil
  end
end