google_currency 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ Google Currency 1.0.2
2
+ =====================
3
+
4
+ Features
5
+ --------
6
+ - Replace `eval` with `JSON.parse`
7
+ - Use BigDecimal instead of Float
8
+
9
+ Bugfixes
10
+ --------
11
+ - Quell parenthetical warnings in specs
12
+
1
13
  Google Currency 1.0.1
2
14
  =====================
3
15
 
@@ -1,5 +1,6 @@
1
1
  require 'money'
2
2
  require 'open-uri'
3
+ require 'json'
3
4
 
4
5
  class Money
5
6
  module Bank
@@ -78,14 +79,15 @@ class Money
78
79
  to = Currency.wrap(to)
79
80
 
80
81
  data = URI.parse("http://www.google.com/ig/calculator?hl=en&q=1#{from.iso_code}%3D%3F#{to.iso_code}").read
81
- data.gsub!(/lhs:/, ':lhs =>')
82
- data.gsub!(/rhs:/, ':rhs =>')
83
- data.gsub!(/error:/, ':error =>')
84
- data.gsub!(/icc:/, ':icc =>')
85
- data = eval(data)
82
+ data.gsub!(/lhs:/, '"lhs":')
83
+ data.gsub!(/rhs:/, '"rhs":')
84
+ data.gsub!(/error:/, '"error":')
85
+ data.gsub!(/icc:/, '"icc":')
86
+ data = JSON.parse(data)
86
87
 
87
- raise UnknownRate unless data[:error] == '' or data[:error] == '0'
88
- data[:rhs].split(' ')[0].to_f
88
+ error = data['error']
89
+ raise UnknownRate unless error == '' || error == '0'
90
+ BigDecimal(data['rhs'].split(' ')[0])
89
91
  end
90
92
  end
91
93
  end
metadata CHANGED
@@ -1,21 +1,22 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google_currency
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 1
10
- version: 1.0.1
9
+ - 2
10
+ version: 1.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Shane Emmons
14
+ - Donald Ball
14
15
  autorequire:
15
16
  bindir: bin
16
17
  cert_chain: []
17
18
 
18
- date: 2010-10-13 00:00:00 -04:00
19
+ date: 2010-10-20 00:00:00 -04:00
19
20
  default_executable:
20
21
  dependencies:
21
22
  - !ruby/object:Gem::Dependency
@@ -26,12 +27,12 @@ dependencies:
26
27
  requirements:
27
28
  - - ">="
28
29
  - !ruby/object:Gem::Version
29
- hash: 27
30
+ hash: 15
30
31
  segments:
31
- - 1
32
- - 3
32
+ - 2
33
+ - 0
33
34
  - 0
34
- version: 1.3.0
35
+ version: 2.0.0
35
36
  type: :development
36
37
  version_requirements: *id001
37
38
  - !ruby/object:Gem::Dependency
@@ -51,9 +52,25 @@ dependencies:
51
52
  type: :development
52
53
  version_requirements: *id002
53
54
  - !ruby/object:Gem::Dependency
54
- name: money
55
+ name: json
55
56
  prerelease: false
56
57
  requirement: &id003 !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ hash: 7
63
+ segments:
64
+ - 1
65
+ - 4
66
+ - 0
67
+ version: 1.4.0
68
+ type: :development
69
+ version_requirements: *id003
70
+ - !ruby/object:Gem::Dependency
71
+ name: money
72
+ prerelease: false
73
+ requirement: &id004 !ruby/object:Gem::Requirement
57
74
  none: false
58
75
  requirements:
59
76
  - - ~>
@@ -65,10 +82,11 @@ dependencies:
65
82
  - 5
66
83
  version: 3.1.5
67
84
  type: :runtime
68
- version_requirements: *id003
85
+ version_requirements: *id004
69
86
  description: GoogleCurrency extends Money::Bank::Base and gives you access to the current Google Currency exchange rates.
70
87
  email:
71
88
  - semmons99+RubyMoney@gmail.com
89
+ - donald.ball@gmail.com
72
90
  executables: []
73
91
 
74
92
  extensions: []
@@ -111,8 +129,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
111
129
  - 3
112
130
  - 7
113
131
  version: 1.3.7
114
- requirements: []
115
-
132
+ requirements:
133
+ - json
116
134
  rubyforge_project:
117
135
  rubygems_version: 1.3.7
118
136
  signing_key: