finapps 2.2.9 → 2.2.10
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/lib/finapps.rb +2 -0
- data/lib/finapps/rest/operators.rb +52 -0
- data/lib/finapps/rest/operators_password_resets.rb +30 -0
- data/lib/finapps/rest/sessions.rb +3 -2
- data/lib/finapps/version.rb +1 -1
- data/spec/rest/consumers_spec.rb +0 -1
- data/spec/rest/institutions_forms_spec.rb +0 -1
- data/spec/rest/institutions_spec.rb +0 -1
- data/spec/rest/operators_password_resets_spec.rb +70 -0
- data/spec/rest/operators_spec.rb +182 -0
- data/spec/rest/order_statuses_spec.rb +0 -3
- data/spec/rest/order_tokens_spec.rb +0 -3
- data/spec/rest/orders_spec.rb +0 -3
- data/spec/rest/sessions_spec.rb +10 -0
- data/spec/rest/user_institutions_forms_spec.rb +2 -7
- data/spec/rest/user_institutions_spec.rb +3 -8
- data/spec/rest/user_institutions_statuses_spec.rb +3 -6
- data/spec/spec_helper.rb +3 -0
- data/spec/support/fake_api.rb +30 -0
- data/spec/support/fixtures/operator.json +10 -0
- data/spec/support/fixtures/operator_forgot_password.json +5 -0
- data/spec/support/fixtures/operator_list.json +36 -0
- metadata +11 -4
- data/spec/spec_helpers/constants.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70220a731dd2c12887ace4b6d14c1456d56177a1
|
4
|
+
data.tar.gz: 9066dcd39edf4269383677d0b252b8f8b564ae36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa575512298a0cf92d92470394bbe3040948b7b239f728f10ad660f91686ed8227dc7035b7428c02ed4ce97b24baa5e8c26ed58b76bc663d3aa62999976042f8
|
7
|
+
data.tar.gz: 49cebe455ebe88dc8383a472f6baa60a3e9fa8181f0379f185a29d64fd5bb38cbf07d66aa52dd924b5750478ac2520164ce15b1818b3213982cfe92937f0d1dd
|
data/lib/finapps.rb
CHANGED
@@ -21,6 +21,8 @@ require 'finapps/rest/user_institutions_forms'
|
|
21
21
|
require 'finapps/rest/order_reports'
|
22
22
|
require 'finapps/rest/order_statuses'
|
23
23
|
require 'finapps/rest/password_resets'
|
24
|
+
require 'finapps/rest/operators'
|
25
|
+
require 'finapps/rest/operators_password_resets'
|
24
26
|
|
25
27
|
# require 'finapps/rest/configuration'
|
26
28
|
# require 'finapps/rest/credentials'
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module FinApps
|
3
|
+
module REST
|
4
|
+
class Operators < FinAppsCore::REST::Resources
|
5
|
+
def list(params=nil)
|
6
|
+
return super if params.nil?
|
7
|
+
|
8
|
+
path = "#{endpoint}/#{ERB::Util.url_encode(params)}"
|
9
|
+
super path
|
10
|
+
end
|
11
|
+
|
12
|
+
def show(id)
|
13
|
+
not_blank(id, :operator_id)
|
14
|
+
|
15
|
+
super id
|
16
|
+
end
|
17
|
+
|
18
|
+
def create(params, path=nil)
|
19
|
+
not_blank(params, :params)
|
20
|
+
super params, path
|
21
|
+
end
|
22
|
+
|
23
|
+
def update(id, params)
|
24
|
+
not_blank(id, :operator_id)
|
25
|
+
not_blank(params, :params)
|
26
|
+
|
27
|
+
path = "#{end_point}/#{ERB::Util.url_encode(id)}"
|
28
|
+
super params, path
|
29
|
+
end
|
30
|
+
|
31
|
+
def update_password(params)
|
32
|
+
# update password for current operator, need authorization session in header
|
33
|
+
not_blank(params, :params)
|
34
|
+
raise FinAppsCore::InvalidArgumentsError.new 'Invalid argument: params.' unless validates params
|
35
|
+
path = "#{end_point}/password/change"
|
36
|
+
|
37
|
+
create params, path
|
38
|
+
end
|
39
|
+
|
40
|
+
def destroy(id)
|
41
|
+
not_blank(id, :operator_id)
|
42
|
+
super id
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
def validates(params)
|
48
|
+
params.key?(:password) && params[:password] && params.key?(:password_confirm) && params[:password_confirm]
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module FinApps
|
3
|
+
module REST
|
4
|
+
class OperatorsPasswordResets < FinAppsCore::REST::Resources
|
5
|
+
def create(params, path=nil)
|
6
|
+
not_blank(params, :params)
|
7
|
+
validates_email(params) if path.nil?
|
8
|
+
|
9
|
+
path ||= 'operators/password/forgot'
|
10
|
+
|
11
|
+
super params, path
|
12
|
+
end
|
13
|
+
|
14
|
+
def update(params)
|
15
|
+
not_blank(params, :params)
|
16
|
+
|
17
|
+
path = 'operators/password/reset'
|
18
|
+
create params, path
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def validates_email(params)
|
24
|
+
unless params.key?(:email) && params[:email]
|
25
|
+
raise FinAppsCore::InvalidArgumentsError.new 'Invalid argument: params.'
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -4,10 +4,11 @@ module FinApps
|
|
4
4
|
class Sessions < FinAppsCore::REST::Resources # :nodoc:
|
5
5
|
# @param [Hash] params
|
6
6
|
# @return [Array<String>]
|
7
|
-
def create(params)
|
7
|
+
def create(params, path=nil)
|
8
8
|
raise FinAppsCore::InvalidArgumentsError.new 'Invalid argument: params.' unless validates params
|
9
|
+
path ||= 'login'
|
9
10
|
|
10
|
-
super params,
|
11
|
+
super params, path
|
11
12
|
end
|
12
13
|
|
13
14
|
private
|
data/lib/finapps/version.rb
CHANGED
data/spec/rest/consumers_spec.rb
CHANGED
@@ -0,0 +1,70 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'spec_helpers/client'
|
3
|
+
|
4
|
+
RSpec.describe FinApps::REST::OperatorsPasswordResets, 'initialized with valid FinApps::Client object' do
|
5
|
+
include SpecHelpers::Client
|
6
|
+
subject(:operators_password_resets) { FinApps::REST::OperatorsPasswordResets.new(client) }
|
7
|
+
|
8
|
+
describe '#create' do
|
9
|
+
let(:results) { create[0] }
|
10
|
+
let(:error_messages) { create[1] }
|
11
|
+
|
12
|
+
context 'when missing params' do
|
13
|
+
let(:create) { subject.create(nil) }
|
14
|
+
|
15
|
+
it { expect { create }.to raise_error(FinAppsCore::MissingArgumentsError) }
|
16
|
+
end
|
17
|
+
|
18
|
+
context 'for invalid params' do
|
19
|
+
let(:create) { subject.create(params: 'invalid params') }
|
20
|
+
|
21
|
+
it { expect { create }.to raise_error(FinAppsCore::InvalidArgumentsError) }
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'for valid params' do
|
25
|
+
let(:create) { subject.create(email: 'valid email') }
|
26
|
+
|
27
|
+
it { expect { create }.not_to raise_error }
|
28
|
+
it('returns an array') { expect(create).to be_a(Array) }
|
29
|
+
it('performs a post and returns the response') do
|
30
|
+
expect(results).to respond_to(:public_id)
|
31
|
+
expect(results).to respond_to(:token)
|
32
|
+
expect(results).to respond_to(:expiry_date)
|
33
|
+
end
|
34
|
+
it('returns no error messages') { expect(error_messages).to be_empty }
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
describe '#update' do
|
39
|
+
let(:results) { update[0] }
|
40
|
+
let(:error_messages) { update[1] }
|
41
|
+
|
42
|
+
context 'when missing params' do
|
43
|
+
let(:update) { subject.update(nil) }
|
44
|
+
|
45
|
+
it { expect { update }.to raise_error(FinAppsCore::MissingArgumentsError) }
|
46
|
+
end
|
47
|
+
|
48
|
+
context 'for invalid params' do
|
49
|
+
let(:update) { subject.update(params: 'invalid') }
|
50
|
+
|
51
|
+
it { expect { update }.not_to raise_error }
|
52
|
+
it('results is nil') { expect(results).to be_nil }
|
53
|
+
it('error messages array is populated') do
|
54
|
+
expect(error_messages.first.downcase).to eq('invalid request body')
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
context 'for valid params' do
|
59
|
+
let(:update) { subject.update(params: 'valid') }
|
60
|
+
|
61
|
+
it { expect { update }.not_to raise_error }
|
62
|
+
it('returns an array') { expect(update).to be_a(Array) }
|
63
|
+
it('performs a post and returns the response') do
|
64
|
+
expect(results).to respond_to(:public_id)
|
65
|
+
expect(results).to respond_to(:role)
|
66
|
+
end
|
67
|
+
it('returns no error messages') { expect(error_messages).to be_empty }
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,182 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'spec_helpers/client'
|
3
|
+
|
4
|
+
RSpec.describe FinApps::REST::Operators, 'initialized with valid FinApps::Client object' do
|
5
|
+
include SpecHelpers::Client
|
6
|
+
subject(:operators) { FinApps::REST::Operators.new(client) }
|
7
|
+
|
8
|
+
describe '#list' do
|
9
|
+
context 'when missing params' do
|
10
|
+
# use defaults
|
11
|
+
let(:list) { subject.list }
|
12
|
+
let(:results) { list[0] }
|
13
|
+
let(:error_messages) { list[1] }
|
14
|
+
|
15
|
+
it { expect { list }.not_to raise_error }
|
16
|
+
it('performs a get and returns the response') { expect(results).to respond_to(:records) }
|
17
|
+
it('returns an array of records') { expect(results.records).to be_a(Array) }
|
18
|
+
it('returns no error messages') { expect(error_messages).to be_empty }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe '#show' do
|
23
|
+
let(:results) { show[0] }
|
24
|
+
let(:error_messages) { show[1] }
|
25
|
+
|
26
|
+
context 'when missing id' do
|
27
|
+
let(:show) { subject.show(nil) }
|
28
|
+
|
29
|
+
it { expect { show }.to raise_error(FinAppsCore::MissingArgumentsError) }
|
30
|
+
end
|
31
|
+
|
32
|
+
context 'for invalid id' do
|
33
|
+
let(:show) { subject.show(:invalid_id) }
|
34
|
+
|
35
|
+
it { expect { show }.not_to raise_error }
|
36
|
+
it('results is nil') { expect(results).to be_nil }
|
37
|
+
it('error messages array is populated') do
|
38
|
+
expect(error_messages.first.downcase).to eq('resource not found')
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
context 'for valid id' do
|
43
|
+
let(:show) { subject.show(:valid_id) }
|
44
|
+
|
45
|
+
it { expect { show }.not_to raise_error }
|
46
|
+
it('returns an array') { expect(show).to be_a(Array) }
|
47
|
+
it('performs a get and returns the response') { expect(results).to respond_to(:public_id) }
|
48
|
+
it('returns no error messages') { expect(error_messages).to be_empty }
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe '#create' do
|
53
|
+
let(:results) { create[0] }
|
54
|
+
let(:error_messages) { create[1] }
|
55
|
+
|
56
|
+
context 'when missing params' do
|
57
|
+
let(:create) { subject.create(nil) }
|
58
|
+
|
59
|
+
it { expect { create }.to raise_error(FinAppsCore::MissingArgumentsError) }
|
60
|
+
end
|
61
|
+
|
62
|
+
context 'when invalid params are provided' do
|
63
|
+
let(:create) { subject.create(params: 'invalid') }
|
64
|
+
|
65
|
+
it { expect { create }.not_to raise_error }
|
66
|
+
it('results is nil') { expect(results).to be_nil }
|
67
|
+
it('error messages array is populated') do
|
68
|
+
expect(error_messages.first.downcase).to eq('invalid request body')
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
context 'when valid params are provided' do
|
73
|
+
let(:create) { subject.create(params: 'valid') }
|
74
|
+
|
75
|
+
it { expect { create }.not_to raise_error }
|
76
|
+
it('returns an array') { expect(create).to be_a(Array) }
|
77
|
+
it('performs a post and returns the response') do
|
78
|
+
expect(results).to respond_to(:public_id)
|
79
|
+
expect(results).to respond_to(:role)
|
80
|
+
end
|
81
|
+
it('returns no error messages') { expect(error_messages).to be_empty }
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
describe '#update' do
|
86
|
+
let(:results) { update[0] }
|
87
|
+
let(:error_messages) { update[1] }
|
88
|
+
|
89
|
+
context 'when missing id' do
|
90
|
+
let(:update) { subject.update(nil, params: 'params') }
|
91
|
+
|
92
|
+
it { expect { update }.to raise_error(FinAppsCore::MissingArgumentsError) }
|
93
|
+
end
|
94
|
+
|
95
|
+
context 'when missing params' do
|
96
|
+
let(:update) { subject.update(:valid_id, nil) }
|
97
|
+
|
98
|
+
it { expect { update }.to raise_error(FinAppsCore::MissingArgumentsError) }
|
99
|
+
end
|
100
|
+
|
101
|
+
context 'with invalid params' do
|
102
|
+
let(:update) { subject.update(:invalid_id, params: 'params') }
|
103
|
+
|
104
|
+
it { expect { update }.not_to raise_error }
|
105
|
+
it('results is nil') { expect(results).to be_nil }
|
106
|
+
it('error messages array is populated') do
|
107
|
+
expect(error_messages.first.downcase).to eq('resource not found')
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
context 'with valid params' do
|
112
|
+
let(:update) { subject.update(:valid_id, params: 'valid params') }
|
113
|
+
|
114
|
+
it { expect { update }.not_to raise_error }
|
115
|
+
it('returns an array') { expect(update).to be_a(Array) }
|
116
|
+
it('performs a put and returns the response') do
|
117
|
+
expect(results).to respond_to(:email)
|
118
|
+
expect(results).to respond_to(:role)
|
119
|
+
end
|
120
|
+
it('returns no error messages') { expect(error_messages).to be_empty }
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
describe '#update_password' do
|
125
|
+
let(:results) { update_password[0] }
|
126
|
+
let(:error_messages) { update_password[1] }
|
127
|
+
|
128
|
+
context 'when missing params' do
|
129
|
+
let(:update_password) { subject.update_password(nil) }
|
130
|
+
|
131
|
+
it { expect { update_password }.to raise_error(FinAppsCore::MissingArgumentsError) }
|
132
|
+
end
|
133
|
+
|
134
|
+
context 'with invalid params' do
|
135
|
+
let(:update_password) { subject.update_password(password: 'invalid') }
|
136
|
+
|
137
|
+
it { expect { update_password }.to raise_error(FinAppsCore::InvalidArgumentsError) }
|
138
|
+
end
|
139
|
+
|
140
|
+
context 'with valid params' do
|
141
|
+
let(:valid_params) { {password: 'valid password', password_confirm: 'valid_password'} }
|
142
|
+
let(:update_password) { subject.update_password(valid_params) }
|
143
|
+
|
144
|
+
it { expect { update_password }.not_to raise_error }
|
145
|
+
it('returns an array') { expect(update_password).to be_a(Array) }
|
146
|
+
it('performs a post and returns the response') do
|
147
|
+
expect(results).to respond_to(:public_id)
|
148
|
+
expect(results).to respond_to(:role)
|
149
|
+
end
|
150
|
+
it('returns no error messages') { expect(error_messages).to be_empty }
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
describe '#destroy' do
|
155
|
+
let(:results) { destroy[0] }
|
156
|
+
let(:error_messages) { destroy[1] }
|
157
|
+
|
158
|
+
context 'when missing id' do
|
159
|
+
let(:destroy) { subject.destroy(nil) }
|
160
|
+
|
161
|
+
it { expect { destroy }.to raise_error(FinAppsCore::MissingArgumentsError) }
|
162
|
+
end
|
163
|
+
|
164
|
+
context 'for invalid id' do
|
165
|
+
let(:destroy) { subject.destroy(:invalid_id) }
|
166
|
+
|
167
|
+
it { expect { destroy }.not_to raise_error }
|
168
|
+
it('results is nil') { expect(results).to be_nil }
|
169
|
+
it('error messages array is populated') do
|
170
|
+
expect(error_messages.first.downcase).to eq('resource not found')
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
context 'for valid id' do
|
175
|
+
let(:destroy) { subject.destroy(:valid_id) }
|
176
|
+
|
177
|
+
it { expect { destroy }.not_to raise_error }
|
178
|
+
it('results is nil') { expect(results).to be_nil }
|
179
|
+
it('error_messages array is empty') { expect(error_messages).to eq([]) }
|
180
|
+
end
|
181
|
+
end
|
182
|
+
end
|
@@ -2,9 +2,6 @@
|
|
2
2
|
RSpec.describe FinApps::REST::OrderTokens, 'initialized with valid FinApps::Client object' do
|
3
3
|
include SpecHelpers::Client
|
4
4
|
|
5
|
-
RESULTS = 0
|
6
|
-
ERROR_MESSAGES = 1
|
7
|
-
|
8
5
|
describe '#show' do
|
9
6
|
subject(:order_tokens) { FinApps::REST::OrderTokens.new(client) }
|
10
7
|
let(:results) { show[RESULTS] }
|
data/spec/rest/orders_spec.rb
CHANGED
data/spec/rest/sessions_spec.rb
CHANGED
@@ -38,5 +38,15 @@ RSpec.describe FinApps::REST::Sessions, 'initialized with valid FinApps::Client
|
|
38
38
|
it('token value is in the result') { expect(results).to respond_to(:token) }
|
39
39
|
it('error_messages is empty') { expect(error_messages).to be_empty }
|
40
40
|
end
|
41
|
+
|
42
|
+
context 'for valid credentials & path argument' do
|
43
|
+
let(:create) { subject.create(credentials, 'operators/login') }
|
44
|
+
let(:credentials) { {email: 'email@domain.com', password: 'valid_password'} }
|
45
|
+
|
46
|
+
it('results is a Hashie::Rash') { expect(results).to be_a(Hashie::Rash) }
|
47
|
+
it('token value is in the result') { expect(results).to respond_to(:token) }
|
48
|
+
it('returns operator for operator path') { expect(results).to respond_to(:role) }
|
49
|
+
it('error_messages is empty') { expect(error_messages).to be_empty }
|
50
|
+
end
|
41
51
|
end
|
42
52
|
end
|
@@ -1,12 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
require 'spec_helpers/client'
|
3
|
-
|
4
2
|
RSpec.describe FinApps::REST::UserInstitutionsForms do
|
5
3
|
include SpecHelpers::Client
|
6
4
|
|
7
|
-
RESULT = 0
|
8
|
-
ERROR_MESSAGES = 1
|
9
|
-
|
10
5
|
describe '#show' do
|
11
6
|
context 'when missing site id' do
|
12
7
|
subject { FinApps::REST::UserInstitutionsForms.new(client).show(nil) }
|
@@ -17,7 +12,7 @@ RSpec.describe FinApps::REST::UserInstitutionsForms do
|
|
17
12
|
subject { FinApps::REST::UserInstitutionsForms.new(client).show('valid_id') }
|
18
13
|
|
19
14
|
it { expect { subject }.not_to raise_error }
|
20
|
-
it('performs a get and returns the login html') { expect(subject[
|
15
|
+
it('performs a get and returns the login html') { expect(subject[RESULTS]).to respond_to(:login_form_html) }
|
21
16
|
it('returns no error messages') { expect(subject[ERROR_MESSAGES]).to be_empty }
|
22
17
|
end
|
23
18
|
|
@@ -25,7 +20,7 @@ RSpec.describe FinApps::REST::UserInstitutionsForms do
|
|
25
20
|
subject { FinApps::REST::UserInstitutionsForms.new(client).show('invalid_id') }
|
26
21
|
|
27
22
|
it { expect { subject }.not_to raise_error }
|
28
|
-
it('results is nil') { expect(subject[
|
23
|
+
it('results is nil') { expect(subject[RESULTS]).to be_nil }
|
29
24
|
it('error messages array is populated') do
|
30
25
|
expect(subject[ERROR_MESSAGES].first.downcase).to eq('invalid institution id')
|
31
26
|
end
|
@@ -1,12 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
require 'spec_helpers/client'
|
3
|
-
|
4
2
|
RSpec.describe FinApps::REST::UserInstitutions do
|
5
3
|
include SpecHelpers::Client
|
6
4
|
|
7
|
-
RESULT = 0
|
8
|
-
ERROR_MESSAGES = 1
|
9
|
-
|
10
5
|
describe '#list' do
|
11
6
|
context 'when successful' do
|
12
7
|
subject { FinApps::REST::UserInstitutions.new(client).list }
|
@@ -34,7 +29,7 @@ RSpec.describe FinApps::REST::UserInstitutions do
|
|
34
29
|
let(:create) { subject.create('valid_site_id', :params) }
|
35
30
|
|
36
31
|
it { expect { create }.not_to raise_error }
|
37
|
-
it('performs a post and returns the response') { expect(create[
|
32
|
+
it('performs a post and returns the response') { expect(create[RESULTS]).to respond_to(:consumer_institution) }
|
38
33
|
it('returns no error messages') { expect(create[ERROR_MESSAGES]).to be_empty }
|
39
34
|
end
|
40
35
|
|
@@ -80,7 +75,7 @@ RSpec.describe FinApps::REST::UserInstitutions do
|
|
80
75
|
subject { FinApps::REST::UserInstitutions.new(client).mfa_update('valid_id', :params) }
|
81
76
|
|
82
77
|
it { expect { subject }.not_to raise_error }
|
83
|
-
it('performs a post and returns the response') { expect(subject[
|
78
|
+
it('performs a post and returns the response') { expect(subject[RESULTS]).to respond_to(:consumer_institution) }
|
84
79
|
it('returns no error messages') { expect(subject[ERROR_MESSAGES]).to be_empty }
|
85
80
|
end
|
86
81
|
|
@@ -108,7 +103,7 @@ RSpec.describe FinApps::REST::UserInstitutions do
|
|
108
103
|
subject { FinApps::REST::UserInstitutions.new(client).credentials_update('valid_id', :params) }
|
109
104
|
|
110
105
|
it { expect { subject }.not_to raise_error }
|
111
|
-
it('performs a post and returns the response') { expect(subject[
|
106
|
+
it('performs a post and returns the response') { expect(subject[RESULTS]).to respond_to(:consumer_institution) }
|
112
107
|
it('returns no error messages') { expect(subject[ERROR_MESSAGES]).to be_empty }
|
113
108
|
end
|
114
109
|
|
@@ -4,9 +4,6 @@ require 'spec_helpers/client'
|
|
4
4
|
RSpec.describe FinApps::REST::UserInstitutionsStatuses do
|
5
5
|
include SpecHelpers::Client
|
6
6
|
|
7
|
-
RESULT = 0
|
8
|
-
ERROR_MESSAGES = 1
|
9
|
-
|
10
7
|
describe '#show' do
|
11
8
|
context 'when missing id' do
|
12
9
|
subject { FinApps::REST::UserInstitutionsStatuses.new(client).show(nil) }
|
@@ -18,7 +15,7 @@ RSpec.describe FinApps::REST::UserInstitutionsStatuses do
|
|
18
15
|
|
19
16
|
it { expect { subject }.not_to raise_error }
|
20
17
|
it('returns an array') { expect(subject).to be_a(Array) }
|
21
|
-
it('performs a get and returns the response') { expect(subject[
|
18
|
+
it('performs a get and returns the response') { expect(subject[RESULTS]).to respond_to(:_id) }
|
22
19
|
it('returns no error messages') { expect(subject[ERROR_MESSAGES]).to be_empty }
|
23
20
|
end
|
24
21
|
|
@@ -26,7 +23,7 @@ RSpec.describe FinApps::REST::UserInstitutionsStatuses do
|
|
26
23
|
subject { FinApps::REST::UserInstitutionsStatuses.new(client).show('invalid_id') }
|
27
24
|
|
28
25
|
it { expect { subject }.not_to raise_error }
|
29
|
-
it('results is nil') { expect(subject[
|
26
|
+
it('results is nil') { expect(subject[RESULTS]).to be_nil }
|
30
27
|
it('error messages array is populated') do
|
31
28
|
expect(subject[ERROR_MESSAGES].first.downcase).to eq('invalid user institution id')
|
32
29
|
end
|
@@ -38,7 +35,7 @@ RSpec.describe FinApps::REST::UserInstitutionsStatuses do
|
|
38
35
|
subject { FinApps::REST::UserInstitutionsStatuses.new(client).update }
|
39
36
|
|
40
37
|
it('returns an array') { expect(subject).to be_a(Array) }
|
41
|
-
it('performs a get and returns array of user institutions statuses') { expect(subject[
|
38
|
+
it('performs a get and returns array of user institutions statuses') { expect(subject[RESULTS]).to be_a(Array) }
|
42
39
|
it('returns no error messages') { expect(subject[ERROR_MESSAGES]).to be_empty }
|
43
40
|
end
|
44
41
|
end
|
data/spec/spec_helper.rb
CHANGED
data/spec/support/fake_api.rb
CHANGED
@@ -75,6 +75,35 @@ class FakeApi < Sinatra::Base
|
|
75
75
|
delete('/v2/consumers/valid_public_id') { status 204 }
|
76
76
|
delete('/v2/consumers/invalid_public_id') { json_response 404, 'resource_not_found.json' }
|
77
77
|
|
78
|
+
# operators
|
79
|
+
get('/v2/operators') { json_response 200, 'operator_list.json' }
|
80
|
+
get('/v2/operators/invalid_id') { json_response 404, 'resource_not_found.json' }
|
81
|
+
get('/v2/operators/valid_id') { json_response 200, 'operator.json' }
|
82
|
+
delete('/v2/operators/invalid_id') { json_response 404, 'resource_not_found.json' }
|
83
|
+
delete('/v2/operators/valid_id') { status 204 }
|
84
|
+
post('/v2/operators/password/change') { json_response 200, 'operator.json' }
|
85
|
+
put('/v2/operators/invalid_id') { json_response 404, 'resource_not_found.json' }
|
86
|
+
put('/v2/operators/valid_id') { json_response 200, 'operator.json' }
|
87
|
+
post('/v2/operators/password/forgot') { json_response 200, 'operator_forgot_password.json' }
|
88
|
+
post('/v2/operators/password/reset') do
|
89
|
+
request.body.rewind
|
90
|
+
request_payload = JSON.parse request.body.read
|
91
|
+
if request_payload['params'] == 'valid'
|
92
|
+
json_response 200, 'operator.json'
|
93
|
+
else
|
94
|
+
json_response 400, 'invalid_request_body.json'
|
95
|
+
end
|
96
|
+
end
|
97
|
+
post('/v2/operators') do
|
98
|
+
request.body.rewind
|
99
|
+
request_payload = JSON.parse request.body.read
|
100
|
+
if request_payload['params'] == 'valid'
|
101
|
+
json_response 201, 'operator.json'
|
102
|
+
else
|
103
|
+
json_response 400, 'invalid_request_body.json'
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
78
107
|
# session
|
79
108
|
post('/v2/login') do
|
80
109
|
request.body.rewind
|
@@ -85,6 +114,7 @@ class FakeApi < Sinatra::Base
|
|
85
114
|
json_response(401, 'unauthorized.json')
|
86
115
|
end
|
87
116
|
end
|
117
|
+
post('/v2/operators/login') { json_response 200, 'operator.json' }
|
88
118
|
|
89
119
|
# password resets
|
90
120
|
post('/v2/tenant/valid_user_id/password') { json_response 200, 'password_reset_token.json' }
|
@@ -0,0 +1,10 @@
|
|
1
|
+
{
|
2
|
+
"public_id": "9cc36daa-a63a-48c9-b465-1ddd2c527128",
|
3
|
+
"email": "operator@finapps.com",
|
4
|
+
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwdWJsaWNfaWQiOiI5Y2MzNmRhYS1hNjNhLTQ4YzktYjQ2NS0xZGRkMmM1MjcxMjgiLCJzZXNzaW9uX2lkIjoiZmQyNWQ3MmEtNDkxZS00MTY3LTUyZmMtODdiNGEyY2YxMjM0IiwidGVuYW50X2lkIjoiNDlmYjkxOGQtN2U3MS00NGRkLTczNzgtNThmMTk2MDZkZjJhIiwiZXhwIjoxNDg5NzI1Mjk4LCJpYXQiOjE0ODk2Mzg4OTgsImlzcyI6IkZpbmFuY2lhbEFwcHMiLCJuYmYiOjE0ODk2Mzg4OTh9.nZIyIE11G98Yw0yQ-KO-lNVa76i9Z_2wdmK_OVHQCXY",
|
5
|
+
"role": 1,
|
6
|
+
"first_name": "test",
|
7
|
+
"last_name": "operator",
|
8
|
+
"memo": "",
|
9
|
+
"phone_number": "555.555.1234"
|
10
|
+
}
|
@@ -0,0 +1,36 @@
|
|
1
|
+
{
|
2
|
+
"page": 1,
|
3
|
+
"total_records": 4,
|
4
|
+
"records": [
|
5
|
+
{
|
6
|
+
"public_id": "66f99fec-21e1-46d6-5bdd-b5b11c3cfe5f",
|
7
|
+
"company_id": "49fb918d-7e71-44dd-7378-58f19606df2a",
|
8
|
+
"role": 3,
|
9
|
+
"status": 1,
|
10
|
+
"language": 1,
|
11
|
+
"currency": 1,
|
12
|
+
"first_name": "Jacob",
|
13
|
+
"last_name": "operator",
|
14
|
+
"email": "operator2@example.com",
|
15
|
+
"memo": "",
|
16
|
+
"phone_number": "316.555.1234",
|
17
|
+
"date_modified": "2017-03-01T13:11:22.996-06:00",
|
18
|
+
"date_created": "2017-03-01T13:11:22.996-06:00"
|
19
|
+
},
|
20
|
+
{
|
21
|
+
"public_id": "03050af5-e755-4eef-4cf5-3da3ecdd1269",
|
22
|
+
"company_id": "49fb918d-7e71-44dd-7378-58f19606df2a",
|
23
|
+
"role": 3,
|
24
|
+
"status": 1,
|
25
|
+
"language": 1,
|
26
|
+
"currency": 1,
|
27
|
+
"first_name": "Jacob",
|
28
|
+
"last_name": "operator",
|
29
|
+
"email": "operator@example.com",
|
30
|
+
"memo": "",
|
31
|
+
"phone_number": "316.555.1234",
|
32
|
+
"date_modified": "2017-03-01T12:58:26.772-06:00",
|
33
|
+
"date_created": "2017-03-01T12:58:26.772-06:00"
|
34
|
+
}
|
35
|
+
]
|
36
|
+
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: finapps
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Erich Quintero
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: finapps_core
|
@@ -237,6 +237,8 @@ files:
|
|
237
237
|
- lib/finapps/rest/consumers.rb
|
238
238
|
- lib/finapps/rest/institutions.rb
|
239
239
|
- lib/finapps/rest/institutions_forms.rb
|
240
|
+
- lib/finapps/rest/operators.rb
|
241
|
+
- lib/finapps/rest/operators_password_resets.rb
|
240
242
|
- lib/finapps/rest/order_reports.rb
|
241
243
|
- lib/finapps/rest/order_statuses.rb
|
242
244
|
- lib/finapps/rest/order_tokens.rb
|
@@ -253,6 +255,8 @@ files:
|
|
253
255
|
- spec/rest/consumers_spec.rb
|
254
256
|
- spec/rest/institutions_forms_spec.rb
|
255
257
|
- spec/rest/institutions_spec.rb
|
258
|
+
- spec/rest/operators_password_resets_spec.rb
|
259
|
+
- spec/rest/operators_spec.rb
|
256
260
|
- spec/rest/order_reports_spec.rb
|
257
261
|
- spec/rest/order_statuses_spec.rb
|
258
262
|
- spec/rest/order_tokens_spec.rb
|
@@ -265,7 +269,6 @@ files:
|
|
265
269
|
- spec/rest/version_spec.rb
|
266
270
|
- spec/spec_helper.rb
|
267
271
|
- spec/spec_helpers/client.rb
|
268
|
-
- spec/spec_helpers/constants.rb
|
269
272
|
- spec/support/fake_api.rb
|
270
273
|
- spec/support/fixtures/error.json
|
271
274
|
- spec/support/fixtures/institution_add.json
|
@@ -275,6 +278,9 @@ files:
|
|
275
278
|
- spec/support/fixtures/invalid_request_body.json
|
276
279
|
- spec/support/fixtures/invalid_user_id.json
|
277
280
|
- spec/support/fixtures/invalid_user_institution_id.json
|
281
|
+
- spec/support/fixtures/operator.json
|
282
|
+
- spec/support/fixtures/operator_forgot_password.json
|
283
|
+
- spec/support/fixtures/operator_list.json
|
278
284
|
- spec/support/fixtures/order.json
|
279
285
|
- spec/support/fixtures/order_report.json
|
280
286
|
- spec/support/fixtures/order_status.json
|
@@ -322,12 +328,14 @@ signing_key:
|
|
322
328
|
specification_version: 4
|
323
329
|
summary: FinApps REST API ruby client.
|
324
330
|
test_files:
|
331
|
+
- spec/rest/operators_password_resets_spec.rb
|
325
332
|
- spec/rest/version_spec.rb
|
326
333
|
- spec/rest/user_institutions_forms_spec.rb
|
327
334
|
- spec/rest/consumers_spec.rb
|
328
335
|
- spec/rest/orders_spec.rb
|
329
336
|
- spec/rest/order_tokens_spec.rb
|
330
337
|
- spec/rest/institutions_forms_spec.rb
|
338
|
+
- spec/rest/operators_spec.rb
|
331
339
|
- spec/rest/user_institutions_statuses_spec.rb
|
332
340
|
- spec/rest/client_spec.rb
|
333
341
|
- spec/rest/user_institutions_spec.rb
|
@@ -338,5 +346,4 @@ test_files:
|
|
338
346
|
- spec/rest/sessions_spec.rb
|
339
347
|
- spec/support/fake_api.rb
|
340
348
|
- spec/spec_helpers/client.rb
|
341
|
-
- spec/spec_helpers/constants.rb
|
342
349
|
- spec/spec_helper.rb
|