Class: Cadooz::Immutable::CatalogProduct
- Inherits:
-
Object
- Object
- Cadooz::Immutable::CatalogProduct
- Includes:
- Mixins
- Defined in:
- lib/cadooz/models/immutable/catalog_product.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#categories ⇒ Object
readonly
Returns the value of attribute categories.
-
#mobile_shippable ⇒ Object
readonly
Returns the value of attribute mobile_shippable.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#offline_shippable ⇒ Object
readonly
Returns the value of attribute offline_shippable.
-
#online_shippable ⇒ Object
readonly
Returns the value of attribute online_shippable.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#variations ⇒ Object
readonly
Returns the value of attribute variations.
Instance Method Summary collapse
-
#initialize(open_struct) ⇒ CatalogProduct
constructor
A new instance of CatalogProduct.
Methods included from Mixins
#cadooz_class, #default_value_for_nil, #instance_variables_empty?, #serialize
Constructor Details
#initialize(open_struct) ⇒ CatalogProduct
Returns a new instance of CatalogProduct.
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/cadooz/models/immutable/catalog_product.rb', line 6 def initialize(open_struct) @attributes = Array(open_struct&.attributes)&.each_with_object([]) { |a, arr| arr << Cadooz::Immutable::Attributes.new(a) } @categories = Array(open_struct&.categories)&.each_with_object([]) { |c, arr| arr << Cadooz::Immutable::ProductCategory.new(c) } @mobile_shippable = open_struct&.mobile_shippable @name = open_struct&.name @number = open_struct&.number @offline_shippable = open_struct&.offline_shippable @online_shippable = open_struct&.online_shippable @type = open_struct&.type @variations = Array(open_struct&.variations)&.each_with_object([]) { |v, arr| arr << Cadooz::Immutable::CatalogProductVariation.new(v) } self.freeze end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
4 5 6 |
# File 'lib/cadooz/models/immutable/catalog_product.rb', line 4 def attributes @attributes end |
#categories ⇒ Object (readonly)
Returns the value of attribute categories.
4 5 6 |
# File 'lib/cadooz/models/immutable/catalog_product.rb', line 4 def categories @categories end |
#mobile_shippable ⇒ Object (readonly)
Returns the value of attribute mobile_shippable.
4 5 6 |
# File 'lib/cadooz/models/immutable/catalog_product.rb', line 4 def mobile_shippable @mobile_shippable end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/cadooz/models/immutable/catalog_product.rb', line 4 def name @name end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
4 5 6 |
# File 'lib/cadooz/models/immutable/catalog_product.rb', line 4 def number @number end |
#offline_shippable ⇒ Object (readonly)
Returns the value of attribute offline_shippable.
4 5 6 |
# File 'lib/cadooz/models/immutable/catalog_product.rb', line 4 def offline_shippable @offline_shippable end |
#online_shippable ⇒ Object (readonly)
Returns the value of attribute online_shippable.
4 5 6 |
# File 'lib/cadooz/models/immutable/catalog_product.rb', line 4 def online_shippable @online_shippable end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
4 5 6 |
# File 'lib/cadooz/models/immutable/catalog_product.rb', line 4 def type @type end |
#variations ⇒ Object (readonly)
Returns the value of attribute variations.
4 5 6 |
# File 'lib/cadooz/models/immutable/catalog_product.rb', line 4 def variations @variations end |