finapps 5.0.43 → 5.0.44
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/documents_uploads.rb +8 -0
- data/lib/finapps/version.rb +1 -1
- data/spec/rest/documents_uploads_spec.rb +53 -0
- data/spec/rest/signed_documents_downloads_spec.rb +4 -7
- data/spec/rest/verix/verix_documents_spec.rb +4 -4
- data/spec/spec_helper.rb +1 -1
- data/spec/support/documents_uploads_routes.rb +39 -0
- data/spec/support/fake_api.rb +449 -456
- metadata +40 -38
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94ef2ce4cd675c162a8b7d7c932fd85235fd4f30f5553fd2f829f89768d35451
|
4
|
+
data.tar.gz: a3bc58dc9f244eb8300a2e49fd9e24a429bcaf3211fb4468686e3d8db14c5328
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a250e599314beab25f3bbd0d2d2781f9af75ff59ef28bc130a748456ae3bbef9516b70c51ee91c465bbc96b55d69f74f190c9a5b09ab3d703f6efb23d43a378
|
7
|
+
data.tar.gz: 759cbe18313cbaa105d9ea7439e962215a3c5be7a773c2662ee63dddb315adafcd8a52b3508eb05982dedf986642a9374972aad52638e875479cfc269b9171ba
|
@@ -18,6 +18,14 @@ module FinApps
|
|
18
18
|
not_blank(doc_id, :doc_id)
|
19
19
|
super(nil, "documents/orders/#{order_id}/#{doc_id}")
|
20
20
|
end
|
21
|
+
|
22
|
+
def destroy_by_consumer(consumer_id, document_id)
|
23
|
+
not_blank(consumer_id, :consumer_id)
|
24
|
+
not_blank(document_id, :document_id)
|
25
|
+
|
26
|
+
path = "consumers/#{consumer_id}/documents/#{document_id}"
|
27
|
+
send_request path, :delete
|
28
|
+
end
|
21
29
|
end
|
22
30
|
end
|
23
31
|
end
|
data/lib/finapps/version.rb
CHANGED
@@ -101,4 +101,57 @@ RSpec.describe FinApps::REST::DocumentsUploads do
|
|
101
101
|
end
|
102
102
|
end
|
103
103
|
end
|
104
|
+
|
105
|
+
describe '#destroy_by_consumer' do
|
106
|
+
subject(:destroy_by_consumer) do
|
107
|
+
described_class.new(client).destroy_by_consumer(consumer_id, document_id)
|
108
|
+
end
|
109
|
+
|
110
|
+
let(:results) { destroy_by_consumer[0] }
|
111
|
+
let(:error_messages) { destroy_by_consumer[1] }
|
112
|
+
|
113
|
+
context 'with valid params' do
|
114
|
+
let(:consumer_id) { :valid_consumer_id }
|
115
|
+
let(:document_id) { :valid_document_id }
|
116
|
+
|
117
|
+
it_behaves_like 'an API request'
|
118
|
+
it_behaves_like 'a successful request'
|
119
|
+
it('results is nil') { expect(results).to be_nil }
|
120
|
+
end
|
121
|
+
|
122
|
+
context 'with invalid consumer_id' do
|
123
|
+
let(:consumer_id) { :invalid_consumer_id }
|
124
|
+
let(:document_id) { :valid_document_id }
|
125
|
+
|
126
|
+
it_behaves_like 'an API request'
|
127
|
+
it('results is nil') { expect(results).to be_nil }
|
128
|
+
|
129
|
+
it('error messages array is populated') do
|
130
|
+
expect(error_messages.first.downcase).to eq('resource not found')
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
context 'with invalid document id' do
|
135
|
+
let(:consumer_id) { :valid_consumer_id }
|
136
|
+
let(:document_id) { :invalid_document_id }
|
137
|
+
|
138
|
+
it_behaves_like 'an API request'
|
139
|
+
it('results is nil') { expect(results).to be_nil }
|
140
|
+
|
141
|
+
it('error messages array is populated') do
|
142
|
+
expect(error_messages.first.downcase).to eq('resource not found')
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
context 'with missing id' do
|
147
|
+
let(:consumer_id) { nil }
|
148
|
+
let(:document_id) { nil }
|
149
|
+
|
150
|
+
it do
|
151
|
+
expect { destroy_by_consumer }.to raise_error(
|
152
|
+
FinAppsCore::MissingArgumentsError
|
153
|
+
)
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|
104
157
|
end
|
@@ -10,6 +10,10 @@ RSpec.describe FinApps::REST::SignedDocumentsDownloads do
|
|
10
10
|
let(:document) { described_class.new(api_client) }
|
11
11
|
|
12
12
|
describe '#show' do
|
13
|
+
subject(:show) do
|
14
|
+
document.show(:consumer_id, :signature_request_id)
|
15
|
+
end
|
16
|
+
|
13
17
|
context 'when missing signature request id' do
|
14
18
|
subject(:show) { document.show(:consumer_id, nil) }
|
15
19
|
|
@@ -26,13 +30,6 @@ RSpec.describe FinApps::REST::SignedDocumentsDownloads do
|
|
26
30
|
end
|
27
31
|
end
|
28
32
|
|
29
|
-
subject(:show) do
|
30
|
-
document.show(
|
31
|
-
:consumer_id,
|
32
|
-
:signature_request_id
|
33
|
-
)
|
34
|
-
end
|
35
|
-
|
36
33
|
it_behaves_like 'an API request'
|
37
34
|
it_behaves_like 'a successful request'
|
38
35
|
end
|
@@ -10,6 +10,8 @@ RSpec.describe FinApps::REST::VerixDocuments do
|
|
10
10
|
let(:document) { described_class.new(api_client) }
|
11
11
|
|
12
12
|
describe '#list' do
|
13
|
+
subject { document.list(:record_id) }
|
14
|
+
|
13
15
|
context 'when missing parameters' do
|
14
16
|
subject(:list) { document.list(nil) }
|
15
17
|
|
@@ -18,13 +20,13 @@ RSpec.describe FinApps::REST::VerixDocuments do
|
|
18
20
|
end
|
19
21
|
end
|
20
22
|
|
21
|
-
subject { document.list(:record_id) }
|
22
|
-
|
23
23
|
it_behaves_like 'an API request'
|
24
24
|
it_behaves_like 'a successful request'
|
25
25
|
end
|
26
26
|
|
27
27
|
describe '#show' do
|
28
|
+
subject { document.show(:record_id, :document_id) }
|
29
|
+
|
28
30
|
context 'when missing record_id' do
|
29
31
|
subject(:show) { document.show(nil, :document_id) }
|
30
32
|
|
@@ -37,8 +39,6 @@ RSpec.describe FinApps::REST::VerixDocuments do
|
|
37
39
|
it { expect { show }.to raise_error(FinAppsCore::MissingArgumentsError) }
|
38
40
|
end
|
39
41
|
|
40
|
-
subject { document.show(:record_id, :document_id) }
|
41
|
-
|
42
42
|
it_behaves_like 'an API request'
|
43
43
|
it_behaves_like 'a successful request'
|
44
44
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -32,7 +32,7 @@ RSpec.configure do |config|
|
|
32
32
|
config.before do
|
33
33
|
base_url =
|
34
34
|
"#{FinAppsCore::REST::Defaults::DEFAULTS[:host]}/v#{FinAppsCore::REST::Defaults::API_VERSION}/"
|
35
|
-
stub_request(:any, /#{base_url}/).to_rack(::FakeApi)
|
35
|
+
stub_request(:any, /#{base_url}/).to_rack(::Fake::FakeApi)
|
36
36
|
end
|
37
37
|
WebMock.disable_net_connect!(allow: 'codeclimate.com')
|
38
38
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Fake
|
4
|
+
module DocumentsUploadsRoutes
|
5
|
+
class << self
|
6
|
+
def included(base)
|
7
|
+
base.get("/#{base.version}/consumers/:consumer_id/documents/:doc_id?thumbnail=false") do
|
8
|
+
pdf_response 'signed_document.pdf'
|
9
|
+
end
|
10
|
+
destroy_routes(base)
|
11
|
+
destroy_by_consumer_routes(base)
|
12
|
+
super
|
13
|
+
end
|
14
|
+
|
15
|
+
def destroy_routes(base)
|
16
|
+
base.delete("/#{base.version}/documents/orders/valid_order_id/valid_doc_id") { status 204 }
|
17
|
+
base.delete("/#{base.version}/documents/orders/valid_order_id/invalid_doc_id") do
|
18
|
+
json_response 404, 'resource_not_found.json'
|
19
|
+
end
|
20
|
+
base.delete("/#{base.version}/documents/orders/invalid_order_id/valid_doc_id") do
|
21
|
+
json_response 404, 'resource_not_found.json'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def destroy_by_consumer_routes(base)
|
26
|
+
base.delete("/#{base.version}/consumers/valid_consumer_id/documents/valid_document_id") { status 204 }
|
27
|
+
base.delete("/#{base.version}/consumers/invalid_consumer_id/documents/invalid_document_id") do
|
28
|
+
json_response 404, 'resource_not_found.json'
|
29
|
+
end
|
30
|
+
base.delete("/#{base.version}/consumers/invalid_consumer_id/documents/valid_document_id") do
|
31
|
+
json_response 404, 'resource_not_found.json'
|
32
|
+
end
|
33
|
+
base.delete("/#{base.version}/consumers/valid_consumer_id/documents/invalid_document_id") do
|
34
|
+
json_response 404, 'resource_not_found.json'
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/spec/support/fake_api.rb
CHANGED
@@ -1,522 +1,515 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'sinatra/base'
|
4
|
+
require_relative 'documents_uploads_routes'
|
5
|
+
module Fake
|
6
|
+
# the FakeApi class is used to mock API requests while testing.
|
7
|
+
class FakeApi < Sinatra::Base
|
8
|
+
def self.version
|
9
|
+
"v#{FinAppsCore::REST::Defaults::API_VERSION}"
|
10
|
+
end
|
4
11
|
|
5
|
-
#
|
6
|
-
|
7
|
-
|
8
|
-
"
|
9
|
-
|
10
|
-
|
11
|
-
# resource
|
12
|
-
post("/#{version}/resources") { json_response 201, 'resource.json' }
|
13
|
-
get("/#{version}/resources/:id") { json_response 200, 'resource.json' }
|
14
|
-
get("/#{version}/resources") { json_response 200, 'resources.json' }
|
15
|
-
put("/#{version}/resources") { json_response 201, 'resource.json' }
|
16
|
-
delete("/#{version}/resources/:id") { status 202 }
|
12
|
+
# resource
|
13
|
+
post("/#{version}/resources") { json_response 201, 'resource.json' }
|
14
|
+
get("/#{version}/resources/:id") { json_response 200, 'resource.json' }
|
15
|
+
get("/#{version}/resources") { json_response 200, 'resources.json' }
|
16
|
+
put("/#{version}/resources") { json_response 201, 'resource.json' }
|
17
|
+
delete("/#{version}/resources/:id") { status 202 }
|
17
18
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
# verix_metadata
|
20
|
+
get("/#{version}/v/metadata") do
|
21
|
+
json_response 200, 'verix/metadata.json'
|
22
|
+
end
|
22
23
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
24
|
+
# verix_records
|
25
|
+
get("/#{version}/v/record") do
|
26
|
+
json_response 200, 'verix/record/list.json'
|
27
|
+
end
|
28
|
+
post("/#{version}/v/record") do
|
29
|
+
json_response 200, 'verix/record/create.json'
|
30
|
+
end
|
30
31
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
32
|
+
# verix_pdf_documents
|
33
|
+
get("/#{version}/v/record/:record_id/file/:provider_id") do
|
34
|
+
pdf_response 'verix/document/document.pdf'
|
35
|
+
end
|
35
36
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
37
|
+
# verix_documents
|
38
|
+
get("/#{version}/v/record/:record_id/document") do
|
39
|
+
json_response 200, 'verix/document/show.json'
|
40
|
+
end
|
41
|
+
get("/#{version}/v/record/:record_id/document/:document_id") do
|
42
|
+
json_response 200, 'verix/document/list.json'
|
43
|
+
end
|
43
44
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
45
|
+
# plaid_webhook/metadata
|
46
|
+
get("/#{version}/p/metadata") do
|
47
|
+
tenant_token = request.env['HTTP_X_TENANT_TOKEN']
|
48
|
+
if tenant_token == 'invalid_tenant_token'
|
49
|
+
json_response 404, 'invalid_tenant_credentials.json'
|
50
|
+
else
|
51
|
+
json_response 200, 'plaid/webhook.json'
|
52
|
+
end
|
51
53
|
end
|
52
|
-
end
|
53
54
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
end
|
58
|
-
get("/#{version}/p/institution/consumer/:consumer_institution_id/account") do
|
59
|
-
json_response 200, 'plaid/institution/consumer/show_accounts.json'
|
60
|
-
end
|
61
|
-
get("/#{version}/p/institution/consumer") do
|
62
|
-
tenant_token = request.env['HTTP_X_TENANT_TOKEN']
|
63
|
-
if tenant_token == 'invalid_tenant_token'
|
64
|
-
json_response 404, 'resource_not_found.json'
|
65
|
-
else
|
66
|
-
json_response 200, 'plaid/institution/consumer/list.json'
|
55
|
+
# plaid_institution_consumer
|
56
|
+
get("/#{version}/p/institution/consumer/:consumer_institution_id") do
|
57
|
+
json_response 200, 'plaid/institution/consumer/show.json'
|
67
58
|
end
|
68
|
-
|
69
|
-
|
70
|
-
tenant_token = request.env['HTTP_X_TENANT_TOKEN']
|
71
|
-
if tenant_token == 'invalid_tenant_token'
|
72
|
-
json_response 404, 'resource_not_found.json'
|
73
|
-
else
|
74
|
-
json_response 200, 'plaid/institution/consumer/add.json'
|
59
|
+
get("/#{version}/p/institution/consumer/:consumer_institution_id/account") do
|
60
|
+
json_response 200, 'plaid/institution/consumer/show_accounts.json'
|
75
61
|
end
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
end
|
94
|
-
put("/#{version}/p/accounts/permissions") do
|
95
|
-
request.body.rewind
|
96
|
-
request_payload = JSON.parse request.body.read
|
97
|
-
if request_payload.is_a? Array
|
62
|
+
get("/#{version}/p/institution/consumer") do
|
63
|
+
tenant_token = request.env['HTTP_X_TENANT_TOKEN']
|
64
|
+
if tenant_token == 'invalid_tenant_token'
|
65
|
+
json_response 404, 'resource_not_found.json'
|
66
|
+
else
|
67
|
+
json_response 200, 'plaid/institution/consumer/list.json'
|
68
|
+
end
|
69
|
+
end
|
70
|
+
post("/#{version}/p/institution/consumer") do
|
71
|
+
tenant_token = request.env['HTTP_X_TENANT_TOKEN']
|
72
|
+
if tenant_token == 'invalid_tenant_token'
|
73
|
+
json_response 404, 'resource_not_found.json'
|
74
|
+
else
|
75
|
+
json_response 200, 'plaid/institution/consumer/add.json'
|
76
|
+
end
|
77
|
+
end
|
78
|
+
delete("/#{version}/p/institution/consumer/:consumer_institution_id") do
|
98
79
|
status 204
|
99
|
-
else
|
100
|
-
json_response 400, 'invalid_request_body.json'
|
101
80
|
end
|
102
|
-
|
103
|
-
delete("/#{version}/p/accounts/permissions") do
|
104
|
-
request.body.rewind
|
105
|
-
request_payload = JSON.parse request.body.read
|
106
|
-
if request_payload.is_a? Array
|
81
|
+
put("/#{version}/p/institution/consumer/:consumer_institution_id") do
|
107
82
|
status 204
|
108
|
-
else
|
109
|
-
json_response 400, 'invalid_request_body.json'
|
110
83
|
end
|
111
|
-
|
84
|
+
get("/#{version}/p/institution/consumer/:consumer_institution_id/token") do
|
85
|
+
json_response 200, 'plaid/institution/consumer/public_token.json'
|
86
|
+
end
|
112
87
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
88
|
+
# plaid_accounts
|
89
|
+
get("/#{version}/p/account") do
|
90
|
+
json_response 200, 'plaid/account/list.json'
|
91
|
+
end
|
92
|
+
get("/#{version}/p/account/:account_id") do
|
93
|
+
json_response 200, 'plaid/account/show.json'
|
94
|
+
end
|
95
|
+
put("/#{version}/p/accounts/permissions") do
|
96
|
+
request.body.rewind
|
97
|
+
request_payload = JSON.parse request.body.read
|
98
|
+
if request_payload.is_a? Array
|
99
|
+
status 204
|
100
|
+
else
|
101
|
+
json_response 400, 'invalid_request_body.json'
|
102
|
+
end
|
103
|
+
end
|
104
|
+
delete("/#{version}/p/accounts/permissions") do
|
105
|
+
request.body.rewind
|
106
|
+
request_payload = JSON.parse request.body.read
|
107
|
+
if request_payload.is_a? Array
|
108
|
+
status 204
|
109
|
+
else
|
110
|
+
json_response 400, 'invalid_request_body.json'
|
111
|
+
end
|
112
|
+
end
|
117
113
|
|
118
|
-
|
119
|
-
|
114
|
+
# plaid_institution_logos
|
115
|
+
get("/#{version}/p/institution/logo/:inst_id") do
|
116
|
+
png_response 'plaid/institution/logo.png'
|
117
|
+
end
|
120
118
|
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
119
|
+
# version
|
120
|
+
get("/#{version}/version") { 'Version => 2.1.29-.20161208.172810' }
|
121
|
+
|
122
|
+
# tenants
|
123
|
+
get("/#{version}/settings/tenant") do
|
124
|
+
json_response 200, 'tenant_settings.json'
|
125
|
+
end
|
126
|
+
put("/#{version}/settings/tenant") do
|
127
|
+
request.body.rewind
|
128
|
+
request_payload = JSON.parse request.body.read
|
129
|
+
if request_payload['bad_params']
|
130
|
+
json_response 404, 'resource_not_found.json'
|
131
|
+
else
|
132
|
+
status 204
|
133
|
+
end
|
134
|
+
end
|
135
|
+
get("/#{version}/settings/app") do
|
136
|
+
json_response 200, 'tenant_app_settings.json'
|
137
|
+
end
|
138
|
+
put("/#{version}/settings/app") do
|
139
|
+
request.body.rewind
|
140
|
+
request_payload = JSON.parse request.body.read
|
141
|
+
if request_payload['pdf_statement_months']
|
142
|
+
status 204
|
143
|
+
else
|
144
|
+
json_response 404, 'resource_not_found.json'
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
# orders
|
149
|
+
post("/#{version}/orders/valid_token") do
|
150
|
+
json_response 200, 'order_token.json'
|
151
|
+
end
|
152
|
+
post("/#{version}/orders/invalid_token") do
|
129
153
|
json_response 404, 'resource_not_found.json'
|
130
|
-
else
|
131
|
-
status 204
|
132
154
|
end
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
request_payload = JSON.parse request.body.read
|
140
|
-
if request_payload['pdf_statement_months']
|
141
|
-
status 204
|
142
|
-
else
|
155
|
+
get("/#{version}/orders/valid_id") { json_response 200, 'order.json' }
|
156
|
+
get("/#{version}/orders") { json_response 200, 'orders.json' }
|
157
|
+
get("/#{version}/orders/valid_id/report.:format") do
|
158
|
+
json_response 200, 'order_report.json'
|
159
|
+
end
|
160
|
+
get("/#{version}/orders/invalid_id/report.:format") do
|
143
161
|
json_response 404, 'resource_not_found.json'
|
144
162
|
end
|
145
|
-
|
146
|
-
|
147
|
-
# orders
|
148
|
-
post("/#{version}/orders/valid_token") do
|
149
|
-
json_response 200, 'order_token.json'
|
150
|
-
end
|
151
|
-
post("/#{version}/orders/invalid_token") do
|
152
|
-
json_response 404, 'resource_not_found.json'
|
153
|
-
end
|
154
|
-
get("/#{version}/orders/valid_id") { json_response 200, 'order.json' }
|
155
|
-
get("/#{version}/orders") { json_response 200, 'orders.json' }
|
156
|
-
get("/#{version}/orders/valid_id/report.:format") do
|
157
|
-
json_response 200, 'order_report.json'
|
158
|
-
end
|
159
|
-
get("/#{version}/orders/invalid_id/report.:format") do
|
160
|
-
json_response 404, 'resource_not_found.json'
|
161
|
-
end
|
162
|
-
get("/#{version}/orders/valid_id/status") do
|
163
|
-
json_response 200, 'order_status.json'
|
164
|
-
end
|
165
|
-
get("/#{version}/orders/invalid_id/status") do
|
166
|
-
json_response 404, 'resource_not_found.json'
|
167
|
-
end
|
168
|
-
put("/#{version}/orders/valid_id/cancel") { status 204 }
|
169
|
-
put("/#{version}/orders/invalid_id/cancel") do
|
170
|
-
json_response 404, 'resource_not_found.json'
|
171
|
-
end
|
172
|
-
put("/#{version}/orders/valid_id/notify") { status 204 }
|
173
|
-
put("/#{version}/orders/invalid_id/notify") do
|
174
|
-
json_response 404, 'resource_not_found.json'
|
175
|
-
end
|
176
|
-
put("/#{version}/orders/valid_id/refresh") do
|
177
|
-
json_response 200, 'order_refresh.json'
|
178
|
-
end
|
179
|
-
put("/#{version}/orders/invalid_id/refresh") do
|
180
|
-
json_response 404, 'resource_not_found.json'
|
181
|
-
end
|
182
|
-
put("/#{version}/orders/invalid_id") do
|
183
|
-
json_response 404, 'resource_not_found.json'
|
184
|
-
end
|
185
|
-
put("/#{version}/orders/valid_id") { status 204 }
|
186
|
-
put("/#{version}/orders") do
|
187
|
-
request.body.rewind
|
188
|
-
request_payload = JSON.parse request.body.read
|
189
|
-
if request_payload['params'] == 'invalid'
|
190
|
-
json_response 400, 'invalid_request_body.json'
|
191
|
-
else
|
192
|
-
status 204
|
163
|
+
get("/#{version}/orders/valid_id/status") do
|
164
|
+
json_response 200, 'order_status.json'
|
193
165
|
end
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
json_response
|
200
|
-
|
201
|
-
|
166
|
+
get("/#{version}/orders/invalid_id/status") do
|
167
|
+
json_response 404, 'resource_not_found.json'
|
168
|
+
end
|
169
|
+
put("/#{version}/orders/valid_id/cancel") { status 204 }
|
170
|
+
put("/#{version}/orders/invalid_id/cancel") do
|
171
|
+
json_response 404, 'resource_not_found.json'
|
172
|
+
end
|
173
|
+
put("/#{version}/orders/valid_id/notify") { status 204 }
|
174
|
+
put("/#{version}/orders/invalid_id/notify") do
|
175
|
+
json_response 404, 'resource_not_found.json'
|
176
|
+
end
|
177
|
+
put("/#{version}/orders/valid_id/refresh") do
|
178
|
+
json_response 200, 'order_refresh.json'
|
179
|
+
end
|
180
|
+
put("/#{version}/orders/invalid_id/refresh") do
|
181
|
+
json_response 404, 'resource_not_found.json'
|
182
|
+
end
|
183
|
+
put("/#{version}/orders/invalid_id") do
|
184
|
+
json_response 404, 'resource_not_found.json'
|
185
|
+
end
|
186
|
+
put("/#{version}/orders/valid_id") { status 204 }
|
187
|
+
put("/#{version}/orders") do
|
188
|
+
request.body.rewind
|
189
|
+
request_payload = JSON.parse request.body.read
|
190
|
+
if request_payload['params'] == 'invalid'
|
191
|
+
json_response 400, 'invalid_request_body.json'
|
192
|
+
else
|
193
|
+
status 204
|
194
|
+
end
|
195
|
+
end
|
196
|
+
post("/#{version}/orders") do
|
197
|
+
request.body.rewind
|
198
|
+
request_payload = JSON.parse request.body.read
|
199
|
+
if %w[applicant institutions product].all? {|s| request_payload.key? s }
|
200
|
+
json_response 200, 'order_token.json'
|
201
|
+
else
|
202
|
+
json_response 400, 'invalid_request_body.json'
|
203
|
+
end
|
202
204
|
end
|
203
|
-
end
|
204
205
|
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
206
|
+
# documents_orders
|
207
|
+
get("/#{version}/documents/orders") do
|
208
|
+
if params[:filter]&.include?('"status":2')
|
209
|
+
json_response 200, 'documents_orders_none.json'
|
210
|
+
else
|
211
|
+
json_response 200, 'documents_orders.json'
|
212
|
+
end
|
211
213
|
end
|
212
|
-
|
213
|
-
get("/#{version}/documents/orders/valid_order_id") do
|
214
|
-
json_response 200, 'documents_order.json'
|
215
|
-
end
|
216
|
-
get("/#{version}/documents/orders/invalid_order_id") do
|
217
|
-
json_response 404, 'resource_not_found.json'
|
218
|
-
end
|
219
|
-
post("/#{version}/documents/orders") do
|
220
|
-
request.body.rewind
|
221
|
-
request_payload = JSON.parse request.body.read
|
222
|
-
if %w[applicant esign_documents tag].all? {|s| request_payload.key? s }
|
214
|
+
get("/#{version}/documents/orders/valid_order_id") do
|
223
215
|
json_response 200, 'documents_order.json'
|
224
|
-
else
|
225
|
-
json_response 400, 'invalid_request_body.json'
|
226
216
|
end
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
217
|
+
get("/#{version}/documents/orders/invalid_order_id") do
|
218
|
+
json_response 404, 'resource_not_found.json'
|
219
|
+
end
|
220
|
+
post("/#{version}/documents/orders") do
|
221
|
+
request.body.rewind
|
222
|
+
request_payload = JSON.parse request.body.read
|
223
|
+
if %w[applicant esign_documents tag].all? {|s| request_payload.key? s }
|
224
|
+
json_response 200, 'documents_order.json'
|
225
|
+
else
|
226
|
+
json_response 400, 'invalid_request_body.json'
|
227
|
+
end
|
228
|
+
end
|
229
|
+
put("/#{version}/documents/orders/valid_order_id") do
|
230
|
+
request.body.rewind
|
231
|
+
request_payload = JSON.parse request.body.read
|
232
|
+
if request_payload['tag'] == 'invalid'
|
233
|
+
json_response 400, 'invalid_request_body.json'
|
234
|
+
else
|
235
|
+
status 204
|
236
|
+
end
|
237
|
+
end
|
238
|
+
put("/#{version}/documents/orders/invalid_order_id") do
|
239
|
+
json_response 400, 'invalid_order_id.json'
|
240
|
+
end
|
241
|
+
delete("/#{version}/documents/orders/valid_order_id") { status 204 }
|
242
|
+
delete("/#{version}/documents/orders/invalid_order_id") do
|
243
|
+
json_response 404, 'resource_not_found.json'
|
244
|
+
end
|
245
|
+
get("/#{version}/documents/orders/valid_order_id/sign_url/valid_signature_id") do
|
246
|
+
json_response 200, 'sign_url.json'
|
247
|
+
end
|
248
|
+
get("/#{version}/documents/orders/invalid_order_id/sign_url/valid_signature_id") do
|
249
|
+
json_response 400, 'invalid_order_id.json'
|
250
|
+
end
|
251
|
+
get("/#{version}/documents/orders/valid_order_id/sign_url/invalid_signature_id") do
|
252
|
+
json_response 404, 'invalid_signature_id.json'
|
235
253
|
end
|
236
|
-
end
|
237
|
-
put("/#{version}/documents/orders/invalid_order_id") do
|
238
|
-
json_response 400, 'invalid_order_id.json'
|
239
|
-
end
|
240
|
-
delete("/#{version}/documents/orders/valid_order_id") { status 204 }
|
241
|
-
delete("/#{version}/documents/orders/invalid_order_id") do
|
242
|
-
json_response 404, 'resource_not_found.json'
|
243
|
-
end
|
244
|
-
get("/#{version}/documents/orders/valid_order_id/sign_url/valid_signature_id") do
|
245
|
-
json_response 200, 'sign_url.json'
|
246
|
-
end
|
247
|
-
get("/#{version}/documents/orders/invalid_order_id/sign_url/valid_signature_id") do
|
248
|
-
json_response 400, 'invalid_order_id.json'
|
249
|
-
end
|
250
|
-
get("/#{version}/documents/orders/valid_order_id/sign_url/invalid_signature_id") do
|
251
|
-
json_response 404, 'invalid_signature_id.json'
|
252
|
-
end
|
253
254
|
|
254
|
-
|
255
|
-
|
256
|
-
pdf_response 'signed_document.pdf'
|
257
|
-
end
|
258
|
-
delete("/#{version}/documents/orders/valid_order_id/valid_doc_id") { status 204 }
|
259
|
-
delete("/#{version}/documents/orders/valid_order_id/invalid_doc_id") do
|
260
|
-
json_response 404, 'resource_not_found.json'
|
261
|
-
end
|
262
|
-
delete("/#{version}/documents/orders/invalid_order_id/valid_doc_id") do
|
263
|
-
json_response 404, 'resource_not_found.json'
|
264
|
-
end
|
255
|
+
# documents_uploads
|
256
|
+
include DocumentsUploadsRoutes
|
265
257
|
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
258
|
+
# documents orders notifications
|
259
|
+
post("/#{version}/documents/orders/valid_id/notify") { status 204 }
|
260
|
+
post("/#{version}/documents/orders/invalid_id/notify") do
|
261
|
+
json_response 400, 'invalid_order_id.json'
|
262
|
+
end
|
271
263
|
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
264
|
+
# signed documents downloads
|
265
|
+
get("/#{version}/consumers/:consumer_id/documents/:signature_request_id") do
|
266
|
+
pdf_response 'signed_document.pdf'
|
267
|
+
end
|
276
268
|
|
277
|
-
|
278
|
-
|
269
|
+
# esign_templates
|
270
|
+
get("/#{version}/esign_templates") { json_response 200, 'esign_templates.json' }
|
279
271
|
|
280
|
-
|
281
|
-
|
272
|
+
# document_upload_types
|
273
|
+
get("/#{version}/documents/upload_types") { json_response 200, 'upload_types.json' }
|
282
274
|
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
end
|
287
|
-
get("/#{version}/consumers/valid_public_id") do
|
288
|
-
json_response 200, 'user.json'
|
289
|
-
end
|
290
|
-
get("/#{version}/consumers/invalid_public_id") do
|
291
|
-
json_response 404, 'resource_not_found.json'
|
292
|
-
end
|
293
|
-
post("/#{version}/consumers") do
|
294
|
-
request.body.rewind
|
295
|
-
request_payload = JSON.parse request.body.read
|
296
|
-
if request_payload['password']
|
297
|
-
json_response 201, 'user.json'
|
298
|
-
else
|
299
|
-
json_response 400, 'invalid_request_body.json'
|
275
|
+
# consumers
|
276
|
+
get("/#{version}/consumers") do
|
277
|
+
json_response 200, 'users.json'
|
300
278
|
end
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
279
|
+
get("/#{version}/consumers/valid_public_id") do
|
280
|
+
json_response 200, 'user.json'
|
281
|
+
end
|
282
|
+
get("/#{version}/consumers/invalid_public_id") do
|
283
|
+
json_response 404, 'resource_not_found.json'
|
284
|
+
end
|
285
|
+
post("/#{version}/consumers") do
|
286
|
+
request.body.rewind
|
287
|
+
request_payload = JSON.parse request.body.read
|
288
|
+
if request_payload['password']
|
289
|
+
json_response 201, 'user.json'
|
290
|
+
else
|
291
|
+
json_response 400, 'invalid_request_body.json'
|
292
|
+
end
|
293
|
+
end
|
294
|
+
put("/#{version}/consumers/valid_public_id") { status 204 }
|
295
|
+
put("/#{version}/consumers/invalid_public_id") do
|
296
|
+
json_response 400, 'invalid_user_id.json'
|
297
|
+
end
|
298
|
+
put("/#{version}/consumers/valid_public_id/password") do
|
299
|
+
json_response 200, 'user.json'
|
300
|
+
end
|
301
|
+
put("/#{version}/consumers/invalid_public_id/password") do
|
302
|
+
json_response 404, 'resource_not_found.json'
|
303
|
+
end
|
304
|
+
delete("/#{version}/consumers/valid_public_id") { status 204 }
|
305
|
+
delete("/#{version}/consumers/invalid_public_id") do
|
306
|
+
json_response 404, 'resource_not_found.json'
|
307
|
+
end
|
308
|
+
post("/#{version}/logout") { status 204 }
|
317
309
|
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
json_response 200, 'operator.json'
|
330
|
-
end
|
331
|
-
put("/#{version}/operators/invalid_id") do
|
332
|
-
json_response 404, 'resource_not_found.json'
|
333
|
-
end
|
334
|
-
put("/#{version}/operators/valid_id") { json_response 200, 'operator.json' }
|
335
|
-
put("/#{version}/operators/valid_id/assign") { status 204 }
|
336
|
-
put("/#{version}/operators/invalid_id/assign") do
|
337
|
-
json_response 404, 'resource_not_found.json'
|
338
|
-
end
|
339
|
-
post("/#{version}/operators/password/forgot") do
|
340
|
-
json_response 200, 'operator_forgot_password.json'
|
341
|
-
end
|
342
|
-
post("/#{version}/operators/password/reset") do
|
343
|
-
request.body.rewind
|
344
|
-
request_payload = JSON.parse request.body.read
|
345
|
-
if request_payload['params'] == 'valid'
|
310
|
+
# operators
|
311
|
+
get("/#{version}/operators") { json_response 200, 'operator_list.json' }
|
312
|
+
get("/#{version}/operators/invalid_id") do
|
313
|
+
json_response 404, 'resource_not_found.json'
|
314
|
+
end
|
315
|
+
get("/#{version}/operators/valid_id") { json_response 200, 'operator.json' }
|
316
|
+
delete("/#{version}/operators/invalid_id") do
|
317
|
+
json_response 404, 'resource_not_found.json'
|
318
|
+
end
|
319
|
+
delete("/#{version}/operators/valid_id") { status 204 }
|
320
|
+
post("/#{version}/operators/password/change") do
|
346
321
|
json_response 200, 'operator.json'
|
347
|
-
else
|
348
|
-
json_response 400, 'invalid_request_body.json'
|
349
322
|
end
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
323
|
+
put("/#{version}/operators/invalid_id") do
|
324
|
+
json_response 404, 'resource_not_found.json'
|
325
|
+
end
|
326
|
+
put("/#{version}/operators/valid_id") { json_response 200, 'operator.json' }
|
327
|
+
put("/#{version}/operators/valid_id/assign") { status 204 }
|
328
|
+
put("/#{version}/operators/invalid_id/assign") do
|
329
|
+
json_response 404, 'resource_not_found.json'
|
330
|
+
end
|
331
|
+
post("/#{version}/operators/password/forgot") do
|
332
|
+
json_response 200, 'operator_forgot_password.json'
|
333
|
+
end
|
334
|
+
post("/#{version}/operators/password/reset") do
|
335
|
+
request.body.rewind
|
336
|
+
request_payload = JSON.parse request.body.read
|
337
|
+
if request_payload['params'] == 'valid'
|
338
|
+
json_response 200, 'operator.json'
|
339
|
+
else
|
340
|
+
json_response 400, 'invalid_request_body.json'
|
341
|
+
end
|
342
|
+
end
|
343
|
+
post("/#{version}/operators") do
|
344
|
+
request.body.rewind
|
345
|
+
request_payload = JSON.parse request.body.read
|
346
|
+
if request_payload['params'] == 'valid'
|
347
|
+
json_response 201, 'operator.json'
|
348
|
+
else
|
349
|
+
json_response 400, 'invalid_request_body.json'
|
350
|
+
end
|
358
351
|
end
|
359
|
-
end
|
360
352
|
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
353
|
+
# session
|
354
|
+
post("/#{version}/login") do
|
355
|
+
request.body.rewind
|
356
|
+
request_payload = JSON.parse request.body.read
|
357
|
+
if request_payload['password'] == 'valid_password'
|
358
|
+
json_response(200, 'user.json')
|
359
|
+
else
|
360
|
+
json_response(401, 'unauthorized.json')
|
361
|
+
end
|
369
362
|
end
|
370
|
-
|
371
|
-
post("/#{version}/operators/login") { json_response 200, 'operator.json' }
|
363
|
+
post("/#{version}/operators/login") { json_response 200, 'operator.json' }
|
372
364
|
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
365
|
+
# password resets
|
366
|
+
post("/#{version}/tenant/valid_user_id/password") do
|
367
|
+
json_response 200, 'password_reset_token.json'
|
368
|
+
end
|
369
|
+
post("/#{version}/tenant/invalid_user_id/password") do
|
370
|
+
json_response 404, 'resource_not_found.json'
|
371
|
+
end
|
372
|
+
put("/#{version}/tenant/valid_user_id/password") do
|
373
|
+
request.body.rewind
|
374
|
+
request_payload = JSON.parse request.body.read
|
375
|
+
if request_payload['token'] == 'valid_token'
|
376
|
+
json_response(200, 'user.json')
|
377
|
+
else
|
378
|
+
json_response(400, 'invalid_request_body.json')
|
379
|
+
end
|
380
|
+
end
|
381
|
+
put("/#{version}/tenant/invalid_user_id/password") do
|
382
|
+
json_response 404, 'resource_not_found.json'
|
387
383
|
end
|
388
|
-
end
|
389
|
-
put("/#{version}/tenant/invalid_user_id/password") do
|
390
|
-
json_response 404, 'resource_not_found.json'
|
391
|
-
end
|
392
384
|
|
393
|
-
|
394
|
-
|
385
|
+
# products
|
386
|
+
get("/#{version}/products") { json_response 200, 'products.json' }
|
395
387
|
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
388
|
+
# portfolios
|
389
|
+
get("/#{version}/portfolios") { json_response 200, 'portfolios.json' }
|
390
|
+
get("/#{version}/portfolios/valid_id") { json_response 200, 'portfolio.json' }
|
391
|
+
get("/#{version}/portfolios/invalid_id") do
|
392
|
+
json_response 404, 'resource_not_found.json'
|
393
|
+
end
|
394
|
+
post("/#{version}/portfolios") do
|
395
|
+
request.body.rewind
|
396
|
+
request_payload = JSON.parse request.body.read
|
397
|
+
if request_payload['product'] == 'invalid'
|
398
|
+
json_response(400, 'invalid_request_body.json')
|
399
|
+
else
|
400
|
+
json_response(200, 'portfolio.json')
|
401
|
+
end
|
402
|
+
end
|
403
|
+
put("/#{version}/portfolios/valid_id") { json_response 200, 'portfolio.json' }
|
404
|
+
put("/#{version}/portfolios/invalid_id") do
|
405
|
+
json_response 404, 'resource_not_found.json'
|
406
|
+
end
|
407
|
+
delete("/#{version}/portfolios/valid_id") { status 204 }
|
408
|
+
delete("/#{version}/portfolios/invalid_id") do
|
409
|
+
json_response 404, 'resource_not_found.json'
|
409
410
|
end
|
410
|
-
end
|
411
|
-
put("/#{version}/portfolios/valid_id") { json_response 200, 'portfolio.json' }
|
412
|
-
put("/#{version}/portfolios/invalid_id") do
|
413
|
-
json_response 404, 'resource_not_found.json'
|
414
|
-
end
|
415
|
-
delete("/#{version}/portfolios/valid_id") { status 204 }
|
416
|
-
delete("/#{version}/portfolios/invalid_id") do
|
417
|
-
json_response 404, 'resource_not_found.json'
|
418
|
-
end
|
419
411
|
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
412
|
+
# alert definitions
|
413
|
+
get("/#{version}/portfolio/alerts/definitions") do
|
414
|
+
json_response 200, 'alert_definitions.json'
|
415
|
+
end
|
416
|
+
get("/#{version}/portfolio/alerts/definitions/valid_id") do
|
417
|
+
json_response 200, 'alert_definition.json'
|
418
|
+
end
|
419
|
+
get("/#{version}/portfolio/alerts/definitions/invalid_id") do
|
420
|
+
json_response 404, 'resource_not_found.json'
|
421
|
+
end
|
430
422
|
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
423
|
+
# alert occurrences
|
424
|
+
get("/#{version}/portfolio/alerts/occurrences") do
|
425
|
+
json_response 200, 'alert_occurrences.json'
|
426
|
+
end
|
435
427
|
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
428
|
+
# portfolios alerts
|
429
|
+
get("/#{version}/portfolios/valid_id/alerts") do
|
430
|
+
json_response 200, 'portfolios_alerts.json'
|
431
|
+
end
|
432
|
+
get("/#{version}/portfolios/invalid_id/alerts") do
|
433
|
+
json_response 404, 'resource_not_found.json'
|
434
|
+
end
|
435
|
+
put("/#{version}/portfolios/valid_id/alerts/valid_id") { status 204 }
|
436
|
+
put("/#{version}/portfolios/invalid_id/alerts/invalid_id") do
|
437
|
+
json_response 404, 'resource_not_found.json'
|
438
|
+
end
|
439
|
+
delete("/#{version}/portfolios/valid_id/alerts/valid_id") { status 204 }
|
440
|
+
delete("/#{version}/portfolios/invalid_id/alerts/invalid_id") do
|
441
|
+
json_response 404, 'resource_not_found.json'
|
442
|
+
end
|
451
443
|
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
444
|
+
# portfolios consumers
|
445
|
+
get("/#{version}/portfolios/valid_id/consumers") do
|
446
|
+
json_response 200, 'portfolios_consumers.json'
|
447
|
+
end
|
448
|
+
get("/#{version}/portfolios/invalid_id/consumers") do
|
449
|
+
json_response 404, 'resource_not_found.json'
|
450
|
+
end
|
451
|
+
post("/#{version}/portfolios/valid_id/consumers") { status 204 }
|
452
|
+
post("/#{version}/portfolios/invalid_id/consumers") do
|
453
|
+
json_response 400, 'multiple_consumer_subscribe_error.json'
|
454
|
+
end
|
455
|
+
post("/#{version}/portfolios/valid_id/consumers/valid_id") { status 204 }
|
456
|
+
post("/#{version}/portfolios/invalid_id/consumers/invalid_id") do
|
457
|
+
json_response 400, 'single_consumer_subscribe_error.json'
|
458
|
+
end
|
459
|
+
delete("/#{version}/portfolios/valid_id/consumers/valid_id") { status 204 }
|
460
|
+
delete("/#{version}/portfolios/invalid_id/consumers/invalid_id") do
|
461
|
+
json_response 404, 'resource_not_found.json'
|
462
|
+
end
|
471
463
|
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
464
|
+
# portfolios available consumers
|
465
|
+
get("/#{version}/portfolios/:id/consumers/available") do
|
466
|
+
json_response 200, 'portfolios_available_consumers.json'
|
467
|
+
end
|
476
468
|
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
469
|
+
# consumers portfolios
|
470
|
+
get("/#{version}/consumers/valid_id/portfolios") do
|
471
|
+
json_response 200, 'portfolios.json'
|
472
|
+
end
|
473
|
+
get("/#{version}/consumers/invalid_id/portfolios") do
|
474
|
+
json_response 404, 'resource_not_found.json'
|
475
|
+
end
|
484
476
|
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
477
|
+
# portfolio reports
|
478
|
+
get("/#{version}/portfolio/reports") do
|
479
|
+
json_response 200, 'portfolio_reports.json'
|
480
|
+
end
|
489
481
|
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
482
|
+
# relevance
|
483
|
+
get("/#{version}/relevance/ruleset/names") do
|
484
|
+
json_response 200, 'relevance_ruleset_names.json'
|
485
|
+
end
|
494
486
|
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
487
|
+
# errors
|
488
|
+
get("/#{version}/client_error") { json_response 400, 'error.json' }
|
489
|
+
get("/#{version}/server_error") { status 500 }
|
490
|
+
get("/#{version}/proxy_error") { status 407 }
|
499
491
|
|
500
|
-
|
501
|
-
|
492
|
+
# timeout
|
493
|
+
get("/#{version}/orders/timeout") { status 419 }
|
502
494
|
|
503
|
-
|
495
|
+
private
|
504
496
|
|
505
|
-
|
506
|
-
|
507
|
-
|
497
|
+
def json_response(response_code, file_name)
|
498
|
+
http_response :json, response_code, file_name
|
499
|
+
end
|
508
500
|
|
509
|
-
|
510
|
-
|
511
|
-
|
501
|
+
def png_response(file_name)
|
502
|
+
http_response :png, 200, file_name
|
503
|
+
end
|
512
504
|
|
513
|
-
|
514
|
-
|
515
|
-
|
505
|
+
def pdf_response(file_name)
|
506
|
+
http_response 'application/pdf', 200, file_name
|
507
|
+
end
|
516
508
|
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
509
|
+
def http_response(content_type, response_code, file_name)
|
510
|
+
content_type content_type
|
511
|
+
status response_code
|
512
|
+
File.open("#{File.dirname(__FILE__)}/fixtures/#{file_name}").read
|
513
|
+
end
|
521
514
|
end
|
522
515
|
end
|