money-open-exchange-rates 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown
CHANGED
@@ -8,6 +8,7 @@ A gem that calculates the exchange rate using published rates from [open-exchang
|
|
8
8
|
require 'money/bank/open_exchange_rates_bank'
|
9
9
|
moe = Money::Bank::OpenExchangeRatesBank.new
|
10
10
|
moe.cache = 'path/to/file/cache'
|
11
|
+
moe.update_rates
|
11
12
|
|
12
13
|
Money.default_bank = moe
|
13
14
|
```
|
@@ -23,7 +24,14 @@ Money.default_bank = moe
|
|
23
24
|
* https://github.com/RubyMoney/eu_central_bank
|
24
25
|
* https://github.com/RubyMoney/google_currency
|
25
26
|
|
27
|
+
## Contributors
|
28
|
+
|
29
|
+
* [Wayne See](https://github.com/weynsee)
|
30
|
+
* [Julien Boyer](https://github.com/chatgris)
|
31
|
+
* [Kevin Ball](https://github.com/kball)
|
32
|
+
* [Michael Morris](https://github.com/mtcmorris)
|
33
|
+
|
26
34
|
## License
|
27
35
|
The MIT License
|
28
36
|
|
29
|
-
Copyright ©
|
37
|
+
Copyright © 2012 Laurent Arnoud <laurent@spkdev.net>
|
@@ -57,6 +57,7 @@ class Money
|
|
57
57
|
unless rate
|
58
58
|
from_base_rate = get_rate("USD", from.currency)
|
59
59
|
to_base_rate = get_rate("USD", to_currency)
|
60
|
+
raise(Money::Bank::UnknownRateFormat, "No conversion rate known for '#{from.currency.iso_code}' -> '#{to_currency}'") if from_base_rate.nil? || to_base_rate.nil?
|
60
61
|
rate = to_base_rate.to_f / from_base_rate.to_f
|
61
62
|
end
|
62
63
|
Money.new(((Money::Currency.wrap(to_currency).subunit_to_unit.to_f / from.currency.subunit_to_unit.to_f) * from.cents * rate).round, to_currency)
|
@@ -19,6 +19,11 @@ describe Money::Bank::OpenExchangeRatesBank do
|
|
19
19
|
money = Money.new(0, "USD");
|
20
20
|
@bank.exchange_with(money, "USD").must_equal money
|
21
21
|
end
|
22
|
+
|
23
|
+
it "should raise if it can't find an exchange rate" do
|
24
|
+
money = Money.new(0, "USD");
|
25
|
+
assert_raises(Money::Bank::UnknownRateFormat){ @bank.exchange_with(money, "AUD") }
|
26
|
+
end
|
22
27
|
end
|
23
28
|
|
24
29
|
describe 'update_rates' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: money-open-exchange-rates
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-07-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: yajl-ruby
|
16
|
-
requirement: &
|
16
|
+
requirement: &20001460 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.8.3
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *20001460
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: money
|
27
|
-
requirement: &
|
27
|
+
requirement: &20000360 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 3.7.1
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *20000360
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: minitest
|
38
|
-
requirement: &
|
38
|
+
requirement: &19999680 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '2.0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *19999680
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rr
|
49
|
-
requirement: &
|
49
|
+
requirement: &19999220 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: 1.0.4
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *19999220
|
58
58
|
description: A gem that calculates the exchange rate using published rates from open-exchange-rates.
|
59
59
|
Compatible with the money gem.
|
60
60
|
email: laurent@spkdev.net
|
@@ -96,3 +96,4 @@ specification_version: 3
|
|
96
96
|
summary: A gem that calculates the exchange rate using published rates from open-exchange-rates.
|
97
97
|
test_files:
|
98
98
|
- test/open_exchange_rates_bank_test.rb
|
99
|
+
has_rdoc:
|