Class: Cadooz::Immutable::CatalogProductVariation
- Inherits:
-
Object
- Object
- Cadooz::Immutable::CatalogProductVariation
- Includes:
- Mixins
- Defined in:
- lib/cadooz/models/immutable/catalog_product_variation.rb
Instance Attribute Summary collapse
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(open_struct) ⇒ CatalogProductVariation
constructor
A new instance of CatalogProductVariation.
Methods included from Mixins
#cadooz_class, #default_value_for_nil, #instance_variables_empty?, #serialize
Constructor Details
#initialize(open_struct) ⇒ CatalogProductVariation
Returns a new instance of CatalogProductVariation.
6 7 8 9 10 11 12 13 |
# File 'lib/cadooz/models/immutable/catalog_product_variation.rb', line 6 def initialize(open_struct) @currency = open_struct&.currency @name = open_struct&.name @number = open_struct&.number @value = Money.new((open_struct&.value.to_f * 100) || 0, @currency || 'USD') self.freeze end |
Instance Attribute Details
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
4 5 6 |
# File 'lib/cadooz/models/immutable/catalog_product_variation.rb', line 4 def currency @currency end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/cadooz/models/immutable/catalog_product_variation.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_variation.rb', line 4 def number @number end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
4 5 6 |
# File 'lib/cadooz/models/immutable/catalog_product_variation.rb', line 4 def value @value end |