Class: ShopsavvyDataApi::ProductDetails

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

Overview

Product details from ShopSavvy API

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#asinObject (readonly)

Returns the value of attribute asin.



29
30
31
# File 'lib/shopsavvy_data_api/models.rb', line 29

def asin
  @asin
end

#barcodeObject (readonly)

Returns the value of attribute barcode.



29
30
31
# File 'lib/shopsavvy_data_api/models.rb', line 29

def barcode
  @barcode
end

#brandObject (readonly)

Returns the value of attribute brand.



29
30
31
# File 'lib/shopsavvy_data_api/models.rb', line 29

def brand
  @brand
end

#categoryObject (readonly)

Returns the value of attribute category.



29
30
31
# File 'lib/shopsavvy_data_api/models.rb', line 29

def category
  @category
end

#descriptionObject (readonly)

Returns the value of attribute description.



29
30
31
# File 'lib/shopsavvy_data_api/models.rb', line 29

def description
  @description
end

#identifiersObject (readonly)

Returns the value of attribute identifiers.



29
30
31
# File 'lib/shopsavvy_data_api/models.rb', line 29

def identifiers
  @identifiers
end

#image_urlObject (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

#modelObject (readonly)

Returns the value of attribute model.



29
30
31
# File 'lib/shopsavvy_data_api/models.rb', line 29

def model
  @model
end

#mpnObject (readonly)

Returns the value of attribute mpn.



29
30
31
# File 'lib/shopsavvy_data_api/models.rb', line 29

def mpn
  @mpn
end

#nameObject (readonly)

Returns the value of attribute name.



29
30
31
# File 'lib/shopsavvy_data_api/models.rb', line 29

def name
  @name
end

#product_idObject (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_hObject



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: barcode,
    asin: asin,
    model: model,
    mpn: mpn,
    description: description,
    identifiers: identifiers
  }
end