yodlee_wrap 0.0.0 → 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.
data/spec/spec_helper.rb CHANGED
@@ -6,17 +6,15 @@ end
6
6
  unless defined?(SPEC_HELPER_LOADED)
7
7
  SPEC_HELPER_LOADED = true
8
8
 
9
- require "yodleeicious"
9
+ require "yodlee_wrap"
10
10
  require 'dotenv'
11
11
  Dotenv.load
12
12
 
13
- Yodleeicious::Config.logger = Logger.new("log/test.log")
14
- Yodleeicious::Config.logger.level = Logger::DEBUG
13
+ YodleeWrap::Config.logger = Logger.new("log/test.log")
14
+ YodleeWrap::Config.logger.level = Logger::DEBUG
15
15
 
16
16
  RSpec.configure do |config|
17
-
18
17
  config.filter_run :focus
19
18
  config.run_all_when_everything_filtered = true
20
-
21
19
  end
22
- end
20
+ end
@@ -0,0 +1,34 @@
1
+ require "spec_helper"
2
+ require "yodlee_wrap/config"
3
+
4
+ describe YodleeWrap::Config do
5
+ describe "#base_url=" do
6
+ it "can set value" do
7
+ YodleeWrap::Config.cobranded_username = 'some_username'
8
+ expect(YodleeWrap::Config.cobranded_username).to eq('some_username')
9
+ end
10
+ end
11
+
12
+ describe "#cobranded_password=" do
13
+ it "can set value" do
14
+ YodleeWrap::Config.cobranded_password = 'some password'
15
+ expect(YodleeWrap::Config.cobranded_password).to eq('some password')
16
+ end
17
+ end
18
+
19
+ describe "#proxy_url=" do
20
+ it "can set value" do
21
+ YodleeWrap::Config.webhook_endpoint = 'http://someurl'
22
+ expect(YodleeWrap::Config.webhook_endpoint).to eq('http://someurl')
23
+ end
24
+ end
25
+
26
+ describe "#logger="do
27
+ let(:logger) { Logger.new(STDOUT) }
28
+ it "can set value" do
29
+ YodleeWrap::Config.logger = logger
30
+ expect(YodleeWrap::Config.logger).to eq(logger)
31
+ end
32
+ end
33
+
34
+ end
@@ -0,0 +1,49 @@
1
+ require "yodlee_wrap"
2
+
3
+ describe YodleeWrap::Response do
4
+ let(:error_response) {
5
+ {
6
+ "errorCode"=>"Y402",
7
+ "errorMessage"=>"Something went wrong here.",
8
+ "referenceCode"=>"_3932d208-345a-400f-a273-83619b8b548b"
9
+ }
10
+ }
11
+
12
+ let(:success_hash_response) {
13
+ {}
14
+ }
15
+
16
+ let(:success_array_response) {
17
+ [{}]
18
+ }
19
+
20
+ context 'you can access the error_code and error_message when it exists' do
21
+ subject { YodleeWrap::Response.new error_response, 400 }
22
+ it { is_expected.not_to be_success }
23
+ it { is_expected.to be_fail }
24
+ it "is expected to return the errorMessage provided by yodlee" do
25
+ expect(subject.error_message).to eq(error_response['errorMessage'])
26
+ end
27
+ it "also makes the status accessible" do
28
+ expect(subject.status).to eq 400
29
+ end
30
+ end
31
+
32
+ context 'When operation is a success and returns hash' do
33
+ subject { YodleeWrap::Response.new(success_hash_response, 200) }
34
+ it { is_expected.to be_success }
35
+ it { is_expected.not_to be_fail }
36
+ it 'is expected to return nil for error' do
37
+ expect(subject.error_code).to be_nil
38
+ end
39
+ end
40
+
41
+ context 'When operation is a success and return array' do
42
+ subject { YodleeWrap::Response.new(success_array_response, 200) }
43
+ it { is_expected.to be_success }
44
+ it { is_expected.not_to be_fail }
45
+ it 'is expected to return nil for error' do
46
+ expect(subject.error_code).to be_nil
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,265 @@
1
+ require "yodlee_wrap"
2
+ require "yodlee_wrap/config"
3
+
4
+ describe YodleeWrap::YodleeApi do
5
+
6
+ context 'Given a new uninitialized YodleeApi object' do
7
+ before {
8
+ YodleeWrap::Config.cobranded_username=nil
9
+ YodleeWrap::Config.cobranded_password=nil
10
+ }
11
+ subject { YodleeWrap::YodleeApi.new }
12
+
13
+ it 'should return nil for cobranded_auth' do
14
+ expect(subject.cobranded_auth).to be_nil
15
+ end
16
+
17
+ it 'should return nil for user_auth' do
18
+ expect(subject.user_auth).to be_nil
19
+ end
20
+
21
+ it 'should return nil for session_token' do
22
+ expect(subject.cobranded_session_token).to be_nil
23
+ end
24
+
25
+ it 'should return nil for user_session_token' do
26
+ expect(subject.user_session_token).to be_nil
27
+ end
28
+ end
29
+
30
+ context 'Given a Yodleeicious::Config with nil configuration' do
31
+ context 'When a new YodleeApi instance is created with no configuration' do
32
+ before {
33
+ YodleeWrap::Config.cobranded_username = nil
34
+ YodleeWrap::Config.cobranded_password = nil
35
+ YodleeWrap::Config.webhook_endpoint = nil
36
+ }
37
+ subject { YodleeWrap::YodleeApi.new }
38
+
39
+ it 'no cobranded_username is set' do
40
+ expect(subject.cobranded_username).to be_nil
41
+ end
42
+
43
+ it 'no cobranded_password is set' do
44
+ expect(subject.cobranded_password).to be_nil
45
+ end
46
+
47
+ it 'no websocket_endpoint is set' do
48
+ expect(subject.webhook_endpoint).to be_nil
49
+ end
50
+
51
+ end
52
+ end
53
+
54
+ context 'Given a Yodleeicious::Config with a configuration' do
55
+ context 'When a new YodleeApi instance is created with the global configuration set' do
56
+ before {
57
+ YodleeWrap::Config.cobranded_username='user name'
58
+ YodleeWrap::Config.cobranded_password='password'
59
+ YodleeWrap::Config.webhook_endpoint='something_something'
60
+ }
61
+ subject { YodleeWrap::YodleeApi.new }
62
+
63
+ it 'cobranded_username is set' do
64
+ expect(subject.cobranded_username).to eq('user name')
65
+ end
66
+
67
+ it 'cobranded_password is set' do
68
+ expect(subject.cobranded_password).to eq('password')
69
+ end
70
+
71
+ it 'webhook_endpoint is set' do
72
+ expect(subject.webhook_endpoint).to eq('something_something')
73
+ end
74
+ end
75
+ end
76
+
77
+ context 'Given a Yodleeicious::Config with nil configuration' do
78
+ context 'When a new YodleeApi instance is created and provided a configuration' do
79
+ before {
80
+ YodleeWrap::Config.cobranded_username = nil
81
+ YodleeWrap::Config.cobranded_password = nil
82
+ YodleeWrap::Config.webhook_endpoint = nil
83
+ }
84
+ let(:config) {
85
+ {
86
+ cobranded_username: "some_username",
87
+ cobranded_password: "some_password",
88
+ webhook_endpoint: "something/something"
89
+ }
90
+ }
91
+
92
+ subject { YodleeWrap::YodleeApi.new(config) }
93
+
94
+ it 'the provided cobranded_username is set' do
95
+ expect(subject.cobranded_username).to eq(config[:cobranded_username])
96
+ end
97
+
98
+ it 'the provided cobranded_password is set' do
99
+ expect(subject.cobranded_password).to eq(config[:cobranded_password])
100
+ end
101
+
102
+ it 'the provided proxy_url is set' do
103
+ expect(subject.webhook_endpoint).to eq(config[:webhook_endpoint])
104
+ end
105
+ end
106
+ end
107
+
108
+ context 'Given a Yodleeicious::Config with set config values' do
109
+ context 'When a new YodleeApi instance is created and provided a configuration' do
110
+ before {
111
+ YodleeWrap::Config.cobranded_username = 'user name'
112
+ YodleeWrap::Config.cobranded_password = 'password'
113
+ YodleeWrap::Config.webhook_endpoint = 'socks5h://somehostname'
114
+ }
115
+ let(:config) {
116
+ {
117
+ cobranded_username: "some_username",
118
+ cobranded_password: "some_password",
119
+ webhook_endpoint: "socks5h://127.0.0.1:1080"
120
+ }
121
+ }
122
+
123
+ subject { YodleeWrap::YodleeApi.new(config) }
124
+
125
+
126
+ it 'the provided cobranded_username is set' do
127
+ expect(subject.cobranded_username).to eq(config[:cobranded_username])
128
+ end
129
+
130
+ it 'the provided cobranded_password is set' do
131
+ expect(subject.cobranded_password).to eq(config[:cobranded_password])
132
+ end
133
+
134
+ it 'the provided proxy_url is set' do
135
+ expect(subject.webhook_endpoint).to eq(config[:webhook_endpoint])
136
+ end
137
+ end
138
+ end
139
+
140
+ context 'Given a Yodleeicious::Config with nil config values' do
141
+ context 'When a new YodleeApi instance is configured with no proxy_url' do
142
+ before {
143
+ YodleeWrap::Config.cobranded_username=nil
144
+ YodleeWrap::Config.cobranded_password=nil
145
+ YodleeWrap::Config.webhook_endpoint = nil
146
+ }
147
+ let(:config) {
148
+ {
149
+ cobranded_username: "some_username",
150
+ cobranded_password: "some_password"
151
+ }
152
+ }
153
+
154
+ subject { YodleeWrap::YodleeApi.new(config) }
155
+
156
+ it 'no webhook_endpoint is set' do
157
+ expect(subject.webhook_endpoint).to be_nil
158
+ end
159
+ end
160
+ end
161
+
162
+ # describe '#should_retry_get_mfa_response?' do
163
+ # let (:api) { YodleeWrap::YodleeApi.new }
164
+ # let (:response) { instance_double("YodleeWrap::Response") }
165
+ #
166
+ # context 'Given get mfa response has failed' do
167
+ # before { allow(response).to receive(:success?).and_return(false) }
168
+ # before { allow(response).to receive(:body).and_return({}) }
169
+ # subject { api.should_retry_get_mfa_response?(response,0,1) }
170
+ # it { is_expected.to be_falsy }
171
+ # end
172
+ #
173
+ # context 'Given get mfa response is success' do
174
+ # before { allow(response).to receive(:success?).and_return(true) }
175
+ #
176
+ # context 'Given an error code is returned' do
177
+ # before { allow(response).to receive(:body).and_return({ 'errorCode' => 100 }) }
178
+ # subject { api.should_retry_get_mfa_response?(response,0,1) }
179
+ # it { is_expected.to be_falsy }
180
+ # end
181
+ #
182
+ # context 'Given no error code is returned' do
183
+ # context 'Given the MFA message is available' do
184
+ # before { allow(response).to receive(:body).and_return({ 'isMessageAvailable' => true }) }
185
+ # subject { api.should_retry_get_mfa_response?(response,0,1) }
186
+ # it { is_expected.to be_falsy }
187
+ # end
188
+ #
189
+ # context 'Given the MFA message is not available' do
190
+ # before { allow(response).to receive(:body).and_return({ 'isMessageAvailable' => false }) }
191
+ # context 'Given all the trys have been used up' do
192
+ # subject { api.should_retry_get_mfa_response?(response,1,1) }
193
+ # it { is_expected.to be_falsy }
194
+ # end
195
+ #
196
+ # context 'Given the trys have not been used up' do
197
+ # subject { api.should_retry_get_mfa_response?(response,0,2) }
198
+ # it { is_expected.to be_truthy }
199
+ # end
200
+ # end
201
+ # end
202
+ # end
203
+ # end
204
+
205
+ # describe '#should_retry_get_site_refresh_info' do
206
+ # let (:api) { YodleeWrap::YodleeApi.new }
207
+ # let (:response) { double("response") }
208
+ #
209
+ # context 'Given get mfa response has failed' do
210
+ # before { allow(response).to receive(:success?).and_return(false) }
211
+ # subject { api.should_retry_get_site_refresh_info?(response,0,1) }
212
+ # it { is_expected.to be_falsy }
213
+ # end
214
+ #
215
+ # context 'Given get mfa response is success' do
216
+ # before { allow(response).to receive(:success?).and_return(true) }
217
+ #
218
+ # context 'Given an code 801 is returned' do
219
+ # before { allow(response).to receive(:body).and_return({ 'code' => 801 }) }
220
+ # subject { api.should_retry_get_site_refresh_info?(response,0,1) }
221
+ # it { is_expected.to be_truthy }
222
+ # end
223
+ #
224
+ # context 'Given not 801 and not 0 code is returned' do
225
+ # before { allow(response).to receive(:body).and_return({ 'code' => 5 }) }
226
+ # subject { api.should_retry_get_site_refresh_info?(response,0,1) }
227
+ # it { is_expected.to be_falsy }
228
+ # end
229
+ #
230
+ # context 'Given a code 0 is returned' do
231
+ # context 'Given a siteRefreshStatus of REFRESH_COMPLETED' do
232
+ # before { allow(response).to receive(:body).and_return({ 'code' => 0, "siteRefreshStatus" => { "siteRefreshStatus" => "REFRESH_COMPLETED" }}) }
233
+ # subject { api.should_retry_get_site_refresh_info?(response,0,1) }
234
+ # it { is_expected.to be_falsy }
235
+ # end
236
+ #
237
+ # context 'Given a siteRefreshStatus of REFRESH_TIMED_OUT' do
238
+ # before { allow(response).to receive(:body).and_return({ 'code' => 0, "siteRefreshStatus" => { "siteRefreshStatus" => "REFRESH_TIMED_OUT" }}) }
239
+ # subject { api.should_retry_get_site_refresh_info?(response,0,1) }
240
+ # it { is_expected.to be_falsy }
241
+ # end
242
+ #
243
+ # context 'Given a siteRefreshStatus of LOGIN_SUCCESS' do
244
+ # before { allow(response).to receive(:body).and_return({ 'code' => 0, "siteRefreshStatus" => { "siteRefreshStatus" => "LOGIN_SUCCESS" }}) }
245
+ # subject { api.should_retry_get_site_refresh_info?(response,0,1) }
246
+ # it { is_expected.to be_falsy }
247
+ # end
248
+ #
249
+ # context 'Given a siteRefreshStatus of REFRESH_TRIGGERED' do
250
+ # before { allow(response).to receive(:body).and_return({ 'code' => 0, "siteRefreshStatus" => { "siteRefreshStatus" => "REFRESH_TRIGGERED" }}) }
251
+ # subject { api.should_retry_get_site_refresh_info?(response,0,1) }
252
+ # it { is_expected.to be_truthy }
253
+ # end
254
+ #
255
+ # context 'Given a siteRefreshStatus of REFRESH_TRIGGERED' do
256
+ # before { allow(response).to receive(:body).and_return({ 'code' => 0, "siteRefreshStatus" => { "siteRefreshStatus" => "REFRESH_TRIGGERED" }}) }
257
+ # context 'Given trys have been used up' do
258
+ # subject { api.should_retry_get_site_refresh_info?(response,1,1) }
259
+ # it { is_expected.to be_falsy }
260
+ # end
261
+ # end
262
+ # end
263
+ # end
264
+ # end
265
+ end
@@ -1,65 +1,52 @@
1
1
  require "spec_helper"
