Class: BestBuy::Product
- Inherits:
-
Object
- Object
- BestBuy::Product
- Defined in:
- lib/best_buy/models/product.rb
Overview
:reek:TooManyInstanceVariables
Instance Attribute Summary collapse
-
#active ⇒ Object
readonly
Returns the value of attribute active.
-
#alternate_categories ⇒ Object
readonly
Returns the value of attribute alternate_categories.
-
#category_path ⇒ Object
readonly
Returns the value of attribute category_path.
-
#images ⇒ Object
readonly
Returns the value of attribute images.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#offers ⇒ Object
readonly
Returns the value of attribute offers.
-
#raw_attributes ⇒ Object
readonly
Returns the value of attribute raw_attributes.
-
#regular_price ⇒ Object
readonly
Returns the value of attribute regular_price.
-
#sale_price ⇒ Object
readonly
Returns the value of attribute sale_price.
-
#shipping_cost ⇒ Object
readonly
Returns the value of attribute shipping_cost.
-
#shipping_levels_of_service ⇒ Object
readonly
Returns the value of attribute shipping_levels_of_service.
-
#sku ⇒ Object
readonly
Returns the value of attribute sku.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#upc ⇒ Object
readonly
Returns the value of attribute upc.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(init_params) ⇒ Product
constructor
rubocop:disable Metrics/AbcSize.
Constructor Details
#initialize(init_params) ⇒ Product
rubocop:disable Metrics/AbcSize
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/best_buy/models/product.rb', line 13 def initialize(init_params) @active = init_params[:active] @alternate_categories = init_params[:alternate_categories] @category_path = init_params[:category_path] @images = init_params[:images]&.map do |image_params| Image.new(image_params) end @name = init_params[:name] @offers = init_params[:offers]&.map do |offer_params| Offer.new(offer_params) end @regular_price = init_params[:regular_price] @sale_price = init_params[:sale_price] @shipping_cost = init_params[:shipping_cost] @shipping_levels_of_service = init_params[:shipping_levels_of_service]&.map do |slos_params| ShippingLevelOfService.new(slos_params) end @sku = init_params[:sku] @type = init_params[:type] @upc = init_params[:upc] @url = init_params[:url] @raw_attributes = init_params end |
Instance Attribute Details
#active ⇒ Object (readonly)
Returns the value of attribute active.
8 9 10 |
# File 'lib/best_buy/models/product.rb', line 8 def active @active end |
#alternate_categories ⇒ Object (readonly)
Returns the value of attribute alternate_categories.
8 9 10 |
# File 'lib/best_buy/models/product.rb', line 8 def alternate_categories @alternate_categories end |
#category_path ⇒ Object (readonly)
Returns the value of attribute category_path.
8 9 10 |
# File 'lib/best_buy/models/product.rb', line 8 def category_path @category_path end |
#images ⇒ Object (readonly)
Returns the value of attribute images.
8 9 10 |
# File 'lib/best_buy/models/product.rb', line 8 def images @images end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/best_buy/models/product.rb', line 8 def name @name end |
#offers ⇒ Object (readonly)
Returns the value of attribute offers.
8 9 10 |
# File 'lib/best_buy/models/product.rb', line 8 def offers @offers end |
#raw_attributes ⇒ Object (readonly)
Returns the value of attribute raw_attributes.
8 9 10 |
# File 'lib/best_buy/models/product.rb', line 8 def raw_attributes @raw_attributes end |
#regular_price ⇒ Object (readonly)
Returns the value of attribute regular_price.
8 9 10 |
# File 'lib/best_buy/models/product.rb', line 8 def regular_price @regular_price end |
#sale_price ⇒ Object (readonly)
Returns the value of attribute sale_price.
8 9 10 |
# File 'lib/best_buy/models/product.rb', line 8 def sale_price @sale_price end |
#shipping_cost ⇒ Object (readonly)
Returns the value of attribute shipping_cost.
8 9 10 |
# File 'lib/best_buy/models/product.rb', line 8 def shipping_cost @shipping_cost end |
#shipping_levels_of_service ⇒ Object (readonly)
Returns the value of attribute shipping_levels_of_service.
8 9 10 |
# File 'lib/best_buy/models/product.rb', line 8 def shipping_levels_of_service @shipping_levels_of_service end |
#sku ⇒ Object (readonly)
Returns the value of attribute sku.
8 9 10 |
# File 'lib/best_buy/models/product.rb', line 8 def sku @sku end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
8 9 10 |
# File 'lib/best_buy/models/product.rb', line 8 def type @type end |
#upc ⇒ Object (readonly)
Returns the value of attribute upc.
8 9 10 |
# File 'lib/best_buy/models/product.rb', line 8 def upc @upc end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
8 9 10 |
# File 'lib/best_buy/models/product.rb', line 8 def url @url end |