Class: A2z::Responses::TopItem

Inherits:
Object
  • Object
show all
Defined in:
lib/a2z/responses/top_item.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#actorObject

Returns the value of attribute actor.



4
5
6
# File 'lib/a2z/responses/top_item.rb', line 4

def actor
  @actor
end

#artistObject

Returns the value of attribute artist.



4
5
6
# File 'lib/a2z/responses/top_item.rb', line 4

def artist
  @artist
end

#asinObject

Returns the value of attribute asin.



4
5
6
# File 'lib/a2z/responses/top_item.rb', line 4

def asin
  @asin
end

#authorObject

Returns the value of attribute author.



4
5
6
# File 'lib/a2z/responses/top_item.rb', line 4

def author
  @author
end

#detail_page_urlObject

Returns the value of attribute detail_page_url.



4
5
6
# File 'lib/a2z/responses/top_item.rb', line 4

def detail_page_url
  @detail_page_url
end

#product_groupObject

Returns the value of attribute product_group.



4
5
6
# File 'lib/a2z/responses/top_item.rb', line 4

def product_group
  @product_group
end

#titleObject

Returns the value of attribute title.



4
5
6
# File 'lib/a2z/responses/top_item.rb', line 4

def title
  @title
end

Class Method Details

.from_response(data) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/a2z/responses/top_item.rb', line 7

def self.from_response(data)
  new.tap do |top_item|
    top_item.asin = data['ASIN']
    top_item.title = data['Title']
    top_item.product_group = data['ProductGroup']
    top_item.actor = data['Actor']
    top_item.artist = data['Artist']
    top_item.author = data['Author']
    top_item.detail_page_url = data['DetailPageURL']
    top_item.freeze
  end
end