finapps 2.2.5 → 2.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/finapps/rest/orders.rb +20 -17
- data/lib/finapps/version.rb +1 -1
- data/spec/rest/order_statuses_spec.rb +4 -2
- data/spec/rest/order_tokens_spec.rb +1 -1
- data/spec/rest/orders_spec.rb +15 -13
- data/spec/rest/user_institutions_forms_spec.rb +3 -1
- data/spec/rest/user_institutions_statuses_spec.rb +3 -1
- data/spec/support/fake_api.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5eea1024ec978abcab4190e471f049c2ffa58464
|
4
|
+
data.tar.gz: d2d6032dfbd8616f0b68e279572da536550bd09d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9411cc800f1ba4e7ac2032ac24928c6f828be674195330573cc36c46e98b7be155d9e69418d0cf6ebd68059ecd75a5e61d5b756484656f70cdce8785da8cf9cb
|
7
|
+
data.tar.gz: 0f54d4ffbf29334e37bd5e17e27efc25e567a1bf4b449b9703ea6269453084d7d00993a1e9d73dc35ed5d0133fd0fb04e4810bd96d7447d4e1b8a71f973a7bc8
|
data/lib/finapps/rest/orders.rb
CHANGED
@@ -23,11 +23,12 @@ module FinApps
|
|
23
23
|
# date - the date of the order
|
24
24
|
# status - the status of the order
|
25
25
|
# :asc - sort order true for asc false for desc
|
26
|
-
def list(params=nil) # params hash with optional keys [:page, :requested, :sort, :asc]
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
26
|
+
def list # (params=nil) # params hash with optional keys [:page, :requested, :sort, :asc]
|
27
|
+
super 'orders?page=1&requested=500&sort=-date'
|
28
|
+
# TODO: change to support https://github.com/finapps/api/blob/develop/misc/docs/iav.md#get-list-of-orders
|
29
|
+
# return super 'orders?page=1&requested=500&sort=-date' # if params.nil?
|
30
|
+
# raise FinAppsCore::InvalidArgumentsError.new 'Invalid argument: params' unless params.is_a? Hash
|
31
|
+
# super build_path(params)
|
31
32
|
end
|
32
33
|
|
33
34
|
def update(id, params)
|
@@ -42,18 +43,20 @@ module FinApps
|
|
42
43
|
super params, path
|
43
44
|
end
|
44
45
|
|
45
|
-
private
|
46
|
-
|
47
|
-
def build_path(p)
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
46
|
+
# private
|
47
|
+
#
|
48
|
+
# def build_path(p)
|
49
|
+
# # TODO: change to support https://github.com/finapps/api/blob/develop/misc/docs/iav.md#get-list-of-orders
|
50
|
+
#
|
51
|
+
# page = p[:page] || 1
|
52
|
+
# requested = p[:requested] || 100
|
53
|
+
# sort = p[:sort] || 'date'
|
54
|
+
# asc = p[:asc]
|
55
|
+
# end_point = 'orders'
|
56
|
+
# path = end_point.dup
|
57
|
+
# [page, requested, sort, asc].each_with_index {|a| path << "/#{ERB::Util.url_encode(a)}" }
|
58
|
+
# path
|
59
|
+
# end
|
57
60
|
end
|
58
61
|
end
|
59
62
|
end
|
data/lib/finapps/version.rb
CHANGED
@@ -4,7 +4,7 @@ RSpec.describe FinApps::REST::OrderStatuses do
|
|
4
4
|
|
5
5
|
RESULTS = 0
|
6
6
|
ERROR_MESSAGES = 1
|
7
|
-
|
7
|
+
|
8
8
|
describe '#show' do
|
9
9
|
context 'when missing id' do
|
10
10
|
subject { FinApps::REST::OrderStatuses.new(client).show(nil) }
|
@@ -24,7 +24,9 @@ RSpec.describe FinApps::REST::OrderStatuses do
|
|
24
24
|
|
25
25
|
it { expect { subject }.not_to raise_error }
|
26
26
|
it('results is nil') { expect(subject[RESULTS]).to be_nil }
|
27
|
-
it('error messages array is populated')
|
27
|
+
it('error messages array is populated') do
|
28
|
+
expect(subject[ERROR_MESSAGES].first.downcase).to eq('resource not found')
|
29
|
+
end
|
28
30
|
end
|
29
31
|
end
|
30
32
|
end
|
data/spec/rest/orders_spec.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
RSpec.describe FinApps::REST::Orders do
|
3
3
|
include SpecHelpers::Client
|
4
|
-
|
4
|
+
|
5
5
|
RESULTS = 0
|
6
6
|
ERROR_MESSAGES = 1
|
7
7
|
|
@@ -49,7 +49,9 @@ RSpec.describe FinApps::REST::Orders do
|
|
49
49
|
|
50
50
|
it { expect { subject }.not_to raise_error }
|
51
51
|
it('results is nil') { expect(subject[RESULTS]).to be_nil }
|
52
|
-
it('error messages array is populated')
|
52
|
+
it('error messages array is populated') do
|
53
|
+
expect(subject[ERROR_MESSAGES].first.downcase).to eq('invalid request body')
|
54
|
+
end
|
53
55
|
end
|
54
56
|
end
|
55
57
|
|
@@ -57,7 +59,7 @@ RSpec.describe FinApps::REST::Orders do
|
|
57
59
|
context 'when missing params' do
|
58
60
|
# use defaults
|
59
61
|
|
60
|
-
subject { FinApps::REST::Orders.new(client).list
|
62
|
+
subject { FinApps::REST::Orders.new(client).list }
|
61
63
|
it { expect { subject }.not_to raise_error }
|
62
64
|
|
63
65
|
it('returns an array') { expect(subject).to be_a(Array) }
|
@@ -65,16 +67,16 @@ RSpec.describe FinApps::REST::Orders do
|
|
65
67
|
it('returns no error messages') { expect(subject[ERROR_MESSAGES]).to be_empty }
|
66
68
|
end
|
67
69
|
|
68
|
-
context 'when including partial params' do
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
end
|
70
|
+
# context 'when including partial params' do
|
71
|
+
# subject { FinApps::REST::Orders.new(client).list(params) }
|
72
|
+
# let(:params) { {page: 2, sort: 'status'} }
|
73
|
+
#
|
74
|
+
# it { expect { subject }.not_to raise_error }
|
75
|
+
# it('returns an array') { expect(subject).to be_a(Array) }
|
76
|
+
# it('performs a get and returns the response') { expect(subject[RESULTS]).to respond_to(:orders) }
|
77
|
+
# it('each order contains a consumer_id') { expect(subject[RESULTS].orders).to all(respond_to(:consumer_id)) }
|
78
|
+
# it('returns no error messages') { expect(subject[ERROR_MESSAGES]).to be_empty }
|
79
|
+
# end
|
78
80
|
end
|
79
81
|
|
80
82
|
describe '#update' do
|
@@ -26,7 +26,9 @@ RSpec.describe FinApps::REST::UserInstitutionsForms do
|
|
26
26
|
|
27
27
|
it { expect { subject }.not_to raise_error }
|
28
28
|
it('results is nil') { expect(subject[RESULT]).to be_nil }
|
29
|
-
it('error messages array is populated')
|
29
|
+
it('error messages array is populated') do
|
30
|
+
expect(subject[ERROR_MESSAGES].first.downcase).to eq('invalid institution id')
|
31
|
+
end
|
30
32
|
end
|
31
33
|
end
|
32
34
|
end
|
@@ -27,7 +27,9 @@ RSpec.describe FinApps::REST::UserInstitutionsStatuses do
|
|
27
27
|
|
28
28
|
it { expect { subject }.not_to raise_error }
|
29
29
|
it('results is nil') { expect(subject[RESULT]).to be_nil }
|
30
|
-
it('error messages array is populated')
|
30
|
+
it('error messages array is populated') do
|
31
|
+
expect(subject[ERROR_MESSAGES].first.downcase).to eq('invalid user institution id')
|
32
|
+
end
|
31
33
|
end
|
32
34
|
end
|
33
35
|
|
data/spec/support/fake_api.rb
CHANGED
@@ -17,7 +17,7 @@ class FakeApi < Sinatra::Base
|
|
17
17
|
post('/v2/orders/valid_token') { json_response 200, 'order_token.json' }
|
18
18
|
post('/v2/orders/invalid_token') { json_response 404, 'resource_not_found.json' }
|
19
19
|
get('/v2/orders/valid_id') { json_response 200, 'order.json' }
|
20
|
-
get('/v2/
|
20
|
+
get('/v2/orders') { json_response 200, 'orders.json' }
|
21
21
|
get('/v2/orders/valid_id/report.:format') { json_response 200, 'order_report.json' }
|
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' }
|