Class: Cadooz::Immutable::ProductCategory
- Inherits:
-
Object
- Object
- Cadooz::Immutable::ProductCategory
- Includes:
- Mixins
- Defined in:
- lib/cadooz/models/immutable/product_category.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#internal_name ⇒ Object
readonly
Returns the value of attribute internal_name.
-
#shop_name ⇒ Object
readonly
Returns the value of attribute shop_name.
Instance Method Summary collapse
-
#initialize(open_struct) ⇒ ProductCategory
constructor
A new instance of ProductCategory.
Methods included from Mixins
#cadooz_class, #default_value_for_nil, #instance_variables_empty?, #serialize
Constructor Details
#initialize(open_struct) ⇒ ProductCategory
Returns a new instance of ProductCategory.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/cadooz/models/immutable/product_category.rb', line 6 def initialize(open_struct) @id = open_struct&.id @description = open_struct&.description &.map_entries &.elements &.inject({}) { |hash, element| hash.merge(element.key.to_sym => element.value) } @internal_name = open_struct&.internal_name @shop_name = open_struct&.shop_name &.map_entries &.elements &.inject({}) { |hash, element| hash.merge(element.key.to_sym => element.value) } self.freeze end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
4 5 6 |
# File 'lib/cadooz/models/immutable/product_category.rb', line 4 def description @description end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
4 5 6 |
# File 'lib/cadooz/models/immutable/product_category.rb', line 4 def id @id end |
#internal_name ⇒ Object (readonly)
Returns the value of attribute internal_name.
4 5 6 |
# File 'lib/cadooz/models/immutable/product_category.rb', line 4 def internal_name @internal_name end |
#shop_name ⇒ Object (readonly)
Returns the value of attribute shop_name.
4 5 6 |
# File 'lib/cadooz/models/immutable/product_category.rb', line 4 def shop_name @shop_name end |