Sha256: b85af2ed27898ee1116b748f119e60b1734e6435e428c9b72e39fbded9240e1d

Contents?: true

Size: 558 Bytes

Versions: 3

Compression:

Stored size: 558 Bytes

Contents

module CurrencyRate
  class CoinbaseAdapter < CryptoAdapter

    FETCH_URL = 'https://coinbase.com/api/v1/currencies/exchange_rates'
    DEFAULT_CURRENCIES = ["USD", "BTC"]
    SUPPORTED_CRYPTO_CURRENCIES = ["BTC", "LTC"]

    def rate_for(from,to)
      super
      rate = @rates["#{from.downcase}_to_#{to.downcase}"]
      rate_to_f(rate)
    end

    def supported_currency_pairs
      cache_supported_currency_pairs do
        @rates.each do |k,v|
          @supported_currency_pairs << k.sub("_to_", "/").upcase
        end
      end
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
currency-rate-0.4.1 lib/crypto_adapters/coinbase_adapter.rb
currency-rate-0.4.0 lib/crypto_adapters/coinbase_adapter.rb
currency-rate-0.3.9 lib/crypto_adapters/coinbase_adapter.rb