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.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +13 -0
  3. data/VERSION +1 -1
  4. data/currency-rate.gemspec +22 -3
  5. data/lib/adapter.rb +17 -9
  6. data/lib/btc_adapter.rb +4 -6
  7. data/lib/btc_adapters/average_rate_adapter.rb +4 -3
  8. data/lib/btc_adapters/bitfinex_adapter.rb +30 -0
  9. data/lib/btc_adapters/bitpay_adapter.rb +10 -3
  10. data/lib/btc_adapters/bitstamp_adapter.rb +24 -5
  11. data/lib/btc_adapters/btcchina_adapter.rb +13 -0
  12. data/lib/btc_adapters/btce_adapter.rb +26 -5
  13. data/lib/btc_adapters/coinbase_adapter.rb +2 -2
  14. data/lib/btc_adapters/huobi_adapter.rb +30 -0
  15. data/lib/btc_adapters/kraken_adapter.rb +14 -5
  16. data/lib/btc_adapters/localbitcoins_adapter.rb +10 -3
  17. data/lib/btc_adapters/okcoin_adapter.rb +24 -5
  18. data/lib/currency_rate.rb +11 -10
  19. data/lib/fiat_adapter.rb +4 -18
  20. data/lib/fiat_adapters/fixer_adapter.rb +20 -5
  21. data/lib/fiat_adapters/yahoo_adapter.rb +28 -6
  22. data/spec/currency_rate_spec.rb +10 -6
  23. data/spec/fixtures/vcr/exchange_rate_adapters/btc_adapters/average_rate_adapter.yml +423 -0
  24. data/spec/fixtures/vcr/exchange_rate_adapters/btc_adapters/bitfinex_adapter.yml +125 -0
  25. data/spec/fixtures/vcr/exchange_rate_adapters/btc_adapters/bitpay_adapter_yml.yml +272 -0
  26. data/spec/fixtures/vcr/exchange_rate_adapters/btc_adapters/bitstamp_adapter.yml +153 -0
  27. data/spec/fixtures/vcr/exchange_rate_adapters/btc_adapters/btcchina_adapter.yml +83 -0
  28. data/spec/fixtures/vcr/exchange_rate_adapters/btc_adapters/btce_adapter.yml +223 -0
  29. data/spec/fixtures/vcr/exchange_rate_adapters/btc_adapters/coinbase_adapter.yml +76 -0
  30. data/spec/fixtures/vcr/exchange_rate_adapters/btc_adapters/huobi_adapter.yml +83 -0
  31. data/spec/fixtures/vcr/exchange_rate_adapters/btc_adapters/kraken_adapter.yml +83 -0
  32. data/spec/fixtures/vcr/exchange_rate_adapters/btc_adapters/localbitcoins_adapter.yml +128 -0
  33. data/spec/fixtures/vcr/exchange_rate_adapters/btc_adapters/okcoin_adapter.yml +207 -0
  34. data/spec/fixtures/vcr/exchange_rate_adapters/fiat_adapters/fixer_adapter.yml +81 -0
  35. data/spec/fixtures/vcr/exchange_rate_adapters/fiat_adapters/yahoo_adapter.yml +50 -0
  36. data/spec/lib/btc_adapter_spec.rb +16 -28
  37. data/spec/lib/btc_adapters/average_rate_adapter_spec.rb +4 -4
  38. data/spec/lib/btc_adapters/bitfinex_adapter_spec.rb +38 -0
  39. data/spec/lib/btc_adapters/bitpay_adapter_spec.rb +8 -3
  40. data/spec/lib/btc_adapters/bitstamp_adapter_spec.rb +8 -3
  41. data/spec/lib/btc_adapters/btcchina_adapter_spec.rb +36 -0
  42. data/spec/lib/btc_adapters/btce_adapter_spec.rb +10 -3
  43. data/spec/lib/btc_adapters/coinbase_adapter_spec.rb +5 -3
  44. data/spec/lib/btc_adapters/huobi_adapter_spec.rb +38 -0
  45. data/spec/lib/btc_adapters/kraken_adapter_spec.rb +6 -3
  46. data/spec/lib/btc_adapters/localbitcoins_adapter_spec.rb +4 -3
  47. data/spec/lib/btc_adapters/okcoin_adapter_spec.rb +11 -3
  48. data/spec/lib/fiat_adapters/fixer_adapter_spec.rb +5 -2
  49. data/spec/lib/fiat_adapters/yahoo_adapter_spec.rb +5 -2
  50. 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('RUB')).to be_kind_of(Numeric)
19
- expect( -> { @exchange_adapter.rate_for('KZT') }).to raise_error(CurrencyRate::Adapter::CurrencyNotSupported)
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.1.1
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-18 00:00:00.000000000 Z
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