i18n-complements 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/VERSION +1 -1
  2. data/lib/i18n-complements/numisma.rb +12 -4
  3. metadata +2 -2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.7
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
- uri = URI("http://www.webservicex.net/CurrencyConvertor.asmx/ConversionRate")
41
- response = Net::HTTP.post_form(uri, 'FromCurrency' => from, 'ToCurrency' => to)
42
- doc = ::LibXML::XML::Parser.string(response.body).parse
43
- return doc.root.content.to_f
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
- MC4wLjc=
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: 2012-12-30 00:00:00.000000000 Z
13
+ date: 2013-03-28 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: i18n