Class: Cadooz::Immutable::Voucher

Inherits:
Object
  • Object
show all
Includes:
Mixins
Defined in:
lib/cadooz/models/immutable/voucher.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) ⇒ Voucher

Returns a new instance of Voucher.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/cadooz/models/immutable/voucher.rb', line 8

def initialize(open_struct)
  @address = Cadooz::Immutable::Address.new(open_struct&.address)
  @code = open_struct&.code
  @currency = open_struct&.currency
  @ecard_link = open_struct&.ecard_link
  @evoucher_link = open_struct&.evoucher_link
  @pin = open_struct&.pin
  @product_name = open_struct&.product_name
  @product_number = open_struct&.product_number
  @product_variation_number = open_struct&.product_variation_number
  @serial_number = open_struct&.serial_number
  @value = open_struct&.value.to_f

  self.freeze
end

Instance Attribute Details

#addressObject (readonly)

Returns the value of attribute address.



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

def address
  @address
end

#codeObject (readonly)

Returns the value of attribute code.



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

def code
  @code
end

Returns the value of attribute ecard_link.



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

def ecard_link
  @ecard_link
end

Returns the value of attribute evoucher_link.



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

def evoucher_link
  @evoucher_link
end

#pinObject (readonly)

Returns the value of attribute pin.



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

def pin
  @pin
end

#product_nameObject (readonly)

Returns the value of attribute product_name.



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

def product_name
  @product_name
end

#product_numberObject (readonly)

Returns the value of attribute product_number.



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

def product_number
  @product_number
end

#product_variation_numberObject (readonly)

Returns the value of attribute product_variation_number.



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

def product_variation_number
  @product_variation_number
end

#serial_numberObject (readonly)

Returns the value of attribute serial_number.



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

def serial_number
  @serial_number
end

#valueObject (readonly)

Returns the value of attribute value.



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

def value
  @value
end