no_nonsense_currency_converter 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock
CHANGED
@@ -5,18 +5,18 @@ module NoNonsenseCurrencyConverter
|
|
5
5
|
BASE_URL = 'https://www.google.com/'
|
6
6
|
CONVERTER_URL = 'finance/converter'
|
7
7
|
|
8
|
-
def get_converted_currency_value(from, to, amount)
|
8
|
+
def self.get_converted_currency_value(from, to, amount)
|
9
9
|
data = get_raw_data(amount, from, to)
|
10
10
|
get_final_parsed_amount(data).to_f.round(2)
|
11
11
|
end
|
12
12
|
|
13
13
|
private
|
14
14
|
|
15
|
-
def get_raw_data(amount, from, to)
|
15
|
+
def self.get_raw_data(amount, from, to)
|
16
16
|
open("#{BASE_URL}#{CONVERTER_URL}?a=#{amount}&from=#{from.upcase}&to=#{to.upcase}")
|
17
17
|
end
|
18
18
|
|
19
|
-
def get_final_parsed_amount(data)
|
19
|
+
def self.get_final_parsed_amount(data)
|
20
20
|
data.read.scan(/<span class=bld>(\d+\.?\d*) [A-Z]{3}<\/span>/).flatten.first
|
21
21
|
end
|
22
22
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: no_nonsense_currency_converter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -72,12 +72,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
72
72
|
- - ! '>='
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: '0'
|
75
|
+
segments:
|
76
|
+
- 0
|
77
|
+
hash: -3320169338655037833
|
75
78
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
79
|
none: false
|
77
80
|
requirements:
|
78
81
|
- - ! '>='
|
79
82
|
- !ruby/object:Gem::Version
|
80
83
|
version: '0'
|
84
|
+
segments:
|
85
|
+
- 0
|
86
|
+
hash: -3320169338655037833
|
81
87
|
requirements: []
|
82
88
|
rubyforge_project:
|
83
89
|
rubygems_version: 1.8.23
|