2
- require "yodleeicious/config"
2
+ require "yodlee_wrap/config"
3
3
 
4
- describe Yodleeicious::Config do
5
- describe "#base_url" do
6
- it "default value is nil" do
7
- Yodleeicious::Config.base_url = nil
8
- end
9
- end
4
+ describe YodleeWrap::Config do
10
5
 
11
6
  describe "#cobranded_username" do
12
7
  it "default value is nil" do
13
- Yodleeicious::Config.cobranded_username = nil
8
+ expect(YodleeWrap::Config.cobranded_username).to eq nil
14
9
  end
15
10
  end
16
11
 
17
12
  describe "#cobranded_password" do
18
13
  it "default value is nil" do
19
- Yodleeicious::Config.cobranded_password = nil
14
+ expect(YodleeWrap::Config.cobranded_password).to eq nil
20
15
  end
21
16
  end
22
17
 
23
- describe "#proxy_url" do
24
- it "default value is nil" do
25
- Yodleeicious::Config.proxy_url = nil
18
+ describe "#webhook_endpoint" do
19
+ it 'default value is nil' do
20
+ expect(YodleeWrap::Config.webhook_endpoint).to eq nil
26
21
  end
27
22
  end
28
23
 
29
24
  describe "#base_url=" do
30
25
  it "can set value" do
31
- Yodleeicious::Config.base_url = 'http://someurl'
32
- expect(Yodleeicious::Config.base_url).to eq('http://someurl')
33
- end
34
- end
35
-
36
- describe "#cobranded_username=" do
37
- it "can set value" do
38
- Yodleeicious::Config.cobranded_username = 'some username'
39
- expect(Yodleeicious::Config.cobranded_username).to eq('some username')
26
+ YodleeWrap::Config.cobranded_username = 'some_username'
27
+ expect(YodleeWrap::Config.cobranded_username).to eq('some_username')
40
28
  end
41
29
  end
42
30
 
43
31
  describe "#cobranded_password=" do
44
32
  it "can set value" do
45
- Yodleeicious::Config.cobranded_password = 'some password'
46
- expect(Yodleeicious::Config.cobranded_password).to eq('some password')
33
+ YodleeWrap::Config.cobranded_password = 'some password'
34
+ expect(YodleeWrap::Config.cobranded_password).to eq('some password')
47
35
  end
48
36
  end
49
37
 
50
38
  describe "#proxy_url=" do
51
39
  it "can set value" do
52
- Yodleeicious::Config.proxy_url = 'http://someurl'
53
- expect(Yodleeicious::Config.proxy_url).to eq('http://someurl')
40
+ YodleeWrap::Config.webhook_endpoint = 'http://someurl'
41
+ expect(YodleeWrap::Config.webhook_endpoint).to eq('http://someurl')
54
42
  end
55
43
  end
56
44
 
57
45
  describe "#logger="do
58
46
  let(:logger) { Logger.new(STDOUT) }
59
47
  it "can set value" do
60
- Yodleeicious::Config.logger = logger
61
- expect(Yodleeicious::Config.logger).to eq(logger)
48
+ YodleeWrap::Config.logger = logger
49
+ expect(YodleeWrap::Config.logger).to eq(logger)
62
50
  end
63
51
  end
64
-
65
52
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yodlee_wrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shannon Byrne
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-23 00:00:00.000000000 Z
11
+ date: 2016-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -109,17 +109,17 @@ files:
109
109
  - Rakefile
110
110
  - lib/yodlee_wrap.rb
111
111
  - lib/yodlee_wrap/config.rb
112
- - lib/yodlee_wrap/parameter_translator.rb
113
112
  - lib/yodlee_wrap/response.rb
114
113
  - lib/yodlee_wrap/version.rb
115
114
  - lib/yodlee_wrap/yodlee_api.rb
116
115
  - log/.gitkeep
116
+ - log/test.log
117
117
  - spec/integration/integration_spec.rb
118
118
  - spec/spec_helper.rb
119
+ - spec/unit/yodlee_wrap/config_spec.rb
120
+ - spec/unit/yodlee_wrap/response_spec.rb
121
+ - spec/unit/yodlee_wrap/yodlee_api_spec.rb
119
122
  - spec/unit/yodleeicious/config_spec.rb
