i18n-complements 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -1,4 +1,10 @@
1
1
  = I18nComplements
2
+ {<img src="https://badge.fury.io/rb/i18n-complements.png" alt="Gem Version" />}[http://badge.fury.io/rb/i18n-complements]
3
+ {<img src="https://api.travis-ci.org/burisu/i18n-complements.png?branch=master"/>}[https://travis-ci.org/burisu/i18n-complements]
4
+ {<img src="https://gemnasium.com/burisu/i18n-complements.png"/>}[https://gemnasium.com/burisu/i18n-complements]
5
+ {<img src="https://codeclimate.com/github/burisu/i18n-complements.png" />}[https://codeclimate.com/github/burisu/i18n-complements]
6
+ {<img src="https://coveralls.io/repos/burisu/i18n-complements/badge.png?branch=master" alt="Coverage Status" />}[https://coveralls.io/r/burisu/i18n-complements]
7
+
2
8
 
3
9
  I18n complements provides:
4
10
  * Numbers localization
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.8
1
+ 0.0.9
@@ -2,6 +2,7 @@
2
2
  # It represents the international monetary system with all its currencies like specified in ISO 4217
3
3
  # Numisma comes from latin: It designs here the "science of money"
4
4
  require 'net/http'
5
+ require 'yaml'
5
6
  require 'i18n-complements/numisma/currency'
6
7
 
7
8
  module I18nComplements
@@ -45,8 +46,8 @@ module I18nComplements
45
46
  rate = doc.root.content.to_f
46
47
  rescue
47
48
  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
49
+ response = Net::HTTP.get(uri)
50
+ rate = response.strip.to_f
50
51
  end
51
52
  return rate
52
53
  end
data/test/helper.rb CHANGED
@@ -1,3 +1,6 @@
1
+ require 'coveralls'
2
+ Coveralls.wear!
3
+
1
4
  require 'bundler/setup'
2
5
  require 'test/unit'
3
6
 
@@ -0,0 +1,31 @@
1
+ # encoding: utf-8
2
+ require 'helper'
3
+
4
+ class TestCurrencies < Test::Unit::TestCase
5
+
6
+ def test_conversion_rate
7
+
8
+ assert_raise ArgumentError do
9
+ I18nComplements::Numisma.currency_rate(:EUR, "JPY")
10
+ end
11
+
12
+ assert_raise ArgumentError do
13
+ I18nComplements::Numisma.currency_rate("EUR", :JPY)
14
+ end
15
+
16
+ assert_raise ArgumentError do
17
+ I18nComplements::Numisma.currency_rate(:EUR, :JPY)
18
+ end
19
+
20
+ r1 = I18nComplements::Numisma.currency_rate("EUR", "JPY")
21
+ r2 = I18nComplements::Numisma.currency_rate("JPY", "EUR")
22
+ assert_equal 1, (r1 * r2).round(2)
23
+
24
+ assert_nothing_raised do
25
+ I18nComplements::Numisma.currency_rate("EUR", "JPY")
26
+ end
27
+
28
+ end
29
+
30
+
31
+ end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: i18n-complements
3
3
  version: !ruby/object:Gem::Version
4
4
  version: !binary |-
5
- MC4wLjg=
5
+ MC4wLjk=
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: 2013-03-28 00:00:00.000000000 Z
13
+ date: 2013-03-29 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: i18n
@@ -28,6 +28,38 @@ dependencies:
28
28
  - - ! '>='
29
29
  - !ruby/object:Gem::Version
30
30
  version: '0.6'
31
+ - !ruby/object:Gem::Dependency
32
+ name: coveralls
33
+ requirement: !ruby/object:Gem::Requirement
34
+ none: false
35
+ requirements:
36
+ - - ~>
37
+ - !ruby/object:Gem::Version
38
+ version: 0.6.3
39
+ type: :development
40
+ prerelease: false
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ~>
45
+ - !ruby/object:Gem::Version
46
+ version: 0.6.3
47
+ - !ruby/object:Gem::Dependency
48
+ name: rake
49
+ requirement: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>'
53
+ - !ruby/object:Gem::Version
54
+ version: '10'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ! '>'
61
+ - !ruby/object:Gem::Version
62
+ version: '10'
31
63
  description:
32
64
  email: burisu@oneiros.fr
33
65
  executables: []
@@ -51,6 +83,7 @@ files:
51
83
  - test/locales/jpn.yml
52
84
  - test/test_booleans.rb
53
85
  - test/test_currencies.rb
86
+ - test/test_currency_rates.rb
54
87
  - test/test_extensions.rb
55
88
  - test/test_numbers.rb
56
89
  - test/test_strings.rb
@@ -82,6 +115,7 @@ summary: I18n missing functionnalities
82
115
  test_files:
83
116
  - test/test_booleans.rb
84
117
  - test/test_currencies.rb
118
+ - test/test_currency_rates.rb
85
119
  - test/test_extensions.rb
86
120
  - test/test_numbers.rb
87
121
  - test/test_strings.rb