Class: ShopsavvyDataApi::ProductDetails
- Inherits:
-
Object
- Object
- ShopsavvyDataApi::ProductDetails
- Defined in:
- lib/shopsavvy_data_api/models.rb
Overview
Product details from ShopSavvy API
Instance Attribute Summary collapse
-
#asin ⇒ Object
readonly
Returns the value of attribute asin.
-
#barcode ⇒ Object
readonly
Returns the value of attribute barcode.
-
#brand ⇒ Object
readonly
Returns the value of attribute brand.
-
#category ⇒ Object
readonly
Returns the value of attribute category.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#identifiers ⇒ Object
readonly
Returns the value of attribute identifiers.
-
#image_url ⇒ Object
readonly
Returns the value of attribute image_url.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#mpn ⇒ Object
readonly
Returns the value of attribute mpn.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#product_id ⇒ Object
readonly
Returns the value of attribute product_id.
Instance Method Summary collapse
-
#initialize(data) ⇒ ProductDetails
constructor
A new instance of ProductDetails.
- #to_h ⇒ Object
Constructor Details
#initialize(data) ⇒ ProductDetails
Returns a new instance of ProductDetails.
32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/shopsavvy_data_api/models.rb', line 32 def initialize(data) @product_id = data["product_id"] @name = data["name"] @brand = data["brand"] @category = data["category"] @image_url = data["image_url"] @barcode = data["barcode"] @asin = data["asin"] @model = data["model"] @mpn = data["mpn"] @description = data["description"] @identifiers = data["identifiers"] || {} end |
Instance Attribute Details
#asin ⇒ Object (readonly)
Returns the value of attribute asin.
29 30 31 |
# File 'lib/shopsavvy_data_api/models.rb', line 29 def asin @asin end |
#barcode ⇒ Object (readonly)
Returns the value of attribute barcode.
29 30 31 |
# File 'lib/shopsavvy_data_api/models.rb', line 29 def @barcode end |
#brand ⇒ Object (readonly)
Returns the value of attribute brand.
29 30 31 |
# File 'lib/shopsavvy_data_api/models.rb', line 29 def brand @brand end |
#category ⇒ Object (readonly)
Returns the value of attribute category.
29 30 31 |
# File 'lib/shopsavvy_data_api/models.rb', line 29 def category @category end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
29 30 31 |
# File 'lib/shopsavvy_data_api/models.rb', line 29 def description @description end |
#identifiers ⇒ Object (readonly)
Returns the value of attribute identifiers.
29 30 31 |
# File 'lib/shopsavvy_data_api/models.rb', line 29 def identifiers @identifiers end |
#image_url ⇒ Object (readonly)
Returns the value of attribute image_url.
29 30 31 |
# File 'lib/shopsavvy_data_api/models.rb', line 29 def image_url @image_url end |
#model ⇒ Object (readonly)
Returns the value of attribute model.
29 30 31 |
# File 'lib/shopsavvy_data_api/models.rb', line 29 def model @model end |
#mpn ⇒ Object (readonly)
Returns the value of attribute mpn.
29 30 31 |
# File 'lib/shopsavvy_data_api/models.rb', line 29 def mpn @mpn end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
29 30 31 |
# File 'lib/shopsavvy_data_api/models.rb', line 29 def name @name end |
#product_id ⇒ Object (readonly)
Returns the value of attribute product_id.
29 30 31 |
# File 'lib/shopsavvy_data_api/models.rb', line 29 def product_id @product_id end |
Instance Method Details
#to_h ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/shopsavvy_data_api/models.rb', line 46 def to_h { product_id: product_id, name: name, brand: brand, category: category, image_url: image_url, barcode: , asin: asin, model: model, mpn: mpn, description: description, identifiers: identifiers } end |