mx-platform-ruby 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +20 -0
- data/.gitignore +13 -0
- data/.rubocop.yml +44 -0
- data/Gemfile +5 -0
- data/LICENSE +21 -0
- data/README.md +60 -0
- data/Rakefile +11 -0
- data/lib/mx-platform-ruby.rb +44 -0
- data/lib/mx-platform-ruby/account.rb +107 -0
- data/lib/mx-platform-ruby/account_number.rb +57 -0
- data/lib/mx-platform-ruby/account_owner.rb +42 -0
- data/lib/mx-platform-ruby/category.rb +127 -0
- data/lib/mx-platform-ruby/challenge.rb +37 -0
- data/lib/mx-platform-ruby/client.rb +59 -0
- data/lib/mx-platform-ruby/connect_widget.rb +43 -0
- data/lib/mx-platform-ruby/credential.rb +54 -0
- data/lib/mx-platform-ruby/enhanced_transaction.rb +44 -0
- data/lib/mx-platform-ruby/error.rb +6 -0
- data/lib/mx-platform-ruby/holding.rb +87 -0
- data/lib/mx-platform-ruby/institution.rb +78 -0
- data/lib/mx-platform-ruby/member.rb +242 -0
- data/lib/mx-platform-ruby/member_status.rb +35 -0
- data/lib/mx-platform-ruby/merchant.rb +52 -0
- data/lib/mx-platform-ruby/oauth_window.rb +32 -0
- data/lib/mx-platform-ruby/pageable.rb +29 -0
- data/lib/mx-platform-ruby/statement.rb +70 -0
- data/lib/mx-platform-ruby/tag.rb +104 -0
- data/lib/mx-platform-ruby/tagging.rb +107 -0
- data/lib/mx-platform-ruby/transaction.rb +162 -0
- data/lib/mx-platform-ruby/transaction_rule.rb +112 -0
- data/lib/mx-platform-ruby/user.rb +112 -0
- data/lib/mx-platform-ruby/version.rb +5 -0
- data/lib/mx-platform-ruby/widget.rb +49 -0
- data/mx-platform-ruby.gemspec +31 -0
- data/spec/lib/mx-platform-ruby/account_number_spec.rb +100 -0
- data/spec/lib/mx-platform-ruby/account_owner_spec.rb +71 -0
- data/spec/lib/mx-platform-ruby/account_spec.rb +267 -0
- data/spec/lib/mx-platform-ruby/category_spec.rb +244 -0
- data/spec/lib/mx-platform-ruby/challenge_spec.rb +72 -0
- data/spec/lib/mx-platform-ruby/client_spec.rb +101 -0
- data/spec/lib/mx-platform-ruby/connect_widget_spec.rb +66 -0
- data/spec/lib/mx-platform-ruby/credential_spec.rb +90 -0
- data/spec/lib/mx-platform-ruby/enhanced_transaction_spec.rb +89 -0
- data/spec/lib/mx-platform-ruby/holding_spec.rb +178 -0
- data/spec/lib/mx-platform-ruby/institution_spec.rb +141 -0
- data/spec/lib/mx-platform-ruby/member_spec.rb +557 -0
- data/spec/lib/mx-platform-ruby/member_status_spec.rb +76 -0
- data/spec/lib/mx-platform-ruby/merchant_spec.rb +89 -0
- data/spec/lib/mx-platform-ruby/oauth_window_spec.rb +47 -0
- data/spec/lib/mx-platform-ruby/pageable_spec.rb +75 -0
- data/spec/lib/mx-platform-ruby/statement_spec.rb +130 -0
- data/spec/lib/mx-platform-ruby/tag_spec.rb +179 -0
- data/spec/lib/mx-platform-ruby/tagging_spec.rb +191 -0
- data/spec/lib/mx-platform-ruby/transaction_rule_spec.rb +207 -0
- data/spec/lib/mx-platform-ruby/transaction_spec.rb +449 -0
- data/spec/lib/mx-platform-ruby/user_spec.rb +196 -0
- data/spec/lib/mx-platform-ruby/widget_spec.rb +76 -0
- data/spec/lib/mx-platform-ruby_spec.rb +15 -0
- data/spec/sample.pdf +0 -0
- data/spec/spec_helper.rb +24 -0
- metadata +63 -3
@@ -0,0 +1,557 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
RSpec.describe ::MXPlatformRuby::Member do
|
6
|
+
let(:member_attributes) do
|
7
|
+
{
|
8
|
+
aggregated_at: '2016-10-13T18:07:57.000Z',
|
9
|
+
connection_status: 'CONNECTED',
|
10
|
+
guid: 'MBR-7c6f361b-e582-15b6-60c0-358f12466b4b',
|
11
|
+
id: 'unique_id',
|
12
|
+
institution_code: 'chase',
|
13
|
+
is_being_aggregated: false,
|
14
|
+
is_oauth: false,
|
15
|
+
metadata: '\"credentials_last_refreshed_at\": \"2015-10-15\"',
|
16
|
+
name: 'Chase Bank',
|
17
|
+
oauth_window_uri: 'int-widgets.moneydesktop.com/oauth/predirect_to/MBR-df96fd60-7122-4464-b3c2-ff11d8c74f6f/p8v7rxpxg3pdAsfgwxcrwxwhz3Zbygxfr6wAb931qv91hpb57k6bkr6t6m9djrfrfd467p8xkgqp6w7k1r9g8k8bfxqbfw2lq5tdwjq2sngAx76fm0jrw0dpmbtlkxchgjsw3r7r0hhq6A8sshqptfxql2rt123shfpkyhhpfvy67yvprbkb7lmlyrpwsd9yj0s22pmsyjhcw7d2q44d9fsxn5kfsmr2zqc79c2AxAx5gkjgbczf22A1sjx70t2pvnggzyh55s7bh62dd5wq7f1r4x90mcxn1tfhhrq5b09mjkt5hg66cjn700pcf6fgA42lbsp7v1pdch85mswycrp21c6j2sxffm14Asg3?skip_aggregation=false&referral_source=APP&ui_message_webview_url_scheme=myapp',
|
18
|
+
successfully_aggregated_at: '2016-10-13T17:57:38.000Z',
|
19
|
+
user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
|
20
|
+
}
|
21
|
+
end
|
22
|
+
let(:aggregate_member_options) do
|
23
|
+
{
|
24
|
+
member_guid: 'MBR-7c6f361b-e582-15b6-60c0-358f12466b4b',
|
25
|
+
user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
|
26
|
+
}
|
27
|
+
end
|
28
|
+
let(:check_balances_options) do
|
29
|
+
{
|
30
|
+
member_guid: 'MBR-7c6f361b-e582-15b6-60c0-358f12466b4b',
|
31
|
+
user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
|
32
|
+
}
|
33
|
+
end
|
34
|
+
let(:create_member_options) do
|
35
|
+
{
|
36
|
+
background_aggregation_is_disabled: false,
|
37
|
+
credentials: [
|
38
|
+
{
|
39
|
+
guid: 'CRD-27d0edb8-1d50-5b90-bcbc-be270ca42b9f',
|
40
|
+
value: 'password'
|
41
|
+
}
|
42
|
+
],
|
43
|
+
id: 'unique_id',
|
44
|
+
institution_code: 'chase',
|
45
|
+
is_oauth: false,
|
46
|
+
metadata: '\"credentials_last_refreshed_at\": \"2015-10-15\"',
|
47
|
+
referral_source: 'APP',
|
48
|
+
skip_aggregation: false,
|
49
|
+
ui_message_webview_url_scheme: 'mx',
|
50
|
+
user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
|
51
|
+
}
|
52
|
+
end
|
53
|
+
let(:delete_member_options) do
|
54
|
+
{
|
55
|
+
member_guid: 'MBR-7c6f361b-e582-15b6-60c0-358f12466b4b',
|
56
|
+
user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
|
57
|
+
}
|
58
|
+
end
|
59
|
+
let(:extend_history_options) do
|
60
|
+
{
|
61
|
+
member_guid: 'MBR-7c6f361b-e582-15b6-60c0-358f12466b4b',
|
62
|
+
user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
|
63
|
+
}
|
64
|
+
end
|
65
|
+
let(:fetch_statements_by_member_options) do
|
66
|
+
{
|
67
|
+
member_guid: 'MBR-7c6f361b-e582-15b6-60c0-358f12466b4b',
|
68
|
+
user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
|
69
|
+
}
|
70
|
+
end
|
71
|
+
let(:identify_member_options) do
|
72
|
+
{
|
73
|
+
member_guid: 'MBR-7c6f361b-e582-15b6-60c0-358f12466b4b',
|
74
|
+
user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
|
75
|
+
}
|
76
|
+
end
|
77
|
+
let(:list_members_options) do
|
78
|
+
{
|
79
|
+
page: 1,
|
80
|
+
records_per_page: 10,
|
81
|
+
user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
|
82
|
+
}
|
83
|
+
end
|
84
|
+
let(:read_member_options) do
|
85
|
+
{
|
86
|
+
member_guid: 'MBR-7c6f361b-e582-15b6-60c0-358f12466b4b',
|
87
|
+
user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
|
88
|
+
}
|
89
|
+
end
|
90
|
+
let(:resume_aggregation_options) do
|
91
|
+
{
|
92
|
+
challenges: [
|
93
|
+
{
|
94
|
+
guid: 'CRD-2378634-33ub5bhk54kjb',
|
95
|
+
value: 'user-entered-value'
|
96
|
+
}
|
97
|
+
],
|
98
|
+
member_guid: 'MBR-7c6f361b-e582-15b6-60c0-358f12466b4b',
|
99
|
+
user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
|
100
|
+
}
|
101
|
+
end
|
102
|
+
let(:update_member_options) do
|
103
|
+
{
|
104
|
+
background_aggregation_is_disabled: false,
|
105
|
+
credentials: [
|
106
|
+
{
|
107
|
+
guid: 'CRD-27d0edb8-1d50-5b90-bcbc-be270ca42b9f',
|
108
|
+
value: 'password'
|
109
|
+
}
|
110
|
+
],
|
111
|
+
id: 'unique_id',
|
112
|
+
member_guid: 'MBR-7c6f361b-e582-15b6-60c0-358f12466b4b',
|
113
|
+
metadata: '\"credentials_last_refreshed_at\": \"2015-10-15\"',
|
114
|
+
skip_aggregation: false,
|
115
|
+
user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
|
116
|
+
}
|
117
|
+
end
|
118
|
+
let(:verify_member_options) do
|
119
|
+
{
|
120
|
+
member_guid: 'MBR-7c6f361b-e582-15b6-60c0-358f12466b4b',
|
121
|
+
user_guid: 'USR-fa7537f3-48aa-a683-a02a-b18940482f54'
|
122
|
+
}
|
123
|
+
end
|
124
|
+
let(:pagination_attributes) do
|
125
|
+
{
|
126
|
+
'current_page' => 1,
|
127
|
+
'per_page' => 25,
|
128
|
+
'total_pages' => 1,
|
129
|
+
'total_entries' => 1
|
130
|
+
}
|
131
|
+
end
|
132
|
+
|
133
|
+
describe 'aggregate_member' do
|
134
|
+
let(:aggregate_member_response) { { 'member' => member_attributes } }
|
135
|
+
before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(aggregate_member_response) }
|
136
|
+
|
137
|
+
it 'returns member' do
|
138
|
+
response = described_class.aggregate_member
|
139
|
+
|
140
|
+
expect(response).to be_kind_of(::MXPlatformRuby::Member)
|
141
|
+
expect(response.aggregated_at).to eq(member_attributes[:aggregated_at])
|
142
|
+
expect(response.connection_status).to eq(member_attributes[:connection_status])
|
143
|
+
expect(response.guid).to eq(member_attributes[:guid])
|
144
|
+
expect(response.id).to eq(member_attributes[:id])
|
145
|
+
expect(response.institution_code).to eq(member_attributes[:institution_code])
|
146
|
+
expect(response.is_being_aggregated).to eq(member_attributes[:is_being_aggregated])
|
147
|
+
expect(response.is_oauth).to eq(member_attributes[:is_oauth])
|
148
|
+
expect(response.metadata).to eq(member_attributes[:metadata])
|
149
|
+
expect(response.name).to eq(member_attributes[:name])
|
150
|
+
expect(response.oauth_window_uri).to eq(member_attributes[:oauth_window_uri])
|
151
|
+
expect(response.successfully_aggregated_at).to eq(member_attributes[:successfully_aggregated_at])
|
152
|
+
expect(response.user_guid).to eq(member_attributes[:user_guid])
|
153
|
+
end
|
154
|
+
|
155
|
+
it 'makes a client request with the expected params' do
|
156
|
+
expect(::MXPlatformRuby.client).to receive(:make_request).with(
|
157
|
+
{
|
158
|
+
endpoint: '/users/USR-fa7537f3-48aa-a683-a02a-b18940482f54/members/MBR-7c6f361b-e582-15b6-60c0-358f12466b4b/aggregate',
|
159
|
+
http_method: :post
|
160
|
+
}
|
161
|
+
)
|
162
|
+
described_class.aggregate_member(aggregate_member_options)
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
describe 'check_balances' do
|
167
|
+
let(:check_balances_response) { { 'member' => member_attributes } }
|
168
|
+
before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(check_balances_response) }
|
169
|
+
|
170
|
+
it 'returns member' do
|
171
|
+
response = described_class.check_balances
|
172
|
+
|
173
|
+
expect(response).to be_kind_of(::MXPlatformRuby::Member)
|
174
|
+
expect(response.aggregated_at).to eq(member_attributes[:aggregated_at])
|
175
|
+
expect(response.connection_status).to eq(member_attributes[:connection_status])
|
176
|
+
expect(response.guid).to eq(member_attributes[:guid])
|
177
|
+
expect(response.id).to eq(member_attributes[:id])
|
178
|
+
expect(response.institution_code).to eq(member_attributes[:institution_code])
|
179
|
+
expect(response.is_being_aggregated).to eq(member_attributes[:is_being_aggregated])
|
180
|
+
expect(response.is_oauth).to eq(member_attributes[:is_oauth])
|
181
|
+
expect(response.metadata).to eq(member_attributes[:metadata])
|
182
|
+
expect(response.name).to eq(member_attributes[:name])
|
183
|
+
expect(response.oauth_window_uri).to eq(member_attributes[:oauth_window_uri])
|
184
|
+
expect(response.successfully_aggregated_at).to eq(member_attributes[:successfully_aggregated_at])
|
185
|
+
expect(response.user_guid).to eq(member_attributes[:user_guid])
|
186
|
+
end
|
187
|
+
|
188
|
+
it 'makes a client request with the expected params' do
|
189
|
+
expect(::MXPlatformRuby.client).to receive(:make_request).with(
|
190
|
+
{
|
191
|
+
endpoint: '/users/USR-fa7537f3-48aa-a683-a02a-b18940482f54/members/MBR-7c6f361b-e582-15b6-60c0-358f12466b4b/check_balance',
|
192
|
+
http_method: :post
|
193
|
+
}
|
194
|
+
)
|
195
|
+
described_class.check_balances(check_balances_options)
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
describe 'create_member' do
|
200
|
+
let(:create_member_response) { { 'member' => member_attributes } }
|
201
|
+
before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(create_member_response) }
|
202
|
+
|
203
|
+
it 'returns member' do
|
204
|
+
response = described_class.create_member
|
205
|
+
|
206
|
+
expect(response).to be_kind_of(::MXPlatformRuby::Member)
|
207
|
+
expect(response.aggregated_at).to eq(member_attributes[:aggregated_at])
|
208
|
+
expect(response.connection_status).to eq(member_attributes[:connection_status])
|
209
|
+
expect(response.guid).to eq(member_attributes[:guid])
|
210
|
+
expect(response.id).to eq(member_attributes[:id])
|
211
|
+
expect(response.institution_code).to eq(member_attributes[:institution_code])
|
212
|
+
expect(response.is_being_aggregated).to eq(member_attributes[:is_being_aggregated])
|
213
|
+
expect(response.is_oauth).to eq(member_attributes[:is_oauth])
|
214
|
+
expect(response.metadata).to eq(member_attributes[:metadata])
|
215
|
+
expect(response.name).to eq(member_attributes[:name])
|
216
|
+
expect(response.oauth_window_uri).to eq(member_attributes[:oauth_window_uri])
|
217
|
+
expect(response.successfully_aggregated_at).to eq(member_attributes[:successfully_aggregated_at])
|
218
|
+
expect(response.user_guid).to eq(member_attributes[:user_guid])
|
219
|
+
end
|
220
|
+
|
221
|
+
it 'makes a client request with the expected params' do
|
222
|
+
expect(::MXPlatformRuby.client).to receive(:make_request).with(
|
223
|
+
{
|
224
|
+
endpoint: '/users/USR-fa7537f3-48aa-a683-a02a-b18940482f54/members',
|
225
|
+
http_method: :post,
|
226
|
+
request_body: {
|
227
|
+
member: {
|
228
|
+
background_aggregation_is_disabled: false,
|
229
|
+
credentials: [
|
230
|
+
{
|
231
|
+
guid: 'CRD-27d0edb8-1d50-5b90-bcbc-be270ca42b9f',
|
232
|
+
value: 'password'
|
233
|
+
}
|
234
|
+
],
|
235
|
+
id: 'unique_id',
|
236
|
+
institution_code: 'chase',
|
237
|
+
is_oauth: false,
|
238
|
+
metadata: '\"credentials_last_refreshed_at\": \"2015-10-15\"',
|
239
|
+
skip_aggregation: false
|
240
|
+
},
|
241
|
+
referral_source: 'APP',
|
242
|
+
ui_message_webview_url_scheme: 'mx'
|
243
|
+
}
|
244
|
+
}
|
245
|
+
)
|
246
|
+
described_class.create_member(create_member_options)
|
247
|
+
end
|
248
|
+
end
|
249
|
+
|
250
|
+
describe 'delete_member' do
|
251
|
+
before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(nil) }
|
252
|
+
|
253
|
+
it 'returns nil' do
|
254
|
+
response = described_class.delete_member
|
255
|
+
|
256
|
+
expect(response).to be(nil)
|
257
|
+
end
|
258
|
+
|
259
|
+
it 'makes a client request with the expected params' do
|
260
|
+
expect(::MXPlatformRuby.client).to receive(:make_request).with(
|
261
|
+
{
|
262
|
+
endpoint: '/users/USR-fa7537f3-48aa-a683-a02a-b18940482f54/members/MBR-7c6f361b-e582-15b6-60c0-358f12466b4b',
|
263
|
+
http_method: :delete
|
264
|
+
}
|
265
|
+
)
|
266
|
+
described_class.delete_member(delete_member_options)
|
267
|
+
end
|
268
|
+
end
|
269
|
+
|
270
|
+
describe 'extend_history' do
|
271
|
+
let(:extend_history_response) { { 'member' => member_attributes } }
|
272
|
+
before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(extend_history_response) }
|
273
|
+
|
274
|
+
it 'returns member' do
|
275
|
+
response = described_class.extend_history
|
276
|
+
|
277
|
+
expect(response).to be_kind_of(::MXPlatformRuby::Member)
|
278
|
+
expect(response.aggregated_at).to eq(member_attributes[:aggregated_at])
|
279
|
+
expect(response.connection_status).to eq(member_attributes[:connection_status])
|
280
|
+
expect(response.guid).to eq(member_attributes[:guid])
|
281
|
+
expect(response.id).to eq(member_attributes[:id])
|
282
|
+
expect(response.institution_code).to eq(member_attributes[:institution_code])
|
283
|
+
expect(response.is_being_aggregated).to eq(member_attributes[:is_being_aggregated])
|
284
|
+
expect(response.is_oauth).to eq(member_attributes[:is_oauth])
|
285
|
+
expect(response.metadata).to eq(member_attributes[:metadata])
|
286
|
+
expect(response.name).to eq(member_attributes[:name])
|
287
|
+
expect(response.oauth_window_uri).to eq(member_attributes[:oauth_window_uri])
|
288
|
+
expect(response.successfully_aggregated_at).to eq(member_attributes[:successfully_aggregated_at])
|
289
|
+
expect(response.user_guid).to eq(member_attributes[:user_guid])
|
290
|
+
end
|
291
|
+
|
292
|
+
it 'makes a client request with the expected params' do
|
293
|
+
expect(::MXPlatformRuby.client).to receive(:make_request).with(
|
294
|
+
{
|
295
|
+
endpoint: '/users/USR-fa7537f3-48aa-a683-a02a-b18940482f54/members/MBR-7c6f361b-e582-15b6-60c0-358f12466b4b/extend_history',
|
296
|
+
http_method: :post
|
297
|
+
}
|
298
|
+
)
|
299
|
+
described_class.extend_history(extend_history_options)
|
300
|
+
end
|
301
|
+
end
|
302
|
+
|
303
|
+
describe 'fetch_statements_by_member' do
|
304
|
+
let(:fetch_statements_by_member_response) { { 'member' => member_attributes } }
|
305
|
+
before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(fetch_statements_by_member_response) }
|
306
|
+
|
307
|
+
it 'returns member' do
|
308
|
+
response = described_class.fetch_statements_by_member
|
309
|
+
|
310
|
+
expect(response).to be_kind_of(::MXPlatformRuby::Member)
|
311
|
+
expect(response.aggregated_at).to eq(member_attributes[:aggregated_at])
|
312
|
+
expect(response.connection_status).to eq(member_attributes[:connection_status])
|
313
|
+
expect(response.guid).to eq(member_attributes[:guid])
|
314
|
+
expect(response.id).to eq(member_attributes[:id])
|
315
|
+
expect(response.institution_code).to eq(member_attributes[:institution_code])
|
316
|
+
expect(response.is_being_aggregated).to eq(member_attributes[:is_being_aggregated])
|
317
|
+
expect(response.is_oauth).to eq(member_attributes[:is_oauth])
|
318
|
+
expect(response.metadata).to eq(member_attributes[:metadata])
|
319
|
+
expect(response.name).to eq(member_attributes[:name])
|
320
|
+
expect(response.oauth_window_uri).to eq(member_attributes[:oauth_window_uri])
|
321
|
+
expect(response.successfully_aggregated_at).to eq(member_attributes[:successfully_aggregated_at])
|
322
|
+
expect(response.user_guid).to eq(member_attributes[:user_guid])
|
323
|
+
end
|
324
|
+
|
325
|
+
it 'makes a client request with the expected params' do
|
326
|
+
expect(::MXPlatformRuby.client).to receive(:make_request).with(
|
327
|
+
{
|
328
|
+
endpoint: '/users/USR-fa7537f3-48aa-a683-a02a-b18940482f54/members/MBR-7c6f361b-e582-15b6-60c0-358f12466b4b/fetch_statements',
|
329
|
+
http_method: :post
|
330
|
+
}
|
331
|
+
)
|
332
|
+
described_class.fetch_statements_by_member(fetch_statements_by_member_options)
|
333
|
+
end
|
334
|
+
end
|
335
|
+
|
336
|
+
describe 'identify_member' do
|
337
|
+
let(:identify_member_response) { { 'member' => member_attributes } }
|
338
|
+
before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(identify_member_response) }
|
339
|
+
|
340
|
+
it 'returns member' do
|
341
|
+
response = described_class.identify_member
|
342
|
+
|
343
|
+
expect(response).to be_kind_of(::MXPlatformRuby::Member)
|
344
|
+
expect(response.aggregated_at).to eq(member_attributes[:aggregated_at])
|
345
|
+
expect(response.connection_status).to eq(member_attributes[:connection_status])
|
346
|
+
expect(response.guid).to eq(member_attributes[:guid])
|
347
|
+
expect(response.id).to eq(member_attributes[:id])
|
348
|
+
expect(response.institution_code).to eq(member_attributes[:institution_code])
|
349
|
+
expect(response.is_being_aggregated).to eq(member_attributes[:is_being_aggregated])
|
350
|
+
expect(response.is_oauth).to eq(member_attributes[:is_oauth])
|
351
|
+
expect(response.metadata).to eq(member_attributes[:metadata])
|
352
|
+
expect(response.name).to eq(member_attributes[:name])
|
353
|
+
expect(response.oauth_window_uri).to eq(member_attributes[:oauth_window_uri])
|
354
|
+
expect(response.successfully_aggregated_at).to eq(member_attributes[:successfully_aggregated_at])
|
355
|
+
expect(response.user_guid).to eq(member_attributes[:user_guid])
|
356
|
+
end
|
357
|
+
|
358
|
+
it 'makes a client request with the expected params' do
|
359
|
+
expect(::MXPlatformRuby.client).to receive(:make_request).with(
|
360
|
+
{
|
361
|
+
endpoint: '/users/USR-fa7537f3-48aa-a683-a02a-b18940482f54/members/MBR-7c6f361b-e582-15b6-60c0-358f12466b4b/identify',
|
362
|
+
http_method: :post
|
363
|
+
}
|
364
|
+
)
|
365
|
+
described_class.identify_member(identify_member_options)
|
366
|
+
end
|
367
|
+
end
|
368
|
+
|
369
|
+
context 'list_members endpoints' do
|
370
|
+
let(:list_members_response) do
|
371
|
+
{
|
372
|
+
'members' => [member_attributes],
|
373
|
+
'pagination' => pagination_attributes
|
374
|
+
}
|
375
|
+
end
|
376
|
+
|
377
|
+
before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(list_members_response) }
|
378
|
+
|
379
|
+
describe 'list_members' do
|
380
|
+
it 'returns a list of members' do
|
381
|
+
response = described_class.list_members
|
382
|
+
|
383
|
+
expect(response).to be_kind_of(::MXPlatformRuby::Page)
|
384
|
+
expect(response.first).to be_kind_of(::MXPlatformRuby::Member)
|
385
|
+
expect(response.first.aggregated_at).to eq(member_attributes[:aggregated_at])
|
386
|
+
expect(response.first.connection_status).to eq(member_attributes[:connection_status])
|
387
|
+
expect(response.first.guid).to eq(member_attributes[:guid])
|
388
|
+
expect(response.first.id).to eq(member_attributes[:id])
|
389
|
+
expect(response.first.institution_code).to eq(member_attributes[:institution_code])
|
390
|
+
expect(response.first.is_being_aggregated).to eq(member_attributes[:is_being_aggregated])
|
391
|
+
expect(response.first.is_oauth).to eq(member_attributes[:is_oauth])
|
392
|
+
expect(response.first.metadata).to eq(member_attributes[:metadata])
|
393
|
+
expect(response.first.name).to eq(member_attributes[:name])
|
394
|
+
expect(response.first.oauth_window_uri).to eq(member_attributes[:oauth_window_uri])
|
395
|
+
expect(response.first.successfully_aggregated_at).to eq(member_attributes[:successfully_aggregated_at])
|
396
|
+
expect(response.first.user_guid).to eq(member_attributes[:user_guid])
|
397
|
+
expect(response.length).to eq(1)
|
398
|
+
end
|
399
|
+
end
|
400
|
+
end
|
401
|
+
|
402
|
+
describe 'read_member' do
|
403
|
+
let(:read_member_response) { { 'member' => member_attributes } }
|
404
|
+
before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(read_member_response) }
|
405
|
+
|
406
|
+
it 'returns member' do
|
407
|
+
response = described_class.read_member
|
408
|
+
|
409
|
+
expect(response).to be_kind_of(::MXPlatformRuby::Member)
|
410
|
+
expect(response.aggregated_at).to eq(member_attributes[:aggregated_at])
|
411
|
+
expect(response.connection_status).to eq(member_attributes[:connection_status])
|
412
|
+
expect(response.guid).to eq(member_attributes[:guid])
|
413
|
+
expect(response.id).to eq(member_attributes[:id])
|
414
|
+
expect(response.institution_code).to eq(member_attributes[:institution_code])
|
415
|
+
expect(response.is_being_aggregated).to eq(member_attributes[:is_being_aggregated])
|
416
|
+
expect(response.is_oauth).to eq(member_attributes[:is_oauth])
|
417
|
+
expect(response.metadata).to eq(member_attributes[:metadata])
|
418
|
+
expect(response.name).to eq(member_attributes[:name])
|
419
|
+
expect(response.oauth_window_uri).to eq(member_attributes[:oauth_window_uri])
|
420
|
+
expect(response.successfully_aggregated_at).to eq(member_attributes[:successfully_aggregated_at])
|
421
|
+
expect(response.user_guid).to eq(member_attributes[:user_guid])
|
422
|
+
end
|
423
|
+
|
424
|
+
it 'makes a client request with the expected params' do
|
425
|
+
expect(::MXPlatformRuby.client).to receive(:make_request).with(
|
426
|
+
{
|
427
|
+
endpoint: '/users/USR-fa7537f3-48aa-a683-a02a-b18940482f54/members/MBR-7c6f361b-e582-15b6-60c0-358f12466b4b',
|
428
|
+
http_method: :get
|
429
|
+
}
|
430
|
+
)
|
431
|
+
described_class.read_member(read_member_options)
|
432
|
+
end
|
433
|
+
end
|
434
|
+
|
435
|
+
describe 'resume_aggregation' do
|
436
|
+
let(:resume_aggregation_response) { { 'member' => member_attributes } }
|
437
|
+
before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(resume_aggregation_response) }
|
438
|
+
|
439
|
+
it 'returns member' do
|
440
|
+
response = described_class.resume_aggregation
|
441
|
+
|
442
|
+
expect(response).to be_kind_of(::MXPlatformRuby::Member)
|
443
|
+
expect(response.aggregated_at).to eq(member_attributes[:aggregated_at])
|
444
|
+
expect(response.connection_status).to eq(member_attributes[:connection_status])
|
445
|
+
expect(response.guid).to eq(member_attributes[:guid])
|
446
|
+
expect(response.id).to eq(member_attributes[:id])
|
447
|
+
expect(response.institution_code).to eq(member_attributes[:institution_code])
|
448
|
+
expect(response.is_being_aggregated).to eq(member_attributes[:is_being_aggregated])
|
449
|
+
expect(response.is_oauth).to eq(member_attributes[:is_oauth])
|
450
|
+
expect(response.metadata).to eq(member_attributes[:metadata])
|
451
|
+
expect(response.name).to eq(member_attributes[:name])
|
452
|
+
expect(response.oauth_window_uri).to eq(member_attributes[:oauth_window_uri])
|
453
|
+
expect(response.successfully_aggregated_at).to eq(member_attributes[:successfully_aggregated_at])
|
454
|
+
expect(response.user_guid).to eq(member_attributes[:user_guid])
|
455
|
+
end
|
456
|
+
|
457
|
+
it 'makes a client request with the expected params' do
|
458
|
+
expect(::MXPlatformRuby.client).to receive(:make_request).with(
|
459
|
+
{
|
460
|
+
endpoint: '/users/USR-fa7537f3-48aa-a683-a02a-b18940482f54/members/MBR-7c6f361b-e582-15b6-60c0-358f12466b4b/resume',
|
461
|
+
http_method: :put,
|
462
|
+
request_body: {
|
463
|
+
member: {
|
464
|
+
challenges: [
|
465
|
+
{
|
466
|
+
guid: 'CRD-2378634-33ub5bhk54kjb',
|
467
|
+
value: 'user-entered-value'
|
468
|
+
}
|
469
|
+
]
|
470
|
+
}
|
471
|
+
}
|
472
|
+
}
|
473
|
+
)
|
474
|
+
described_class.resume_aggregation(resume_aggregation_options)
|
475
|
+
end
|
476
|
+
end
|
477
|
+
|
478
|
+
describe 'update_member' do
|
479
|
+
let(:update_member_response) { { 'member' => member_attributes } }
|
480
|
+
before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(update_member_response) }
|
481
|
+
|
482
|
+
it 'returns member' do
|
483
|
+
response = described_class.update_member
|
484
|
+
|
485
|
+
expect(response).to be_kind_of(::MXPlatformRuby::Member)
|
486
|
+
expect(response.aggregated_at).to eq(member_attributes[:aggregated_at])
|
487
|
+
expect(response.connection_status).to eq(member_attributes[:connection_status])
|
488
|
+
expect(response.guid).to eq(member_attributes[:guid])
|
489
|
+
expect(response.id).to eq(member_attributes[:id])
|
490
|
+
expect(response.institution_code).to eq(member_attributes[:institution_code])
|
491
|
+
expect(response.is_being_aggregated).to eq(member_attributes[:is_being_aggregated])
|
492
|
+
expect(response.is_oauth).to eq(member_attributes[:is_oauth])
|
493
|
+
expect(response.metadata).to eq(member_attributes[:metadata])
|
494
|
+
expect(response.name).to eq(member_attributes[:name])
|
495
|
+
expect(response.oauth_window_uri).to eq(member_attributes[:oauth_window_uri])
|
496
|
+
expect(response.successfully_aggregated_at).to eq(member_attributes[:successfully_aggregated_at])
|
497
|
+
expect(response.user_guid).to eq(member_attributes[:user_guid])
|
498
|
+
end
|
499
|
+
|
500
|
+
it 'makes a client request with the expected params' do
|
501
|
+
expect(::MXPlatformRuby.client).to receive(:make_request).with(
|
502
|
+
{
|
503
|
+
endpoint: '/users/USR-fa7537f3-48aa-a683-a02a-b18940482f54/members/MBR-7c6f361b-e582-15b6-60c0-358f12466b4b',
|
504
|
+
http_method: :put,
|
505
|
+
request_body: {
|
506
|
+
member: {
|
507
|
+
background_aggregation_is_disabled: false,
|
508
|
+
credentials: [
|
509
|
+
{
|
510
|
+
guid: 'CRD-27d0edb8-1d50-5b90-bcbc-be270ca42b9f',
|
511
|
+
value: 'password'
|
512
|
+
}
|
513
|
+
],
|
514
|
+
id: 'unique_id',
|
515
|
+
metadata: '\"credentials_last_refreshed_at\": \"2015-10-15\"',
|
516
|
+
skip_aggregation: false
|
517
|
+
}
|
518
|
+
}
|
519
|
+
}
|
520
|
+
)
|
521
|
+
described_class.update_member(update_member_options)
|
522
|
+
end
|
523
|
+
end
|
524
|
+
|
525
|
+
describe 'verify_member' do
|
526
|
+
let(:verify_member_response) { { 'member' => member_attributes } }
|
527
|
+
before { allow(::MXPlatformRuby.client).to receive(:make_request).and_return(verify_member_response) }
|
528
|
+
|
529
|
+
it 'returns member' do
|
530
|
+
response = described_class.verify_member
|
531
|
+
|
532
|
+
expect(response).to be_kind_of(::MXPlatformRuby::Member)
|
533
|
+
expect(response.aggregated_at).to eq(member_attributes[:aggregated_at])
|
534
|
+
expect(response.connection_status).to eq(member_attributes[:connection_status])
|
535
|
+
expect(response.guid).to eq(member_attributes[:guid])
|
536
|
+
expect(response.id).to eq(member_attributes[:id])
|
537
|
+
expect(response.institution_code).to eq(member_attributes[:institution_code])
|
538
|
+
expect(response.is_being_aggregated).to eq(member_attributes[:is_being_aggregated])
|
539
|
+
expect(response.is_oauth).to eq(member_attributes[:is_oauth])
|
540
|
+
expect(response.metadata).to eq(member_attributes[:metadata])
|
541
|
+
expect(response.name).to eq(member_attributes[:name])
|
542
|
+
expect(response.oauth_window_uri).to eq(member_attributes[:oauth_window_uri])
|
543
|
+
expect(response.successfully_aggregated_at).to eq(member_attributes[:successfully_aggregated_at])
|
544
|
+
expect(response.user_guid).to eq(member_attributes[:user_guid])
|
545
|
+
end
|
546
|
+
|
547
|
+
it 'makes a client request with the expected params' do
|
548
|
+
expect(::MXPlatformRuby.client).to receive(:make_request).with(
|
549
|
+
{
|
550
|
+
endpoint: '/users/USR-fa7537f3-48aa-a683-a02a-b18940482f54/members/MBR-7c6f361b-e582-15b6-60c0-358f12466b4b/verify',
|
551
|
+
http_method: :post
|
552
|
+
}
|
553
|
+
)
|
554
|
+
described_class.verify_member(verify_member_options)
|
555
|
+
end
|
556
|
+
end
|
557
|
+
end
|