money-open-exchange-rates 0.1.1 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +1 -1
- data/README.markdown +3 -1
- data/lib/money/bank/open_exchange_rates_bank.rb +4 -4
- data/test/open_exchange_rates_bank_test.rb +1 -1
- metadata +56 -33
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8e229d0e2b11a63d0b4393c6e05514ac21fc7c9b
|
4
|
+
data.tar.gz: cd7819397cd60f5de0b8d00cb10d83a9081541e7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: bdc02f9b9ed0f60ab8fa3499428e6bab435f4b1b119dfc43fbb366f52191d7fdb87b1a330e69c1575c930ed10b560b33a1626ffa786c848c98f1d6637998996a
|
7
|
+
data.tar.gz: 899a474ed72d4638ac0f2dc7b372d963b51cce20b8083b77f15a2807cbb26bdd726ba570dc5f2e5e50ef90e1796a511b6efad7be8e3b310de687821753c9f3c5
|
data/Gemfile
CHANGED
data/README.markdown
CHANGED
@@ -35,7 +35,9 @@ As of the end of August 2012 all requests to the Open Exchange Rates API must
|
|
35
35
|
have a valid app_id. You can place your own key on a file named TEST_APP_ID and
|
36
36
|
then run:
|
37
37
|
|
38
|
-
|
38
|
+
```
|
39
|
+
bundle exec rake
|
40
|
+
```
|
39
41
|
|
40
42
|
## Refs
|
41
43
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
require 'open-uri'
|
3
|
-
require 'multi_json'
|
4
3
|
require 'money'
|
4
|
+
require 'json'
|
5
5
|
|
6
6
|
class Money
|
7
7
|
module Bank
|
@@ -87,14 +87,14 @@ class Money
|
|
87
87
|
end
|
88
88
|
|
89
89
|
def has_valid_rates?(text)
|
90
|
-
parsed =
|
90
|
+
parsed = JSON.parse(text)
|
91
91
|
parsed && parsed.has_key?('rates')
|
92
|
-
rescue
|
92
|
+
rescue JSON::ParserError
|
93
93
|
false
|
94
94
|
end
|
95
95
|
|
96
96
|
def exchange_rates
|
97
|
-
@doc =
|
97
|
+
@doc = JSON.parse(read_from_cache || read_from_url)
|
98
98
|
@oer_rates = @doc['rates']
|
99
99
|
@doc['rates']
|
100
100
|
end
|
@@ -199,7 +199,7 @@ describe Money::Bank::OpenExchangeRatesBank do
|
|
199
199
|
|
200
200
|
before do
|
201
201
|
@bank = Money::Bank::OpenExchangeRatesBank.new
|
202
|
-
@bank.app_id =
|
202
|
+
@bank.app_id = TEST_APP_ID
|
203
203
|
@temp_cache_path = File.expand_path(File.join(File.dirname(__FILE__), 'tmp.json'))
|
204
204
|
@bank.cache = @temp_cache_path
|
205
205
|
stub(OpenURI::OpenRead).open(Money::Bank::OpenExchangeRatesBank::OER_URL) { File.read @cache_path }
|
metadata
CHANGED
@@ -1,8 +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.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.5
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Laurent Arnoud
|
@@ -10,52 +9,78 @@ authors:
|
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date:
|
12
|
+
date: 2013-07-11 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
|
-
name:
|
17
|
-
requirement:
|
18
|
-
none: false
|
15
|
+
name: money
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
19
17
|
requirements:
|
20
|
-
- -
|
18
|
+
- - '>='
|
21
19
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
20
|
+
version: 3.7.1
|
23
21
|
type: :runtime
|
24
22
|
prerelease: false
|
25
|
-
version_requirements:
|
26
|
-
- !ruby/object:Gem::Dependency
|
27
|
-
name: money
|
28
|
-
requirement: &17136000 !ruby/object:Gem::Requirement
|
29
|
-
none: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
24
|
requirements:
|
31
|
-
- -
|
25
|
+
- - '>='
|
32
26
|
- !ruby/object:Gem::Version
|
33
27
|
version: 3.7.1
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: *17136000
|
37
28
|
- !ruby/object:Gem::Dependency
|
38
29
|
name: minitest
|
39
|
-
requirement:
|
40
|
-
none: false
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
41
31
|
requirements:
|
42
|
-
- -
|
32
|
+
- - '>='
|
43
33
|
- !ruby/object:Gem::Version
|
44
34
|
version: '2.0'
|
45
35
|
type: :development
|
46
36
|
prerelease: false
|
47
|
-
version_requirements:
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - '>='
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '2.0'
|
48
42
|
- !ruby/object:Gem::Dependency
|
49
43
|
name: rr
|
50
|
-
requirement:
|
51
|
-
none: false
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
52
45
|
requirements:
|
53
|
-
- -
|
46
|
+
- - '>='
|
54
47
|
- !ruby/object:Gem::Version
|
55
48
|
version: 1.0.4
|
56
49
|
type: :development
|
57
50
|
prerelease: false
|
58
|
-
version_requirements:
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 1.0.4
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: rake
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: json
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '1.7'
|
77
|
+
type: :runtime
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - '>='
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '1.7'
|
59
84
|
description: A gem that calculates the exchange rate using published rates from open-exchange-rates.
|
60
85
|
Compatible with the money gem.
|
61
86
|
email: laurent@spkdev.net
|
@@ -73,28 +98,26 @@ files:
|
|
73
98
|
- test/open_exchange_rates_bank_test.rb
|
74
99
|
homepage: http://github.com/spk/money-open-exchange-rates
|
75
100
|
licenses: []
|
101
|
+
metadata: {}
|
76
102
|
post_install_message:
|
77
103
|
rdoc_options: []
|
78
104
|
require_paths:
|
79
105
|
- lib
|
80
106
|
required_ruby_version: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
107
|
requirements:
|
83
|
-
- -
|
108
|
+
- - '>='
|
84
109
|
- !ruby/object:Gem::Version
|
85
|
-
version:
|
110
|
+
version: 1.9.2
|
86
111
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
-
none: false
|
88
112
|
requirements:
|
89
|
-
- -
|
113
|
+
- - '>='
|
90
114
|
- !ruby/object:Gem::Version
|
91
115
|
version: '0'
|
92
116
|
requirements: []
|
93
117
|
rubyforge_project:
|
94
|
-
rubygems_version:
|
118
|
+
rubygems_version: 2.0.2
|
95
119
|
signing_key:
|
96
|
-
specification_version:
|
120
|
+
specification_version: 4
|
97
121
|
summary: A gem that calculates the exchange rate using published rates from open-exchange-rates.
|
98
122
|
test_files:
|
99
123
|
- test/open_exchange_rates_bank_test.rb
|
100
|
-
has_rdoc:
|