currency-rate 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -0
- data/VERSION +1 -1
- data/currency-rate.gemspec +22 -3
- data/lib/adapter.rb +17 -9
- data/lib/btc_adapter.rb +4 -6
- data/lib/btc_adapters/average_rate_adapter.rb +4 -3
- data/lib/btc_adapters/bitfinex_adapter.rb +30 -0
- data/lib/btc_adapters/bitpay_adapter.rb +10 -3
- data/lib/btc_adapters/bitstamp_adapter.rb +24 -5
- data/lib/btc_adapters/btcchina_adapter.rb +13 -0
- data/lib/btc_adapters/btce_adapter.rb +26 -5
- data/lib/btc_adapters/coinbase_adapter.rb +2 -2
- data/lib/btc_adapters/huobi_adapter.rb +30 -0
- data/lib/btc_adapters/kraken_adapter.rb +14 -5
- data/lib/btc_adapters/localbitcoins_adapter.rb +10 -3
- data/lib/btc_adapters/okcoin_adapter.rb +24 -5
- data/lib/currency_rate.rb +11 -10
- data/lib/fiat_adapter.rb +4 -18
- data/lib/fiat_adapters/fixer_adapter.rb +20 -5
- data/lib/fiat_adapters/yahoo_adapter.rb +28 -6
- data/spec/currency_rate_spec.rb +10 -6
- data/spec/fixtures/vcr/exchange_rate_adapters/btc_adapters/average_rate_adapter.yml +423 -0
- data/spec/fixtures/vcr/exchange_rate_adapters/btc_adapters/bitfinex_adapter.yml +125 -0
- data/spec/fixtures/vcr/exchange_rate_adapters/btc_adapters/bitpay_adapter_yml.yml +272 -0
- data/spec/fixtures/vcr/exchange_rate_adapters/btc_adapters/bitstamp_adapter.yml +153 -0
- data/spec/fixtures/vcr/exchange_rate_adapters/btc_adapters/btcchina_adapter.yml +83 -0
- data/spec/fixtures/vcr/exchange_rate_adapters/btc_adapters/btce_adapter.yml +223 -0
- data/spec/fixtures/vcr/exchange_rate_adapters/btc_adapters/coinbase_adapter.yml +76 -0
- data/spec/fixtures/vcr/exchange_rate_adapters/btc_adapters/huobi_adapter.yml +83 -0
- data/spec/fixtures/vcr/exchange_rate_adapters/btc_adapters/kraken_adapter.yml +83 -0
- data/spec/fixtures/vcr/exchange_rate_adapters/btc_adapters/localbitcoins_adapter.yml +128 -0
- data/spec/fixtures/vcr/exchange_rate_adapters/btc_adapters/okcoin_adapter.yml +207 -0
- data/spec/fixtures/vcr/exchange_rate_adapters/fiat_adapters/fixer_adapter.yml +81 -0
- data/spec/fixtures/vcr/exchange_rate_adapters/fiat_adapters/yahoo_adapter.yml +50 -0
- data/spec/lib/btc_adapter_spec.rb +16 -28
- data/spec/lib/btc_adapters/average_rate_adapter_spec.rb +4 -4
- data/spec/lib/btc_adapters/bitfinex_adapter_spec.rb +38 -0
- data/spec/lib/btc_adapters/bitpay_adapter_spec.rb +8 -3
- data/spec/lib/btc_adapters/bitstamp_adapter_spec.rb +8 -3
- data/spec/lib/btc_adapters/btcchina_adapter_spec.rb +36 -0
- data/spec/lib/btc_adapters/btce_adapter_spec.rb +10 -3
- data/spec/lib/btc_adapters/coinbase_adapter_spec.rb +5 -3
- data/spec/lib/btc_adapters/huobi_adapter_spec.rb +38 -0
- data/spec/lib/btc_adapters/kraken_adapter_spec.rb +6 -3
- data/spec/lib/btc_adapters/localbitcoins_adapter_spec.rb +4 -3
- data/spec/lib/btc_adapters/okcoin_adapter_spec.rb +11 -3
- data/spec/lib/fiat_adapters/fixer_adapter_spec.rb +5 -2
- data/spec/lib/fiat_adapters/yahoo_adapter_spec.rb +5 -2
- metadata +21 -2
@@ -15,8 +15,11 @@ RSpec.describe CurrencyRate::YahooAdapter do
|
|
15
15
|
end
|
16
16
|
|
17
17
|
it "finds the rate for currency code" do
|
18
|
-
expect(@exchange_adapter.rate_for('
|
19
|
-
expect(
|
18
|
+
expect(@exchange_adapter.rate_for('EUR', 'USD')).to eq(1.12)
|
19
|
+
expect(@exchange_adapter.rate_for('USD', 'EUR')).to eq(0.89)
|
20
|
+
expect(@exchange_adapter.rate_for('USD', 'RUB')).to eq(64.78)
|
21
|
+
expect(@exchange_adapter.rate_for('RUB', 'USD')).to eq(0.02)
|
22
|
+
expect( -> { @exchange_adapter.rate_for('USD', 'FEDcoin') }).to raise_error(CurrencyRate::Adapter::CurrencyNotSupported)
|
20
23
|
end
|
21
24
|
|
22
25
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: currency-rate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roman Snitko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06-
|
11
|
+
date: 2016-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: satoshi-unit
|
@@ -114,10 +114,13 @@ files:
|
|
114
114
|
- lib/adapter.rb
|
115
115
|
- lib/btc_adapter.rb
|
116
116
|
- lib/btc_adapters/average_rate_adapter.rb
|
117
|
+
- lib/btc_adapters/bitfinex_adapter.rb
|
117
118
|
- lib/btc_adapters/bitpay_adapter.rb
|
118
119
|
- lib/btc_adapters/bitstamp_adapter.rb
|
120
|
+
- lib/btc_adapters/btcchina_adapter.rb
|
119
121
|
- lib/btc_adapters/btce_adapter.rb
|
120
122
|
- lib/btc_adapters/coinbase_adapter.rb
|
123
|
+
- lib/btc_adapters/huobi_adapter.rb
|
121
124
|
- lib/btc_adapters/kraken_adapter.rb
|
122
125
|
- lib/btc_adapters/localbitcoins_adapter.rb
|
123
126
|
- lib/btc_adapters/okcoin_adapter.rb
|
@@ -129,12 +132,28 @@ files:
|
|
129
132
|
- lib/fiat_adapters/yahoo_adapter.rb
|
130
133
|
- lib/storage.rb
|
131
134
|
- spec/currency_rate_spec.rb
|
135
|
+
- spec/fixtures/vcr/exchange_rate_adapters/btc_adapters/average_rate_adapter.yml
|
136
|
+
- spec/fixtures/vcr/exchange_rate_adapters/btc_adapters/bitfinex_adapter.yml
|
137
|
+
- spec/fixtures/vcr/exchange_rate_adapters/btc_adapters/bitpay_adapter_yml.yml
|
138
|
+
- spec/fixtures/vcr/exchange_rate_adapters/btc_adapters/bitstamp_adapter.yml
|
139
|
+
- spec/fixtures/vcr/exchange_rate_adapters/btc_adapters/btcchina_adapter.yml
|
140
|
+
- spec/fixtures/vcr/exchange_rate_adapters/btc_adapters/btce_adapter.yml
|
141
|
+
- spec/fixtures/vcr/exchange_rate_adapters/btc_adapters/coinbase_adapter.yml
|
142
|
+
- spec/fixtures/vcr/exchange_rate_adapters/btc_adapters/huobi_adapter.yml
|
143
|
+
- spec/fixtures/vcr/exchange_rate_adapters/btc_adapters/kraken_adapter.yml
|
144
|
+
- spec/fixtures/vcr/exchange_rate_adapters/btc_adapters/localbitcoins_adapter.yml
|
145
|
+
- spec/fixtures/vcr/exchange_rate_adapters/btc_adapters/okcoin_adapter.yml
|
146
|
+
- spec/fixtures/vcr/exchange_rate_adapters/fiat_adapters/fixer_adapter.yml
|
147
|
+
- spec/fixtures/vcr/exchange_rate_adapters/fiat_adapters/yahoo_adapter.yml
|
132
148
|
- spec/lib/btc_adapter_spec.rb
|
133
149
|
- spec/lib/btc_adapters/average_rate_adapter_spec.rb
|
150
|
+
- spec/lib/btc_adapters/bitfinex_adapter_spec.rb
|
134
151
|
- spec/lib/btc_adapters/bitpay_adapter_spec.rb
|
135
152
|
- spec/lib/btc_adapters/bitstamp_adapter_spec.rb
|
153
|
+
- spec/lib/btc_adapters/btcchina_adapter_spec.rb
|
136
154
|
- spec/lib/btc_adapters/btce_adapter_spec.rb
|
137
155
|
- spec/lib/btc_adapters/coinbase_adapter_spec.rb
|
156
|
+
- spec/lib/btc_adapters/huobi_adapter_spec.rb
|
138
157
|
- spec/lib/btc_adapters/kraken_adapter_spec.rb
|
139
158
|
- spec/lib/btc_adapters/localbitcoins_adapter_spec.rb
|
140
159
|
- spec/lib/btc_adapters/okcoin_adapter_spec.rb
|