Module: AlfaBank::RestDataBuilder

Defined in:
lib/alfa_bank/rest_data_builder.rb

Class Method Summary collapse

Class Method Details

.build_params(key, args) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/alfa_bank/rest_data_builder.rb', line 5

def self.build_params(key, args)
  unless Constants::ALFA_LINKS.key?(key)
    raise NoMethodError, "#{key} type of request does not supported by AlfaBank adapter"
  end
  params = {}
  Constants.const_get("#{key.upcase}_FIELDS_MAP").each_pair do |arg, alfa_param|
    params[alfa_param] = args[arg] if args[arg]
  end
  params
end