Sha256: b5333b09eb770f0c1a80c77609675c2f612eaf32f8adfc96dcb61ec6f0507969

Contents?: true

Size: 524 Bytes

Versions: 3

Compression:

Stored size: 524 Bytes

Contents

module CurrencyCloud
  class Rates < Resource; end

  class Rate < Resource
    resource :rates
    
    def self.find(params)
      response = request.get("#{self.resource}/find", params)

      rates = response['rates'].map do |currency_pair, bid_offer|
                new(currency_pair: currency_pair, bid: bid_offer[0], offer: bid_offer[1])
              end

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

    def self.detailed(params)
      get('detailed', params)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
currency_cloud-0.7.1 lib/currency_cloud/resources/rate.rb
currency_cloud-0.7 lib/currency_cloud/resources/rate.rb
currency_cloud-0.5 lib/currency_cloud/resources/rate.rb