Class: Worldline::Connect::SDK::V1::Domain::TokenNonSepaDirectDebit

Inherits:
AbstractToken show all
Defined in:
lib/worldline/connect/sdk/v1/domain/token_non_sepa_direct_debit.rb

Instance Attribute Summary collapse

Attributes inherited from AbstractToken

#alias

Instance Method Summary collapse

Methods inherited from Domain::DataObject

new_from_hash

Instance Attribute Details

#customerWorldline::Connect::SDK::V1::Domain::CustomerToken

Returns the current value of customer.

Returns:



16
17
18
# File 'lib/worldline/connect/sdk/v1/domain/token_non_sepa_direct_debit.rb', line 16

def customer
  @customer
end

#mandateWorldline::Connect::SDK::V1::Domain::MandateNonSepaDirectDebit

Returns the current value of mandate.

Returns:



16
17
18
# File 'lib/worldline/connect/sdk/v1/domain/token_non_sepa_direct_debit.rb', line 16

def mandate
  @mandate
end

Instance Method Details

#from_hash(hash) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/worldline/connect/sdk/v1/domain/token_non_sepa_direct_debit.rb', line 30

def from_hash(hash)
  super
  if hash.has_key? 'customer'
    raise TypeError, "value '%s' is not a Hash" % [hash['customer']] unless hash['customer'].is_a? Hash
    @customer = Worldline::Connect::SDK::V1::Domain::CustomerToken.new_from_hash(hash['customer'])
  end
  if hash.has_key? 'mandate'
    raise TypeError, "value '%s' is not a Hash" % [hash['mandate']] unless hash['mandate'].is_a? Hash
    @mandate = Worldline::Connect::SDK::V1::Domain::MandateNonSepaDirectDebit.new_from_hash(hash['mandate'])
  end
end

#to_hHash

Returns:

  • (Hash)


23
24
25
26
27
28
# File 'lib/worldline/connect/sdk/v1/domain/token_non_sepa_direct_debit.rb', line 23

def to_h
  hash = super
  hash['customer'] = @customer.to_h unless @customer.nil?
  hash['mandate'] = @mandate.to_h unless @mandate.nil?
  hash
end