Module: IndependentReserve

Defined in:
lib/independent_reserve.rb,
lib/independent_reserve/version.rb

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.market_summary(primary_currency_code:, secondary_currency_code:) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/independent_reserve.rb', line 10

def self.market_summary(primary_currency_code:, secondary_currency_code:)
  url = "https://api.independentreserve.com/Public/GetMarketSummary"\
    "?PrimaryCurrencyCode=#{primary_currency_code}"\
    "&SecondaryCurrencyCode=#{secondary_currency_code}"

  response_body = HTTP.get(url).to_s
  hash = JSON.parse(response_body, decimal_class: BigDecimal)
  hash.transform_keys { |key| key.underscore.to_sym }
end