finapps 2.2.17 → 2.2.18

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2060081ac7ed6cd7f597e3b6e2319d5132245e47
4
- data.tar.gz: 4085a14172157f3474b7499ed6ce5f550ac05dd8
3
+ metadata.gz: c589e3db135efac7608182b06253c4486ffb2d41
4
+ data.tar.gz: 9dda7d435559e4331224a543bfb65311edd34294
5
5
  SHA512:
6
- metadata.gz: 45af42879afbbc05f45b4d40f205cbf7c8ef8bac952cc9c924011b283cf3aebacd07413d36779ba0c76f4687ab6c17af7aef516ac15651b745bf49d14df74328
7
- data.tar.gz: 6d3a2a5eff6ff4c3f744eaead1966ab1ad12a66eeef019ffd13cee59b0bc2ae94389fa40052191ce0d5947fb6457ba153e356f8553e32bdcbca4672edd35157d
6
+ metadata.gz: 3b76819e08295bd3960a7a16e3b98bd598f10610eeabb891d52d2fdf81ba4a533a55756ee29bf4170abf3eda7d21dfea5de50f0d28d0d7f263ff69319223e822
7
+ data.tar.gz: 55d096c4eaf472daa1440cfd8fe8b44500452c1a6a998a5a98d3ffcc5c8c375ca1115360a0e1cd98bc4d253285efb6e69175f8d873ac6f9b189fd40834bd87d3
data/lib/finapps.rb CHANGED
@@ -20,6 +20,7 @@ require 'finapps/rest/user_institutions'
20
20
  require 'finapps/rest/user_institutions_forms'
21
21
  require 'finapps/rest/order_reports'
22
22
  require 'finapps/rest/order_statuses'
23
+ require 'finapps/rest/order_notifications'
23
24
  require 'finapps/rest/password_resets'
24
25
  require 'finapps/rest/operators'
25
26
  require 'finapps/rest/operators_password_resets'
@@ -9,6 +9,7 @@ module FinApps
9
9
  institutions
10
10
  institutions_forms
11
11
  orders
12
+ order_notifications
12
13
  order_reports
13
14
  order_statuses
14
15
  order_tokens
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+ module FinApps
3
+ module REST
4
+ class OrderNotifications < FinAppsCore::REST::Resources
5
+ def update(id)
6
+ not_blank(id, :id)
7
+
8
+ path = "orders/#{ERB::Util.url_encode(id)}/notify"
9
+ super nil, path
10
+ end
11
+ end
12
+ end
13
+ end
@@ -28,7 +28,8 @@ module FinApps
28
28
  super build_query_path(end_point, params)
29
29
  end
30
30
 
31
- def update(id, params)
31
+ def update(id, params, path=nil)
32
+ return super nil, path if path
32
33
  not_blank(id, :id)
33
34
  not_blank(params, :params)
34
35
  # Params array need matching Institution ids & Account ids
@@ -39,6 +40,13 @@ module FinApps
39
40
 
40
41
  super params, path
41
42
  end
43
+
44
+ def destroy(id)
45
+ not_blank(id, :id)
46
+
47
+ path = "#{end_point}/#{ERB::Util.url_encode(id)}/cancel"
48
+ update nil, nil, path
49
+ end
42
50
  end
43
51
  end
44
52
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module FinApps
3
- VERSION = '2.2.17'
3
+ VERSION = '2.2.18'
4
4
  end
@@ -27,6 +27,10 @@ RSpec.describe FinApps::REST::Client do
27
27
  it { expect(subject.sessions).to be_an_instance_of(FinApps::REST::Sessions) }
28
28
  end
29
29
 
30
+ describe '#order_statuses' do
31
+ it { expect(subject.order_notifications).to be_an_instance_of(FinApps::REST::OrderNotifications) }
32
+ end
33
+
30
34
  describe '#order_statuses' do
31
35
  it { expect(subject.order_statuses).to be_an_instance_of(FinApps::REST::OrderStatuses) }
32
36
  end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+ require 'spec_helpers/client'
3
+
4
+ RSpec.describe FinApps::REST::OrderNotifications do
5
+ include SpecHelpers::Client
6
+
7
+ describe '#update' do
8
+ subject(:orders) { FinApps::REST::OrderNotifications.new(client) }
9
+
10
+ context 'when missing id' do
11
+ let(:update) { subject.update(nil) }
12
+ it('returns missing argument error') { expect { update }.to raise_error(FinAppsCore::MissingArgumentsError) }
13
+ end
14
+
15
+ context 'when invalid id is provided' do
16
+ let(:update) { subject.update(:invalid_id) }
17
+ let(:results) { update[RESULTS] }
18
+ let(:error_messages) { update[ERROR_MESSAGES] }
19
+
20
+ it { expect { update }.not_to raise_error }
21
+ it('results is nil') { expect(results).to be_nil }
22
+ it('error messages array is populated') { expect(error_messages.first.downcase).to eq('resource not found') }
23
+ end
24
+
25
+ context 'for valid id' do
26
+ let(:update) { subject.update(:valid_id) }
27
+ let(:results) { update[RESULTS] }
28
+ let(:error_messages) { update[ERROR_MESSAGES] }
29
+
30
+ it { expect { update }.not_to raise_error }
31
+ it('results is nil') { expect(results).to be_nil }
32
+ it('error_messages array is empty') { expect(error_messages).to eq([]) }
33
+ end
34
+ end
35
+ end
@@ -133,4 +133,33 @@ RSpec.describe FinApps::REST::Orders do
133
133
  it('error messages array is populated') { expect(error_messages.first.downcase).to eq('invalid request body') }
134
134
  end
135
135
  end
136
+
137
+ describe '#destroy' do
138
+ subject(:orders) { FinApps::REST::Orders.new(client) }
139
+
140
+ context 'when missing id' do
141
+ let(:destroy) { subject.destroy(nil) }
142
+ it('returns missing argument error') { expect { destroy }.to raise_error(FinAppsCore::MissingArgumentsError) }
143
+ end
144
+
145
+ context 'when invalid id is provided' do
146
+ let(:destroy) { subject.destroy(:invalid_id) }
147
+ let(:results) { destroy[RESULTS] }
148
+ let(:error_messages) { destroy[ERROR_MESSAGES] }
149
+
150
+ it { expect { destroy }.not_to raise_error }
151
+ it('results is nil') { expect(results).to be_nil }
152
+ it('error messages array is populated') { expect(error_messages.first.downcase).to eq('resource not found') }
153
+ end
154
+
155
+ context 'for valid id' do
156
+ let(:destroy) { subject.destroy(:valid_id) }
157
+ let(:results) { destroy[RESULTS] }
158
+ let(:error_messages) { destroy[ERROR_MESSAGES] }
159
+
160
+ it { expect { destroy }.not_to raise_error }
161
+ it('results is nil') { expect(results).to be_nil }
162
+ it('error_messages array is empty') { expect(error_messages).to eq([]) }
163
+ end
164
+ end
136
165
  end
@@ -22,6 +22,10 @@ class FakeApi < Sinatra::Base
22
22
  get('/v2/orders/invalid_id/report.:format') { json_response 404, 'resource_not_found.json' }
23
23
  get('/v2/orders/valid_id/status') { json_response 200, 'order_status.json' }
24
24
  get('/v2/orders/invalid_id/status') { json_response 404, 'resource_not_found.json' }
25
+ put('/v2/orders/valid_id/cancel') { status 204 }
26
+ put('/v2/orders/invalid_id/cancel') { json_response 404, 'resource_not_found.json' }
27
+ put('/v2/orders/valid_id/notify') { status 204 }
28
+ put('/v2/orders/invalid_id/notify') { json_response 404, 'resource_not_found.json' }
25
29
  put('/v2/orders/invalid_id') { json_response 404, 'resource_not_found.json' }
26
30
  put('/v2/orders/valid_id') do
27
31
  request.body.rewind
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.17
4
+ version: 2.2.18
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-05-22 00:00:00.000000000 Z
11
+ date: 2017-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: finapps_core
@@ -239,6 +239,7 @@ files:
239
239
  - lib/finapps/rest/institutions_forms.rb
240
240
  - lib/finapps/rest/operators.rb
241
241
  - lib/finapps/rest/operators_password_resets.rb
242
+ - lib/finapps/rest/order_notifications.rb
242
243
  - lib/finapps/rest/order_reports.rb
243
244
  - lib/finapps/rest/order_statuses.rb
244
245
  - lib/finapps/rest/order_tokens.rb
@@ -259,6 +260,7 @@ files:
259
260
  - spec/rest/institutions_spec.rb
260
261
  - spec/rest/operators_password_resets_spec.rb
261
262
  - spec/rest/operators_spec.rb
263
+ - spec/rest/order_notifications_spec.rb
262
264
  - spec/rest/order_reports_spec.rb
263
265
  - spec/rest/order_statuses_spec.rb
264
266
  - spec/rest/order_tokens_spec.rb
@@ -350,6 +352,7 @@ test_files:
350
352
  - spec/rest/order_reports_spec.rb
351
353
  - spec/rest/institutions_spec.rb
352
354
  - spec/rest/order_statuses_spec.rb
355
+ - spec/rest/order_notifications_spec.rb
353
356
  - spec/rest/sessions_spec.rb
354
357
  - spec/support/fake_api.rb
355
358
  - spec/utils/query_builder_spec.rb