russian_central_bank 1.1.1 → 1.1.2
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.
- checksums.yaml +4 -4
- data/{LICENSE.txt → LICENSE} +0 -2
- data/README.md +43 -23
- data/russian_central_bank.gemspec +2 -2
- metadata +11 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b5c2680a392809928019759654304d2c984865c
|
4
|
+
data.tar.gz: c9eb547373cf88ed773865694ada37e1b172743e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15b92dd069956e5dde6096f5e4a667b1274a7fd032fb77a7f9606ec640ee72c300dfaed616090fb82472c1b78f8056b2a8830802139e3f549959af2fc76f0adf
|
7
|
+
data.tar.gz: a9f36d827f18c75362bd164e0129e738cf0582e7d20f7984e80b92c8faeb7bb6c4774886a5c147b708ff5b1521d40acab11fa5b02db1a8ad00903a06863ea7a9
|
data/{LICENSE.txt → LICENSE}
RENAMED
data/README.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
# RussianCentralBank
|
5
5
|
|
6
|
-
This gem extends [Money](https://github.com/RubyMoney/money)::Bank::VariableExchange with [Money](https://github.com/RubyMoney/money)::Bank::RussianCentralBank
|
6
|
+
This gem provides access to the Central Bank of Russia currency exchange. It can be used as a standalone exchange rates parser and also extends [Money](https://github.com/RubyMoney/money)::Bank::VariableExchange with [Money](https://github.com/RubyMoney/money)::Bank::RussianCentralBank
|
7
7
|
|
8
8
|
## Installation
|
9
9
|
|
@@ -28,43 +28,63 @@ NOTE: use 0.x version of `russian_central_bank` for `money` versions < 6.0
|
|
28
28
|
|
29
29
|
## Usage
|
30
30
|
|
31
|
-
###
|
31
|
+
### Standalone currency rates provider
|
32
32
|
|
33
|
-
|
33
|
+
```ruby
|
34
|
+
require 'russian_central_bank'
|
35
|
+
|
36
|
+
# Today rates
|
37
|
+
Money::Bank::RussianCentralBankFetcher.new.perform()
|
38
|
+
# => [{:code=>"USD", :nominal=>1, :value=>65.1639}, ...]
|
39
|
+
|
40
|
+
# For any other date
|
41
|
+
Money::Bank::RussianCentralBankFetcher.new.perform(Date.new(2010, 12, 31))
|
42
|
+
# => [{:code=>"USD", :nominal=>1, :value=>30.4769}, ...]
|
43
|
+
```
|
34
44
|
|
35
|
-
|
36
|
-
bank = Money::Bank::RussianCentralBank.new
|
45
|
+
### Regular usage (with money gem)
|
37
46
|
|
38
|
-
|
47
|
+
```ruby
|
48
|
+
require 'russian_central_bank'
|
49
|
+
|
50
|
+
Money.locale_backend = :currency
|
51
|
+
bank = Money::Bank::RussianCentralBank.new
|
39
52
|
|
40
|
-
|
41
|
-
bank.update_rates
|
53
|
+
Money.default_bank = bank
|
42
54
|
|
43
|
-
|
44
|
-
|
55
|
+
# Load today's rates
|
56
|
+
bank.update_rates
|
45
57
|
|
46
|
-
|
47
|
-
|
58
|
+
# Exchange 1000 USD to RUB
|
59
|
+
Money.new(1000_00, "USD").exchange_to('RUB').format # => 64.592,50 ₽
|
60
|
+
|
61
|
+
# Use indirect exchange rates, USD -> RUB -> EUR
|
62
|
+
Money.new(1000_00, "USD").exchange_to('EUR').format # => €888,26
|
63
|
+
```
|
48
64
|
|
49
65
|
### Specific date rates
|
50
66
|
|
51
|
-
|
52
|
-
|
53
|
-
|
67
|
+
```ruby
|
68
|
+
# Specify rates date
|
69
|
+
bank.update_rates(Date.new(2010, 12, 31))
|
70
|
+
Money.new(1000_00, "USD").exchange_to('RUB').format # => 30.476,90 ₽
|
54
71
|
|
55
|
-
|
56
|
-
|
72
|
+
# Check last rates update
|
73
|
+
bank.rates_updated_at
|
57
74
|
|
58
|
-
|
59
|
-
|
75
|
+
# Check on which date rates were updated
|
76
|
+
bank.rates_updated_on
|
77
|
+
```
|
60
78
|
|
61
79
|
### Autoupdate
|
62
80
|
|
63
|
-
|
64
|
-
|
81
|
+
```ruby
|
82
|
+
# Use ttl attribute to enable rates autoupdate
|
83
|
+
bank.ttl = 1.day
|
65
84
|
|
66
|
-
|
67
|
-
|
85
|
+
# Check expiration date
|
86
|
+
bank.rates_expired_at
|
87
|
+
```
|
68
88
|
|
69
89
|
### Safe rates fetch
|
70
90
|
|
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'russian_central_bank'
|
7
|
-
spec.version = '1.1.
|
7
|
+
spec.version = '1.1.2'
|
8
8
|
spec.authors = ['Ramil Mustafin']
|
9
9
|
spec.email = ['rommel.rmm@gmail.com']
|
10
10
|
spec.description = 'RussianCentralBank extends Money::Bank::VariableExchange and gives you access to the Central Bank of Russia currency exchange rates.'
|
@@ -25,5 +25,5 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.add_development_dependency 'webmock', '~>3'
|
26
26
|
|
27
27
|
spec.add_dependency 'httparty', '>= 0.10.0'
|
28
|
-
spec.add_dependency 'money', '
|
28
|
+
spec.add_dependency 'money', '>= 6', '<= 6.13.4'
|
29
29
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: russian_central_bank
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ramil Mustafin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -112,16 +112,22 @@ dependencies:
|
|
112
112
|
name: money
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - "
|
115
|
+
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '6'
|
118
|
+
- - "<="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: 6.13.4
|
118
121
|
type: :runtime
|
119
122
|
prerelease: false
|
120
123
|
version_requirements: !ruby/object:Gem::Requirement
|
121
124
|
requirements:
|
122
|
-
- - "
|
125
|
+
- - ">="
|
123
126
|
- !ruby/object:Gem::Version
|
124
127
|
version: '6'
|
128
|
+
- - "<="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: 6.13.4
|
125
131
|
description: RussianCentralBank extends Money::Bank::VariableExchange and gives you
|
126
132
|
access to the Central Bank of Russia currency exchange rates.
|
127
133
|
email:
|
@@ -134,7 +140,7 @@ files:
|
|
134
140
|
- ".gitignore"
|
135
141
|
- ".rubocop.yml"
|
136
142
|
- Gemfile
|
137
|
-
- LICENSE
|
143
|
+
- LICENSE
|
138
144
|
- README.md
|
139
145
|
- Rakefile
|
140
146
|
- lib/money/bank/russian_central_bank.rb
|