class MoneyExchange::Client::OXR

Constants

ENDPOINT

Public Class Methods

new(app_id, iso_base = 'USD') click to toggle source
# File lib/money_exchange/client/oxr.rb, line 8
def initialize(app_id, iso_base = 'USD')
  @app_id = app_id
  @iso_base = iso_base
end

Public Instance Methods

data() click to toggle source
# File lib/money_exchange/client/oxr.rb, line 13
def data
  uri =
    URI.join(ENDPOINT, 'latest.json').tap do |uri|
      uri.query = "app_id=#{@app_id}"
      uri.query += "&base=#{@iso_base}" if @iso_base
    end.to_s

  response = open(uri)
  JSON.parse(response)
end