Class: FidorApi::Model::Transfer::Generic

Inherits:
Base
  • Object
show all
Includes:
BeneficiaryHelper
Defined in:
lib/fidor_api/model/transfer/generic.rb

Constant Summary

Constants included from BeneficiaryHelper

BeneficiaryHelper::SUPPORTED_ROUTING_TYPES

Instance Attribute Summary

Attributes inherited from Base

#confirmable_action_id

Class Method Summary collapse

Instance Method Summary collapse

Methods included from BeneficiaryHelper

#define_methods_for, #parse_errors

Methods inherited from Base

#as_json, inherited, #parse_errors

Class Method Details

.resource_nameObject



20
21
22
# File 'lib/fidor_api/model/transfer/generic.rb', line 20

def self.resource_name
  'Transfer'
end

Instance Method Details

#beneficiary=(value) ⇒ Object



24
25
26
27
# File 'lib/fidor_api/model/transfer/generic.rb', line 24

def beneficiary=(value)
  write_attribute(:beneficiary, value)
  define_methods_for(SUPPORTED_ROUTING_TYPES[beneficiary['routing_type']])
end

#routing_typeObject



29
30
31
32
# File 'lib/fidor_api/model/transfer/generic.rb', line 29

def routing_type
  @beneficiary ||= {}
  @beneficiary.dig('routing_type')
end

#routing_type=(type) ⇒ Object



34
35
36
37
38
39
40
# File 'lib/fidor_api/model/transfer/generic.rb', line 34

def routing_type=(type)
  raise Errors::NotSupported unless SUPPORTED_ROUTING_TYPES.key?(type)

  @beneficiary ||= {}
  @beneficiary['routing_type'] = type
  define_methods_for(SUPPORTED_ROUTING_TYPES[type])
end