Sha256: 1ead7f828c29c73c92f5670212ff9b005bc9bc5548d7126579eac142bab04a25

Contents?: true

Size: 481 Bytes

Versions: 1

Compression:

Stored size: 481 Bytes

Contents

module CurrencyCloud
  class Rate
    include CurrencyCloud::Resource

    resource :rates

    def self.find(params)
      response = client.get("find", params)

      rates = response["rates"].map do |currency_pair, (bid, offer)|
        new(currency_pair: currency_pair, bid: bid, offer: offer)
      end

      Rates.new(currencies: rates, unavailable: response["unavailable"])
    end

    def self.detailed(params)
      new(client.get("detailed", params))
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
currency_cloud-0.7.2 lib/currency_cloud/rate.rb