money-converter 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -22,7 +22,15 @@ class MoneyConverter
22
22
  http = Net::HTTP.new("www.google.com",80)
23
23
  resp = http.get("/ig/calculator?hl=en&q=#{amount}#{from_currency}=?#{to_currency}")
24
24
  data = resp.body
25
- result = JSON(data.gsub(/([\w]+):/, '"\1":'))
25
+ format_amount_exchanged(data, to_currency)
26
+ #result = JSON(r.gsub(/([\w]+):/, '"\1":'))
27
+ end
28
+
29
+ def format_amount_exchanged(data, to_currency)
30
+ array = data.split('"')
31
+ amount_exchanged = array[3].split
32
+ result = amount_exchanged[0].gsub(/[\xA0]/n, '')
33
+ "#{result} #{to_currency}".to_sym
26
34
  end
27
35
 
28
36
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "money-converter"
8
- s.version = "0.1.0"
8
+ s.version = "0.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["LEONEL MORAIS"]
12
- s.date = "2012-11-29"
12
+ s.date = "2012-11-30"
13
13
  s.description = "Currency converter"
14
14
  s.email = "leonel.morais@yahoo.com.br"
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: money-converter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-29 00:00:00.000000000 Z
12
+ date: 2012-11-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -126,7 +126,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
126
126
  version: '0'
127
127
  segments:
128
128
  - 0
129
- hash: 241185171
129
+ hash: 9943087
130
130
  required_rubygems_version: !ruby/object:Gem::Requirement
131
131
  none: false
132
132
  requirements: