module FidorApi::Model::BeneficiaryHelper

Constants

SUPPORTED_ROUTING_TYPES

Public Instance Methods

define_methods_for(properties) click to toggle source
# File lib/fidor_api/model/beneficiary_helper.rb, line 13
def define_methods_for(properties) # rubocop:disable Metrics/MethodLength
  properties.each do |name|
    next if respond_to?(name)

    self.class.define_method name do
      @beneficiary ||= {}
      @beneficiary.dig('routing_info', name)
    end

    self.class.define_method "#{name}=" do |value|
      @beneficiary ||= {}
      @beneficiary['routing_info'] ||= {}
      @beneficiary['routing_info'][name] = value
    end
  end
end
parse_errors(body) click to toggle source
Calls superclass method
# File lib/fidor_api/model/beneficiary_helper.rb, line 30
def parse_errors(body)
  body['errors'].each do |hash|
    hash['field'].sub!('beneficiary.routing_info.', '')
  end
  super(body)
end