rails_currency 1.0 → 1.1
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/{lib/rcurrency/updater.rb → AUTHOR} +0 -0
- data/Manifest.txt +4 -4
- data/README.txt +28 -3
- data/Rakefile +1 -1
- data/lib/{rcurrency → rails_currency}/constants.rb +1 -1
- data/lib/{rcurrency → rails_currency}/convertor.rb +5 -5
- data/lib/rails_currency.rb +6 -0
- data/test/ts_convertor.rb +6 -6
- metadata +6 -6
- data/lib/rcurrency.rb +0 -7
File without changes
|
data/Manifest.txt
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
+
AUTHOR
|
1
2
|
History.txt
|
2
3
|
Manifest.txt
|
3
4
|
README.txt
|
4
5
|
Rakefile
|
5
|
-
lib/
|
6
|
-
lib/
|
7
|
-
lib/
|
8
|
-
lib/rcurrency/updater.rb
|
6
|
+
lib/rails_currency.rb
|
7
|
+
lib/rails_currency/constants.rb
|
8
|
+
lib/rails_currency/convertor.rb
|
9
9
|
test/ts_convertor.rb
|
data/README.txt
CHANGED
@@ -3,13 +3,13 @@ A ruby lib to real time convert among different currencies.
|
|
3
3
|
|
4
4
|
== Install
|
5
5
|
|
6
|
-
gem install -l
|
6
|
+
gem install -l rails_currency-1.0.gem
|
7
7
|
|
8
8
|
== Usage
|
9
9
|
|
10
10
|
{{{
|
11
|
-
require "
|
12
|
-
result =
|
11
|
+
require "rails_currency"
|
12
|
+
result = RailsCurrency::Convertor.convert(100, "CNY", "USD")
|
13
13
|
}}}
|
14
14
|
|
15
15
|
== Available Currency List
|
@@ -97,3 +97,28 @@ USD 'United States Dollars'
|
|
97
97
|
VEF 'Venezuela Bolivares Fuertes'
|
98
98
|
VND 'Vietnam Dong'
|
99
99
|
}}}
|
100
|
+
|
101
|
+
== LICENSE
|
102
|
+
|
103
|
+
(The MIT License)
|
104
|
+
|
105
|
+
Copyright (c) 2008 Naveen Joshi
|
106
|
+
|
107
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
108
|
+
a copy of this software and associated documentation files (the
|
109
|
+
'Software'), to deal in the Software without restriction, including
|
110
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
111
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
112
|
+
permit persons to whom the Software is furnished to do so, subject to
|
113
|
+
the following conditions:
|
114
|
+
|
115
|
+
The above copyright notice and this permission notice shall be
|
116
|
+
included in all copies or substantial portions of the Software.
|
117
|
+
|
118
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
119
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
120
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
121
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
122
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
123
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
124
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
CHANGED
@@ -9,17 +9,17 @@ rescue LoadError
|
|
9
9
|
require 'hpricot'
|
10
10
|
end
|
11
11
|
|
12
|
-
module
|
13
|
-
class
|
12
|
+
module RailsCurrency
|
13
|
+
class RailsCurrencyError < StandardError
|
14
14
|
end
|
15
15
|
|
16
|
-
class InvalidAmountError <
|
16
|
+
class InvalidAmountError < RailsCurrencyError
|
17
17
|
end
|
18
18
|
|
19
|
-
class UnknownCurrencyError <
|
19
|
+
class UnknownCurrencyError < RailsCurrencyError
|
20
20
|
end
|
21
21
|
|
22
|
-
class ServerTimeoutError <
|
22
|
+
class ServerTimeoutError < RailsCurrencyError
|
23
23
|
end
|
24
24
|
|
25
25
|
class Convertor
|
data/test/ts_convertor.rb
CHANGED
@@ -1,20 +1,20 @@
|
|
1
1
|
$:.unshift File.expand_path(File.dirname(__FILE__) + "/../lib")
|
2
2
|
|
3
3
|
require 'test/unit'
|
4
|
-
require '
|
4
|
+
require 'rails_currency'
|
5
5
|
|
6
6
|
class RCurrencyTest < Test::Unit::TestCase
|
7
7
|
def test_convert
|
8
|
-
assert_kind_of Numeric,
|
8
|
+
assert_kind_of Numeric, RailsCurrency::Convertor.convert(100, "CNY", "USD")
|
9
9
|
end
|
10
10
|
|
11
11
|
def test_invalid_convert
|
12
|
-
assert_raise
|
13
|
-
|
12
|
+
assert_raise RailsCurrency::InvalidAmountError do
|
13
|
+
RailsCurrency::Convertor.convert("100", "CNY", "USD")
|
14
14
|
end
|
15
15
|
|
16
|
-
assert_raise
|
17
|
-
|
16
|
+
assert_raise RailsCurrency::UnknownCurrencyError do
|
17
|
+
RailsCurrency::Convertor.convert(100, "CNY", "ABC")
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_currency
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: "1.
|
4
|
+
version: "1.1"
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Naveen Joshi
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-02-
|
12
|
+
date: 2008-02-13 00:00:00 +08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -32,14 +32,14 @@ extra_rdoc_files:
|
|
32
32
|
- Manifest.txt
|
33
33
|
- README.txt
|
34
34
|
files:
|
35
|
+
- AUTHOR
|
35
36
|
- History.txt
|
36
37
|
- Manifest.txt
|
37
38
|
- README.txt
|
38
39
|
- Rakefile
|
39
|
-
- lib/
|
40
|
-
- lib/
|
41
|
-
- lib/
|
42
|
-
- lib/rcurrency/updater.rb
|
40
|
+
- lib/rails_currency.rb
|
41
|
+
- lib/rails_currency/constants.rb
|
42
|
+
- lib/rails_currency/convertor.rb
|
43
43
|
- test/ts_convertor.rb
|
44
44
|
has_rdoc: true
|
45
45
|
homepage:
|
data/lib/rcurrency.rb
DELETED