money_persistent_bank 0.2.0.alpha2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Changelog.md +7 -0
- data/Readme.md +4 -3
- data/lib/money_persistent_bank/version.rb +1 -1
- metadata +6 -6
data/Changelog.md
CHANGED
@@ -1 +1,8 @@
|
|
1
|
+
0.2.0
|
2
|
+
|
3
|
+
* Rates are now updated on each request using middleware.
|
4
|
+
Use import_rates manually outside of web-requests.
|
5
|
+
* Save renamed to export_rates.
|
6
|
+
* Cache is separated from the main app to avoid fast expiration.
|
7
|
+
|
1
8
|
0.1.0. Update rates also when the rates are accessed directly: `bank.rates`
|
data/Readme.md
CHANGED
@@ -8,25 +8,26 @@ This can be useful in a Rails application. You fetch rates from external source
|
|
8
8
|
|
9
9
|
Add it to your gemfile:
|
10
10
|
|
11
|
-
gem "money_persistent_bank", "~> 0.
|
11
|
+
gem "money_persistent_bank", "~> 0.2.0"
|
12
12
|
|
13
13
|
Now you can use it in a rake task.
|
14
14
|
|
15
15
|
task :fetch_rates => :environment do
|
16
|
-
bank = Money
|
16
|
+
bank = Money.default_bank
|
17
17
|
|
18
18
|
# Here goes your code that fetches the rates from external source.
|
19
19
|
# Emulating this:
|
20
20
|
sleep 1
|
21
21
|
bank.set_rate(:usd, :eur, 0.8)
|
22
22
|
|
23
|
-
bank.
|
23
|
+
bank.export_rates # you have to explicitly export after setting the rates
|
24
24
|
end
|
25
25
|
|
26
26
|
(See also [money\_bank\_sources](https://github.com/semaperepelitsa/money_bank_sources).)
|
27
27
|
|
28
28
|
And somewhere in your application:
|
29
29
|
|
30
|
+
Money.default_bank.import_rates
|
30
31
|
1.to_money(:usd).exchange_to(:eur).to_f # => 0.8
|
31
32
|
|
32
33
|
When the rates are updated it will automatically use them.
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: money_persistent_bank
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.0
|
5
|
-
prerelease:
|
4
|
+
version: 0.2.0
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Semyon Perepelitsa
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-01-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: money
|
@@ -76,12 +76,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
76
76
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
77
|
none: false
|
78
78
|
requirements:
|
79
|
-
- - ! '
|
79
|
+
- - ! '>='
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version:
|
81
|
+
version: '0'
|
82
82
|
requirements: []
|
83
83
|
rubyforge_project: money_persistent_bank
|
84
|
-
rubygems_version: 1.8.
|
84
|
+
rubygems_version: 1.8.24
|
85
85
|
signing_key:
|
86
86
|
specification_version: 3
|
87
87
|
summary: Adds persistent bank to Money gem
|