Class: FidorApi::Model::StandingOrder

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

Constant Summary

Constants included from BeneficiaryHelper

BeneficiaryHelper::SUPPORTED_ROUTING_TYPES

Instance Attribute Summary

Attributes inherited from Base

#confirmable_action_id

Instance Method Summary collapse

Methods included from BeneficiaryHelper

#define_methods_for, #parse_errors

Methods inherited from Base

#as_json, inherited, #parse_errors, resource_name

Instance Method Details

#beneficiary=(value) ⇒ Object



20
21
22
23
# File 'lib/fidor_api/model/standing_order.rb', line 20

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

#routing_typeObject



25
26
27
28
# File 'lib/fidor_api/model/standing_order.rb', line 25

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

#routing_type=(type) ⇒ Object



30
31
32
33
34
35
36
# File 'lib/fidor_api/model/standing_order.rb', line 30

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