Class: Cadooz::Immutable::Payment

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

Returns a new instance of Payment.



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/cadooz/models/immutable/payment.rb', line 6

def initialize(open_struct)
  @attributes = open_struct&.attributes
                           &.map_entries
                           &.elements
                           &.inject({}) { |hash, element| hash.merge(element.key.to_sym => element.value) }
  @description = open_struct&.description
  @paid = open_struct&.paid
  @type = open_struct&.type
  @value = open_struct&.value
  @verified = open_struct&.verified

  self.freeze
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



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

def attributes
  @attributes
end

#descriptionObject (readonly)

Returns the value of attribute description.



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

def description
  @description
end

Returns the value of attribute paid.



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

def paid
  @paid
end

#typeObject (readonly)

Returns the value of attribute type.



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

def type
  @type
end

#valueObject (readonly)

Returns the value of attribute value.



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

def value
  @value
end

#verifiedObject (readonly)

Returns the value of attribute verified.



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

def verified
  @verified
end