exchange-rates 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +43 -0
- data/lib/exchange_rates/version.rb +1 -1
- data/lib/tasks/exchange_rates_tasks.rake +4 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4160ab1da0698999714632f1347e49dc0be267c4
|
4
|
+
data.tar.gz: d72de44c4301e21157ee4666bae1ccd9d458f044
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f158e8fa335e0a7e2357cf21910c5396b74a93b7f65cca2af62cfd38cc37ffbbb3a9ff4be427afd93f146122fc182dc0d7732a31f915e90f08c2c879c4f1abf0
|
7
|
+
data.tar.gz: 4dba6521a317a1d395738494e8cf590c2f6619308e1925e2c106c203354455362bb6e576b8969e6f793905d556de9a294f6bcbaf62c8d9f3f49a50ff28108959
|
data/README.md
CHANGED
@@ -36,4 +36,47 @@ rake exchange_rates:update
|
|
36
36
|
ExchangeRates::Rate.convert(1000, 'TWD', 'HKD')
|
37
37
|
```
|
38
38
|
|
39
|
+
#### Testing
|
40
|
+
|
41
|
+
if in your rspec or minitest, you might need add these lines
|
42
|
+
|
43
|
+
*spec/factories/exchange_rates.rb*
|
44
|
+
|
45
|
+
```
|
46
|
+
FactoryGirl.define do
|
47
|
+
factory :exchange_rate_usd, class: ExchangeRates::Rate do
|
48
|
+
from_currency 'USD'
|
49
|
+
rate_to_base_currency '7'
|
50
|
+
end
|
51
|
+
|
52
|
+
factory :exchange_rate_thb, class: ExchangeRates::Rate do
|
53
|
+
from_currency 'THB'
|
54
|
+
rate_to_base_currency '0.2'
|
55
|
+
end
|
56
|
+
|
57
|
+
factory :exchange_rate_hkd, class: ExchangeRates::Rate do
|
58
|
+
from_currency 'HKD'
|
59
|
+
rate_to_base_currency '1'
|
60
|
+
end
|
61
|
+
|
62
|
+
# ... depend on what you need
|
63
|
+
end
|
64
|
+
```
|
65
|
+
*spec/rails_helper.rb*
|
66
|
+
|
67
|
+
```
|
68
|
+
RSpec.configure do |config|
|
69
|
+
|
70
|
+
# ...
|
71
|
+
|
72
|
+
config.before(:each) do
|
73
|
+
create(:exchange_rate_hkd); create(:exchange_rate_thb); create(:exchange_rate_usd);
|
74
|
+
end
|
75
|
+
|
76
|
+
# ...
|
77
|
+
end
|
78
|
+
|
79
|
+
```
|
80
|
+
|
81
|
+
|
39
82
|
This project rocks and uses MIT-LICENSE.
|
@@ -22,6 +22,10 @@ namespace :exchange_rates do
|
|
22
22
|
if exchange_rate.new_record? || exchange_rate.changed?
|
23
23
|
exchange_rate.save
|
24
24
|
puts "--- #{currency} has been updated---"
|
25
|
+
puts '*****************************************'
|
26
|
+
|
27
|
+
puts "--- Clean Cache: #{currency.downcase}_to_#{ExchangeRates::Rate::BASE_CURRENCY.downcase}---"
|
28
|
+
Rails.cache.delete("#{currency.downcase}_to_#{ExchangeRates::Rate::BASE_CURRENCY.downcase}")
|
25
29
|
else
|
26
30
|
puts "--- nothing to update for #{currency} ---"
|
27
31
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: exchange-rates
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- aloha
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-09-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -142,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
142
142
|
version: '0'
|
143
143
|
requirements: []
|
144
144
|
rubyforge_project:
|
145
|
-
rubygems_version: 2.
|
145
|
+
rubygems_version: 2.6.11
|
146
146
|
signing_key:
|
147
147
|
specification_version: 4
|
148
148
|
summary: Rails ExchangeRates Helper
|