Class: Cadooz::Immutable::ProductCategory

Inherits:
Object
  • Object
show all
Includes:
Mixins
Defined in:
lib/cadooz/models/immutable/product_category.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#descriptionObject (readonly)

Returns the value of attribute description.



4
5
6
# File 'lib/cadooz/models/immutable/product_category.rb', line 4

def description
  @description
end

#idObject (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_nameObject (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_nameObject (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