nbrb-api 0.0.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 +7 -0
- data/.gitignore +19 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +49 -0
- data/Rakefile +1 -0
- data/lib/nbrb-api.rb +21 -0
- data/lib/nbrb-api/currencies.rb +27 -0
- data/lib/nbrb-api/exceptions.rb +6 -0
- data/lib/nbrb-api/version.rb +5 -0
- data/nbrb-api.gemspec +25 -0
- data/spec/fixtures/response/daily_rates_scaled.xml +46 -0
- data/spec/fixtures/response/daily_rates_simple.xml +46 -0
- data/spec/fixtures/wsdl.xml +929 -0
- data/spec/nbrb-api_spec.rb +30 -0
- data/spec/spec_helper.rb +27 -0
- metadata +121 -0
@@ -0,0 +1,30 @@
|
|
1
|
+
#encoding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe Nbrb::Api do
|
5
|
+
subject { Nbrb::Api }
|
6
|
+
|
7
|
+
describe "currencies rates" do
|
8
|
+
describe ".daily_rates" do
|
9
|
+
let(:simple_response) { fixture('response/daily_rates_simple.xml') }
|
10
|
+
let(:scaled_response) { fixture('response/daily_rates_scaled.xml') }
|
11
|
+
|
12
|
+
it 'returns properly structured hash for each currency rate' do
|
13
|
+
savon.expects(:ex_rates_daily).with(message: {on_date: DateTime.now}).returns(simple_response)
|
14
|
+
#intentionally failing
|
15
|
+
expect(subject.daily_rates).to eql(1)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe ".call" do
|
21
|
+
it 'throws OperationNotFound exception on invalid call' do
|
22
|
+
expect { subject.call(:asdasdads) }.to raise_exception Nbrb::Api::OperationNotFound
|
23
|
+
end
|
24
|
+
it 'delegates the call to soap client' do
|
25
|
+
sample_operation = subject.client.operations.first
|
26
|
+
subject.client.should_receive(:call).with(sample_operation, anything)
|
27
|
+
subject.call(sample_operation)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
#encoding: utf-8
|
2
|
+
require 'rspec'
|
3
|
+
require 'webmock/rspec'
|
4
|
+
require 'nbrb-api'
|
5
|
+
require "savon/mock/spec_helper"
|
6
|
+
|
7
|
+
|
8
|
+
def fixture(fixture_path)
|
9
|
+
File.read("spec/fixtures/#{fixture_path}")
|
10
|
+
end
|
11
|
+
|
12
|
+
RSpec.configure do |c|
|
13
|
+
c.include Savon::SpecHelper
|
14
|
+
c.before :all do
|
15
|
+
savon.mock!
|
16
|
+
end
|
17
|
+
c.after :all do
|
18
|
+
savon.unmock!
|
19
|
+
end
|
20
|
+
|
21
|
+
c.before :each do
|
22
|
+
WebMock.stub_request(:get, Nbrb::Api::WSDL).
|
23
|
+
to_return(status: 200, headers: {}, body: fixture('wsdl.xml'))
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
WebMock.disable_net_connect!(allow_localhost: true)
|
metadata
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: nbrb-api
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Pavel Shutin
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-09-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: savon
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 2.14.1
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 2.14.1
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: webmock
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry
|
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
|
+
description: 'This gem provides convenient way to interact with web API of National
|
70
|
+
Bank of the Republic Belarus. '
|
71
|
+
email:
|
72
|
+
- publicshady@gmail.com
|
73
|
+
executables: []
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- ".gitignore"
|
78
|
+
- Gemfile
|
79
|
+
- LICENSE.txt
|
80
|
+
- README.md
|
81
|
+
- Rakefile
|
82
|
+
- lib/nbrb-api.rb
|
83
|
+
- lib/nbrb-api/currencies.rb
|
84
|
+
- lib/nbrb-api/exceptions.rb
|
85
|
+
- lib/nbrb-api/version.rb
|
86
|
+
- nbrb-api.gemspec
|
87
|
+
- spec/fixtures/response/daily_rates_scaled.xml
|
88
|
+
- spec/fixtures/response/daily_rates_simple.xml
|
89
|
+
- spec/fixtures/wsdl.xml
|
90
|
+
- spec/nbrb-api_spec.rb
|
91
|
+
- spec/spec_helper.rb
|
92
|
+
homepage: ''
|
93
|
+
licenses: []
|
94
|
+
metadata: {}
|
95
|
+
post_install_message:
|
96
|
+
rdoc_options: []
|
97
|
+
require_paths:
|
98
|
+
- lib
|
99
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - ">="
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '0'
|
109
|
+
requirements: []
|
110
|
+
rubyforge_project:
|
111
|
+
rubygems_version: 2.4.8
|
112
|
+
signing_key:
|
113
|
+
specification_version: 4
|
114
|
+
summary: Ruby wrapper for National Bank of the Republic Belarus web service API
|
115
|
+
test_files:
|
116
|
+
- spec/fixtures/response/daily_rates_scaled.xml
|
117
|
+
- spec/fixtures/response/daily_rates_simple.xml
|
118
|
+
- spec/fixtures/wsdl.xml
|
119
|
+
- spec/nbrb-api_spec.rb
|
120
|
+
- spec/spec_helper.rb
|
121
|
+
has_rdoc:
|