class ECBExchangeRatesApi::Options
Presents API params
Attributes
base[R]
end_at[R]
specific_date[R]
start_at[R]
symbols[R]
Public Class Methods
new()
click to toggle source
# File lib/ecb_exchange_rates_api/options.rb, line 15 def initialize @start_at = nil @end_at = nil @specific_date = nil @base = nil @symbols = [] end
Public Instance Methods
append_symbol(code)
click to toggle source
# File lib/ecb_exchange_rates_api/options.rb, line 23 def append_symbol(code) @symbols << validated_currency_code(code) end
to_params()
click to toggle source
# File lib/ecb_exchange_rates_api/options.rb, line 27 def to_params options_params.reject { |_, val| val.nil? || val.empty? } end
Private Instance Methods
options_params()
click to toggle source
# File lib/ecb_exchange_rates_api/options.rb, line 33 def options_params instance_variables.each_with_object({}) do |var, hash| key = var.to_s[1..].to_sym variable = instance_variable_get(var) value = key == :symbols ? variable&.join(",") : variable hash[key] = value end end