Sha256: 2c7f3e6619458e0c6a62115fc0e99b238b8ccfe8d9c28b8f214843bff7821bbd
Contents?: true
Size: 956 Bytes
Versions: 2
Compression:
Stored size: 956 Bytes
Contents
require_relative "../string_utilities" module InvestecOpenApi::Models using InvestecOpenApi::StringUtilities class Base def initialize(params) params .transform_keys(&:underscore) .each { |key, value| instance_variable_set("@#{key}", value) } end def self.rewrite_param_key(params, key, rewritten_key) params[rewritten_key] = params[key] unless params[key].nil? end def self.convert_param_value_to_money( params, key, currency_key = "currency", should_make_negative = false ) if params[key].nil? return end value_in_cents = params[key] * 100 value_in_cents = -value_in_cents if should_make_negative params[key] = Money.from_cents( value_in_cents, params[currency_key]) end def self.convert_param_value_to_date(params, key) params[key] = Date.parse(params[key]) unless params[key].nil? end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
investec_open_api-2.1.0 | lib/investec_open_api/models/base.rb |
investec_open_api-2.0.0 | lib/investec_open_api/models/base.rb |