120
- - spec/unit/yodleeicious/parameter_translator_spec.rb
121
- - spec/unit/yodleeicious/response_spec.rb
122
- - spec/unit/yodleeicious/yodlee_api_spec.rb
123
123
  - todo.md
124
124
  - yodlee_wrap.gemspec
125
125
  - yodlicious.png
@@ -150,7 +150,7 @@ summary: Yodlee API Client Gem for 2016 developer.yodlee gem
150
150
  test_files:
151
151
  - spec/integration/integration_spec.rb
152
152
  - spec/spec_helper.rb
153
+ - spec/unit/yodlee_wrap/config_spec.rb
154
+ - spec/unit/yodlee_wrap/response_spec.rb
155
+ - spec/unit/yodlee_wrap/yodlee_api_spec.rb
153
156
  - spec/unit/yodleeicious/config_spec.rb
154
- - spec/unit/yodleeicious/parameter_translator_spec.rb
155
- - spec/unit/yodleeicious/response_spec.rb
156
- - spec/unit/yodleeicious/yodlee_api_spec.rb
@@ -1,27 +0,0 @@
1
- module YodleeWrap
2
- class ParameterTranslator
3
- def site_login_form_to_add_site_account_params site_login_form
4
-
5
- params = { "credentialFields.enclosedType" => "com.yodlee.common.FieldInfoSingle" }
6
-
7
- i = 0
8
- site_login_form['componentList'].each { |field|
9
- # puts "field=#{field}"
10
- params["credentialFields[#{i}].displayName"] = field['displayName']
11
- params["credentialFields[#{i}].fieldType.typeName"] = field['fieldType']['typeName']
12
- params["credentialFields[#{i}].helpText"] = field['helpText']
13
- params["credentialFields[#{i}].maxlength"] = field['maxlength']
14
- params["credentialFields[#{i}].name"] = field['name']
15
- params["credentialFields[#{i}].size"] = field['size']
16
- params["credentialFields[#{i}].value"] = field['value']
17
- params["credentialFields[#{i}].valueIdentifier"] = field['valueIdentifier']
18
- params["credentialFields[#{i}].valueMask"] = field['valueMask']
19
- params["credentialFields[#{i}].isEditable"] = field['isEditable']
20
- params["credentialFields[#{i}].value"] = field['fieldValue']
21
-
22
- i += 1
23
- }
24
- params
25
- end
26
- end
27
- end
@@ -1,80 +0,0 @@
1
- require "yodleeicious/parameter_translator"
2
-
3
- describe 'parameter translator' do
4
- subject { Yodleeicious::ParameterTranslator.new }
5
- context 'converting login params json to add site params' do
6
- let (:login_form) {
7
- {
8
- 'componentList' => [
9
- {
10
- 'valueIdentifier' => 'LOGIN',
11
- 'valueMask' => 'LOGIN_FIELD',
12
- 'fieldType' => {
13
- 'typeName' => 'IF_LOGIN'
14
- },
15
- 'size' => 20,
16
- 'maxlength' => 32,
17
- 'name' => 'LOGIN',
18
- 'displayName' => 'User ID',
19
- 'isEditable' => true,
20
- 'isOptional' => false,
21
- 'isEscaped' => false,
22
- 'helpText' => 4710,
23
- 'isOptionalMFA' => false,
24
- 'isMFA' => false,
25
- 'fieldValue' => 'kanyewest'
26
- },
27
- {
28
- 'valueIdentifier' => 'PASSWORD',
29
- 'valueMask' => 'LOGIN_FIELD',
30
- 'fieldType' => {
31
- 'typeName' => 'IF_PASSWORD'
32
- },
33
- 'size' => 20,
34
- 'maxlength' => 40,
35
- 'name' => 'PASSWORD',
36
- 'displayName' => 'Password',
37
- 'isEditable' => true,
38
- 'isOptional' => false,
39
- 'isEscaped' => false,
40
- 'helpText' => 11976,
41
- 'isOptionalMFA' => false,
42
- 'isMFA' => false,
43
- 'fieldValue' => 'iLoveTheGrammys'
44
- }
45
- ]
46
- }
47
- }
48
-
49
- let (:add_site_params) {
50
- {
51
- "credentialFields.enclosedType" => "com.yodlee.common.FieldInfoSingle",
52
- "credentialFields[0].displayName" => "User ID",
53
- "credentialFields[0].fieldType.typeName" => "IF_LOGIN",
54
- "credentialFields[0].helpText" => 4710,
55
- "credentialFields[0].maxlength" => 32,
56
- "credentialFields[0].name" => "LOGIN",
57
- "credentialFields[0].size" => 20,
58
- "credentialFields[0].value" => 'kanyewest',
59
- "credentialFields[0].valueIdentifier" => "LOGIN",
60
- "credentialFields[0].valueMask" => "LOGIN_FIELD",
61
- "credentialFields[0].isEditable" => true,
62
- "credentialFields[1].displayName" => "Password",
63
- "credentialFields[1].fieldType.typeName" => "IF_PASSWORD",
64
- "credentialFields[1].helpText" => 11976,
65
- "credentialFields[1].maxlength" => 40,
66
- "credentialFields[1].name" => "PASSWORD",
67
- "credentialFields[1].size" => 20,
68
- "credentialFields[1].value" => 'iLoveTheGrammys',
69
- "credentialFields[1].valueIdentifier" => "PASSWORD",
70
- "credentialFields[1].valueMask" => "LOGIN_FIELD",
71
- "credentialFields[1].isEditable" => true
72
- }
73
- }
74
-
75
- it "converts correctly to params hash" do
76
- expect(subject.site_login_form_to_add_site_account_params(login_form)).to be == add_site_params
77
- end
78
-
79
- end
80
- end
@@ -1,61 +0,0 @@
1
- require "yodleeicious"
2
-
3
- describe Yodleeicious::Response do
4
- let(:error_response_1) {
5
- {
6
- "errorOccurred"=>"true",
7
- "exceptionType"=>"com.yodlee.core.IllegalArgumentValueException",
8
- "referenceCode"=>"_3932d208-345a-400f-a273-83619b8b548b",
9
- "message"=>"Multiple exceptions encapsulated within: invoke getWrappedExceptions for details"
10
- }
11
- }
12
-
13
- let(:error_response_2) {
14
- { "Error" => [ {"errorDetail" => "Invalid User Credentials"} ] }
15
- }
16
-
17
- let(:success_hash_response) {
18
- {}
19
- }
20
-
21
- let(:success_array_response) {
22
- [{}]
23
- }
24
-
25
- context 'When the error_response is the errorOccured syntax' do
26
- subject { Yodleeicious::Response.new error_response_1 }
27
- it { is_expected.not_to be_success }
28
- it { is_expected.to be_fail }
29
- it "is expected to return error of InvalidArgumentValueException" do
30
- expect(subject.error).to eq('com.yodlee.core.IllegalArgumentValueException')
31
- end
32
- end
33
-
34
- context 'When the error_response is the Error : ["errorDetail"] syntax' do
35
- subject { Yodleeicious::Response.new error_response_2 }
36
- it { is_expected.not_to be_success }
37
- it { is_expected.to be_fail }
38
- it "is expected to return error of Invalid User Credentials" do
39
- expect(subject.error).to eq('Invalid User Credentials')
40
- end
41
- end
42
-
43
- context 'When operation is a success and returns hash' do
44
- subject { Yodleeicious::Response.new success_hash_response }
45
- it { is_expected.to be_success }
46
- it { is_expected.not_to be_fail }
47
- it 'is expected to return nil for error' do
48
- expect(subject.error).to be_nil
49
- end
50
- end
51
-
52
- context 'When operation is a success and return array' do
53
- subject { Yodleeicious::Response.new success_array_response }
54
- it { is_expected.to be_success }
55
- it { is_expected.not_to be_fail }
56
- it 'is expected to return nil for error' do
57
- expect(subject.error).to be_nil
58
- end
59
- end
60
-
61
- end