Class: ShopsavvyDataApi::ProductDetails
- Inherits:
-
Object
- Object
- ShopsavvyDataApi::ProductDetails
- Defined in:
- lib/shopsavvy_data_api/models.rb
Overview
Product details from ShopSavvy API
Direct Known Subclasses
Instance Attribute Summary collapse
-
#amazon ⇒ Object
readonly
Returns the value of attribute amazon.
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#barcode ⇒ Object
readonly
Returns the value of attribute barcode.
-
#brand ⇒ Object
readonly
Returns the value of attribute brand.
-
#categories ⇒ Object
readonly
Returns the value of attribute categories.
-
#category ⇒ Object
readonly
Returns the value of attribute category.
-
#color ⇒ Object
readonly
Returns the value of attribute color.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#identifiers ⇒ Object
readonly
Returns the value of attribute identifiers.
-
#images ⇒ Object
readonly
Returns the value of attribute images.
-
#keywords ⇒ Object
readonly
Returns the value of attribute keywords.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#mpn ⇒ Object
readonly
Returns the value of attribute mpn.
-
#rating ⇒ Object
readonly
Returns the value of attribute rating.
-
#score ⇒ Object
readonly
Returns the value of attribute score.
-
#shopsavvy ⇒ Object
readonly
Returns the value of attribute shopsavvy.
-
#slug ⇒ Object
readonly
Returns the value of attribute slug.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#title_short ⇒ Object
readonly
Returns the value of attribute title_short.
Instance Method Summary collapse
-
#asin ⇒ Object
deprecated
Deprecated.
Use ‘amazon` instead
-
#image_url ⇒ Object
deprecated
Deprecated.
Use ‘images` instead
-
#initialize(data) ⇒ ProductDetails
constructor
A new instance of ProductDetails.
-
#name ⇒ Object
deprecated
Deprecated.
Use ‘title` instead
-
#product_id ⇒ Object
deprecated
Deprecated.
Use ‘shopsavvy` instead
- #to_h ⇒ Object
Constructor Details
#initialize(data) ⇒ ProductDetails
Returns a new instance of ProductDetails.
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/shopsavvy_data_api/models.rb', line 53 def initialize(data) @title = data["title"] @shopsavvy = data["shopsavvy"] @brand = data["brand"] @category = data["category"] @images = data["images"] || [] @barcode = data["barcode"] @amazon = data["amazon"] @model = data["model"] @mpn = data["mpn"] @color = data["color"] @title_short = data["title_short"] @slug = data["slug"] @description = data["description"] @categories = data["categories"] @attributes = data["attributes"] @rating = data["rating"] @score = data["score"] @keywords = data["keywords"] @identifiers = data["identifiers"] end |
Instance Attribute Details
#amazon ⇒ Object (readonly)
Returns the value of attribute amazon.
48 49 50 |
# File 'lib/shopsavvy_data_api/models.rb', line 48 def amazon @amazon end |
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
48 49 50 |
# File 'lib/shopsavvy_data_api/models.rb', line 48 def attributes @attributes end |
#barcode ⇒ Object (readonly)
Returns the value of attribute barcode.
48 49 50 |
# File 'lib/shopsavvy_data_api/models.rb', line 48 def @barcode end |
#brand ⇒ Object (readonly)
Returns the value of attribute brand.
48 49 50 |
# File 'lib/shopsavvy_data_api/models.rb', line 48 def brand @brand end |
#categories ⇒ Object (readonly)
Returns the value of attribute categories.
48 49 50 |
# File 'lib/shopsavvy_data_api/models.rb', line 48 def categories @categories end |
#category ⇒ Object (readonly)
Returns the value of attribute category.
48 49 50 |
# File 'lib/shopsavvy_data_api/models.rb', line 48 def category @category end |
#color ⇒ Object (readonly)
Returns the value of attribute color.
48 49 50 |
# File 'lib/shopsavvy_data_api/models.rb', line 48 def color @color end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
48 49 50 |
# File 'lib/shopsavvy_data_api/models.rb', line 48 def description @description end |
#identifiers ⇒ Object (readonly)
Returns the value of attribute identifiers.
48 49 50 |
# File 'lib/shopsavvy_data_api/models.rb', line 48 def identifiers @identifiers end |
#images ⇒ Object (readonly)
Returns the value of attribute images.
48 49 50 |
# File 'lib/shopsavvy_data_api/models.rb', line 48 def images @images end |
#keywords ⇒ Object (readonly)
Returns the value of attribute keywords.
48 49 50 |
# File 'lib/shopsavvy_data_api/models.rb', line 48 def keywords @keywords end |
#model ⇒ Object (readonly)
Returns the value of attribute model.
48 49 50 |
# File 'lib/shopsavvy_data_api/models.rb', line 48 def model @model end |
#mpn ⇒ Object (readonly)
Returns the value of attribute mpn.
48 49 50 |
# File 'lib/shopsavvy_data_api/models.rb', line 48 def mpn @mpn end |
#rating ⇒ Object (readonly)
Returns the value of attribute rating.
48 49 50 |
# File 'lib/shopsavvy_data_api/models.rb', line 48 def @rating end |
#score ⇒ Object (readonly)
Returns the value of attribute score.
48 49 50 |
# File 'lib/shopsavvy_data_api/models.rb', line 48 def score @score end |
#shopsavvy ⇒ Object (readonly)
Returns the value of attribute shopsavvy.
48 49 50 |
# File 'lib/shopsavvy_data_api/models.rb', line 48 def shopsavvy @shopsavvy end |
#slug ⇒ Object (readonly)
Returns the value of attribute slug.
48 49 50 |
# File 'lib/shopsavvy_data_api/models.rb', line 48 def slug @slug end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
48 49 50 |
# File 'lib/shopsavvy_data_api/models.rb', line 48 def title @title end |
#title_short ⇒ Object (readonly)
Returns the value of attribute title_short.
48 49 50 |
# File 'lib/shopsavvy_data_api/models.rb', line 48 def title_short @title_short end |
Instance Method Details
#asin ⇒ Object
Use ‘amazon` instead
86 87 88 |
# File 'lib/shopsavvy_data_api/models.rb', line 86 def asin amazon end |
#image_url ⇒ Object
Use ‘images` instead
91 92 93 |
# File 'lib/shopsavvy_data_api/models.rb', line 91 def image_url images&.first end |
#name ⇒ Object
Use ‘title` instead
76 77 78 |
# File 'lib/shopsavvy_data_api/models.rb', line 76 def name title end |
#product_id ⇒ Object
Use ‘shopsavvy` instead
81 82 83 |
# File 'lib/shopsavvy_data_api/models.rb', line 81 def product_id shopsavvy end |
#to_h ⇒ Object
95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/shopsavvy_data_api/models.rb', line 95 def to_h { title: title, shopsavvy: shopsavvy, brand: brand, category: category, images: images, barcode: , amazon: amazon, model: model, mpn: mpn, color: color } end |