i18n-complements 0.0.7 → 0.0.8
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/VERSION +1 -1
- data/lib/i18n-complements/numisma.rb +12 -4
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.8
|
@@ -37,10 +37,18 @@ module I18nComplements
|
|
37
37
|
def currency_rate(from, to)
|
38
38
|
raise ArgumentError.new(":from currency is unknown (#{from.class}:#{from.inspect})") if Numisma[from].nil?
|
39
39
|
raise ArgumentError.new(":to currency is unknown (#{to.class}:#{to.inspect})") if Numisma[to].nil?
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
40
|
+
rate = nil
|
41
|
+
begin
|
42
|
+
uri = URI("http://www.webservicex.net/CurrencyConvertor.asmx/ConversionRate")
|
43
|
+
response = Net::HTTP.post_form(uri, 'FromCurrency' => from, 'ToCurrency' => to)
|
44
|
+
doc = ::LibXML::XML::Parser.string(response.body).parse
|
45
|
+
rate = doc.root.content.to_f
|
46
|
+
rescue
|
47
|
+
uri = URI("http://download.finance.yahoo.com/d/quotes.csv?s=#{from}#{to}=X&f=l1")
|
48
|
+
response = Net::HTTP.post_form(uri)
|
49
|
+
rate = response.body.to_f
|
50
|
+
end
|
51
|
+
return rate
|
44
52
|
end
|
45
53
|
|
46
54
|
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: i18n-complements
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
version: !binary |-
|
5
|
-
|
5
|
+
MC4wLjg=
|
6
6
|
prerelease:
|
7
7
|
platform: ruby
|
8
8
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2013-03-28 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: i18n
|