class Exchange::ExternalAPI::Nbkr
Constants
- API_URL
- CURRENCIES
Public Instance Methods
update(opts={})
click to toggle source
# File lib/exchange/external_api/nbkr.rb, line 10 def update opts={} time = helper.assure_time(opts[:at], default: :now) Call.new(API_URL, at: time, format: :xml) do |result| @base = :kgs @rates = result.search('Currency').map do |c| [ c.attr("ISOCode").downcase.to_sym, (1 / BigDecimal.new(c.at('Value').text.sub(',', '.'))) ] end.to_h.merge({ kgs: 1 }) @timestamp = Date.today.to_time.to_i end end