money-distributed-rcb 0.0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9f573c2ac853ec3360003106e86bf24263199a2e
4
+ data.tar.gz: bd7d9a5ecf163ed88d290995c0fd2d2fedca48b5
5
+ SHA512:
6
+ metadata.gz: 6c903bb9aa82d71d236cec53505c28433fb57941946af14d2848322bd8e1d2571af890a68c817e22e1ccec6c1662ca2ffaa3a579b0b7a4e3823800a59ce1faee
7
+ data.tar.gz: 4a132c55be48edc9993cf08786bbb5bb32b13ce6c51f60ed68e4b7838621bc364e3c2fe035a8246951c9bf47316b6c7dadd2bc886d13ffdf7f4bb1adfa5b4faf
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
@@ -0,0 +1,2 @@
1
+ Style/FileName:
2
+ Enabled: false
@@ -0,0 +1,11 @@
1
+ language: ruby
2
+ sudo: false
3
+ rvm:
4
+ - 2.0.0
5
+ - 2.1.10
6
+ - 2.2.5
7
+ - 2.3.1
8
+ before_install: gem install bundler -v 1.10.6
9
+ script:
10
+ - bundle exec rubocop
11
+ - bundle exec rspec spec
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in money-distributed-rcb.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2016 Sergey Alexandrovich
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ require 'money/distributed/fetcher/russian_central_bank'
@@ -0,0 +1,44 @@
1
+ require 'money-distributed'
2
+ require 'savon'
3
+
4
+ class Money
5
+ module Distributed
6
+ module Fetcher
7
+ # Russian Central Bank rates fetcher
8
+ class RussianCentralBank
9
+ include Base
10
+
11
+ CBR_SERVICE_URL =
12
+ 'http://www.cbr.ru/DailyInfoWebServ/DailyInfo.asmx?WSDL'.freeze
13
+
14
+ private
15
+
16
+ def exchange_rates
17
+ fetch_exchange_rates.each_with_object('RUB' => 1) do |rate, h|
18
+ next unless local_currencies.include? rate[:vch_code]
19
+ h[rate[:vch_code]] =
20
+ BigDecimal.new(rate[:vnom]) / BigDecimal.new(rate[:vcurs])
21
+ end
22
+ end
23
+
24
+ def fetch_exchange_rates
25
+ client = Savon::Client.new(
26
+ wsdl: CBR_SERVICE_URL, log: false, log_level: :error,
27
+ follow_redirects: true
28
+ )
29
+ response = client.call(
30
+ :get_curs_on_date,
31
+ message: { 'On_date' => Time.now.strftime('%Y-%m-%dT%H:%M:%S') }
32
+ )
33
+ response.body[:get_curs_on_date_response][:get_curs_on_date_result] \
34
+ [:diffgram][:valute_data][:valute_curs_on_date]
35
+ end
36
+
37
+ def local_currencies
38
+ @local_currencies ||=
39
+ Money::Currency.table.map { |currency| currency.last[:iso_code] }
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,9 @@
1
+ class Money
2
+ module Distributed
3
+ module Fetcher
4
+ class RussianCentralBank
5
+ VERSION = '0.0.2.2'.freeze
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,36 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'money/distributed/fetcher/russian_central_bank/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'money-distributed-rcb'
8
+ spec.version = Money::Distributed::Fetcher::RussianCentralBank::VERSION
9
+ spec.authors = ['DarthSim']
10
+ spec.email = ['darthsim@gmail.com']
11
+
12
+ spec.summary = 'Russian Central Bank fetcher for money-distributed gem'
13
+ spec.homepage = 'https://github.com/DarthSim/money-distributed-rcb'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
17
+ f.match(%r{^(test|spec|features)/})
18
+ end
19
+
20
+ spec.bindir = 'exe'
21
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ['lib']
23
+
24
+ spec.add_development_dependency 'bundler', '~> 1.10'
25
+ spec.add_development_dependency 'rake', '~> 10.0'
26
+ spec.add_development_dependency 'rspec', '>= 3.0.0'
27
+ spec.add_development_dependency 'webmock'
28
+ spec.add_development_dependency 'timecop'
29
+ spec.add_development_dependency 'pry'
30
+ spec.add_development_dependency 'rubocop', '~> 0.44.1'
31
+ # travis installs rack uncompatible with ruby < 2.2.2
32
+ spec.add_development_dependency 'rack', '1.6.4'
33
+
34
+ spec.add_dependency 'money-distributed', '>= 0.0.2.2'
35
+ spec.add_dependency 'savon'
36
+ end
metadata ADDED
@@ -0,0 +1,194 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: money-distributed-rcb
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2.2
5
+ platform: ruby
6
+ authors:
7
+ - DarthSim
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-10-14 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: 3.0.0
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 3.0.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: webmock
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: timecop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 0.44.1
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 0.44.1
111
+ - !ruby/object:Gem::Dependency
112
+ name: rack
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '='
116
+ - !ruby/object:Gem::Version
117
+ version: 1.6.4
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '='
123
+ - !ruby/object:Gem::Version
124
+ version: 1.6.4
125
+ - !ruby/object:Gem::Dependency
126
+ name: money-distributed
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: 0.0.2.2
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: 0.0.2.2
139
+ - !ruby/object:Gem::Dependency
140
+ name: savon
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :runtime
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ description:
154
+ email:
155
+ - darthsim@gmail.com
156
+ executables: []
157
+ extensions: []
158
+ extra_rdoc_files: []
159
+ files:
160
+ - ".gitignore"
161
+ - ".rspec"
162
+ - ".rubocop.yml"
163
+ - ".travis.yml"
164
+ - Gemfile
165
+ - LICENSE
166
+ - lib/money-distributed-rcb.rb
167
+ - lib/money/distributed/fetcher/russian_central_bank.rb
168
+ - lib/money/distributed/fetcher/russian_central_bank/version.rb
169
+ - money-distributed-rcb.gemspec
170
+ homepage: https://github.com/DarthSim/money-distributed-rcb
171
+ licenses:
172
+ - MIT
173
+ metadata: {}
174
+ post_install_message:
175
+ rdoc_options: []
176
+ require_paths:
177
+ - lib
178
+ required_ruby_version: !ruby/object:Gem::Requirement
179
+ requirements:
180
+ - - ">="
181
+ - !ruby/object:Gem::Version
182
+ version: '0'
183
+ required_rubygems_version: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ version: '0'
188
+ requirements: []
189
+ rubyforge_project:
190
+ rubygems_version: 2.5.1
191
+ signing_key:
192
+ specification_version: 4
193
+ summary: Russian Central Bank fetcher for money-distributed gem
194
+ test_files: []