form_api 0.2.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/{.swagger-codegen-ignore → .openapi-generator-ignore} +3 -3
- data/.openapi-generator/VERSION +1 -0
- data/.rubocop.yml +154 -0
- data/Gemfile.lock +15 -16
- data/README.md +30 -28
- data/Rakefile +2 -0
- data/docs/{InlineResponse422.md → AuthenticationError.md} +3 -3
- data/docs/{InlineResponse401.md → AuthenticationSuccessResponse.md} +2 -2
- data/docs/CombinedSubmission.md +14 -0
- data/docs/CombinedSubmissionData.md +11 -0
- data/docs/CreateCombinedSubmissionResponse.md +10 -0
- data/docs/CreateSubmissionBatchResponse.md +12 -0
- data/docs/CreateSubmissionData.md +12 -0
- data/docs/CreateSubmissionDataBatchRequest.md +13 -0
- data/docs/CreateSubmissionResponse.md +10 -0
- data/docs/CreateSubmissionResponse1.md +10 -0
- data/docs/{InlineResponse200.md → Error.md} +3 -2
- data/docs/{InlineResponse400.md → InvalidRequest.md} +3 -3
- data/docs/PDFApi.md +148 -64
- data/docs/Submission.md +16 -0
- data/docs/SubmissionBatch.md +16 -0
- data/docs/SubmissionBatchData.md +11 -0
- data/docs/Template.md +21 -0
- data/form_api.gemspec +6 -11
- data/git_push.sh +3 -3
- data/lib/form_api.rb +22 -15
- data/lib/form_api/api/client.rb +91 -38
- data/lib/form_api/api/pdf_api.rb +222 -109
- data/lib/form_api/api_client.rb +13 -13
- data/lib/form_api/api_error.rb +3 -3
- data/lib/form_api/configuration.rb +26 -5
- data/lib/form_api/models/{inline_response_201_1.rb → authentication_error.rb} +25 -29
- data/lib/form_api/models/{inline_response_200.rb → authentication_success_response.rb} +15 -24
- data/lib/form_api/models/{inline_response_201_combined_submission.rb → combined_submission.rb} +42 -66
- data/lib/form_api/models/{create_combined_submission_body.rb → combined_submission_data.rb} +13 -18
- data/lib/form_api/models/{inline_response_201.rb → create_combined_submission_response.rb} +37 -35
- data/lib/form_api/models/create_submission_batch_response.rb +257 -0
- data/lib/form_api/models/{create_submission_batch_body.rb → create_submission_data.rb} +32 -19
- data/lib/form_api/models/{create_submission_body.rb → create_submission_data_batch_request.rb} +45 -18
- data/lib/form_api/models/create_submission_response.rb +237 -0
- data/lib/form_api/models/create_submission_response1.rb +237 -0
- data/lib/form_api/models/{inline_response_400.rb → error.rb} +17 -21
- data/lib/form_api/models/{inline_response_422.rb → invalid_request.rb} +17 -21
- data/lib/form_api/models/{templatestemplate_idsubmissionsbatch_submission.rb → submission.rb} +40 -26
- data/lib/form_api/models/submission_batch.rb +291 -0
- data/lib/form_api/models/{inline_response_401.rb → submission_batch_data.rb} +48 -24
- data/lib/form_api/models/{inline_response_200_1.rb → template.rb} +88 -152
- data/lib/form_api/version.rb +4 -4
- data/spec/api/client_spec.rb +197 -23
- data/spec/api/pdf_api_spec.rb +168 -63
- data/spec/api_client_spec.rb +37 -37
- data/spec/configuration_spec.rb +11 -11
- data/spec/models/authentication_error_spec.rb +51 -0
- data/spec/models/authentication_success_response_spec.rb +45 -0
- data/spec/models/combined_submission_data_spec.rb +59 -0
- data/spec/models/combined_submission_spec.rb +81 -0
- data/spec/models/create_combined_submission_response_spec.rb +57 -0
- data/spec/models/create_submission_batch_response_spec.rb +69 -0
- data/spec/models/create_submission_data_batch_request_spec.rb +71 -0
- data/spec/models/create_submission_data_spec.rb +65 -0
- data/spec/models/create_submission_response1_spec.rb +57 -0
- data/spec/models/create_submission_response_spec.rb +57 -0
- data/spec/models/error_spec.rb +51 -0
- data/spec/models/invalid_request_spec.rb +51 -0
- data/spec/models/submission_batch_data_spec.rb +59 -0
- data/spec/models/submission_batch_spec.rb +93 -0
- data/spec/models/submission_spec.rb +93 -0
- data/spec/models/template_spec.rb +123 -0
- data/spec/spec_helper.rb +3 -14
- metadata +70 -95
- data/.swagger-codegen/VERSION +0 -1
- data/docs/CreateCombinedSubmissionBody.md +0 -11
- data/docs/CreateSubmissionBatchBody.md +0 -10
- data/docs/CreateSubmissionBody.md +0 -10
- data/docs/InlineResponse2001.md +0 -21
- data/docs/InlineResponse201.md +0 -9
- data/docs/InlineResponse2011.md +0 -9
- data/docs/InlineResponse201CombinedSubmission.md +0 -14
- data/docs/TemplatestemplateIdsubmissionsbatchSubmission.md +0 -14
- data/spec/models/create_combined_submission_body_spec.rb +0 -60
- data/spec/models/create_submission_batch_body_spec.rb +0 -54
- data/spec/models/create_submission_body_spec.rb +0 -54
- data/spec/models/inline_response_200_1_spec.rb +0 -124
- data/spec/models/inline_response_200_spec.rb +0 -46
- data/spec/models/inline_response_201_1_spec.rb +0 -52
- data/spec/models/inline_response_201_combined_submission_spec.rb +0 -82
- data/spec/models/inline_response_201_spec.rb +0 -52
- data/spec/models/inline_response_400_spec.rb +0 -52
- data/spec/models/inline_response_401_spec.rb +0 -42
- data/spec/models/inline_response_422_spec.rb +0 -52
- data/spec/models/templatestemplate_idsubmissionsbatch_submission_spec.rb +0 -82
- data/spec/vcr_cassettes/FormAPI_Client/should_generate_a_PDF_and_wait_for_the_submission_to_be_processed.yml +0 -127
data/lib/form_api/version.rb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
=begin
|
2
2
|
#API V1
|
3
3
|
|
4
|
-
#No description provided (generated by
|
4
|
+
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
5
5
|
|
6
6
|
OpenAPI spec version: v1
|
7
7
|
|
8
|
-
Generated by: https://
|
9
|
-
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 3.3.0-SNAPSHOT
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
13
13
|
module FormAPI
|
14
|
-
VERSION =
|
14
|
+
VERSION = '1.0.0'
|
15
15
|
end
|
data/spec/api/client_spec.rb
CHANGED
@@ -1,28 +1,202 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'json'
|
3
3
|
|
4
|
-
describe FormAPI::Client
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
4
|
+
describe FormAPI::Client do
|
5
|
+
before do
|
6
|
+
FormAPI.configure do |c|
|
7
|
+
c.api_token_id = 'api_token123'
|
8
|
+
c.api_token_secret = 'testsecret123'
|
9
|
+
c.host = 'http://localhost:31337'
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe '#generate_pdf' do
|
14
|
+
it 'should generate a PDF and wait for the submission to be processed' do
|
15
|
+
client = FormAPI::Client.new
|
16
|
+
template_id = 'tpl_000000000000000001'
|
17
|
+
|
18
|
+
expect(client).to receive(:sleep).with(1).once
|
19
|
+
|
20
|
+
response = client.generate_pdf(
|
21
|
+
template_id: template_id,
|
22
|
+
data: {
|
23
|
+
title: 'Test PDF',
|
24
|
+
description: 'This PDF is great!',
|
25
|
+
}
|
26
|
+
)
|
27
|
+
|
28
|
+
expect(response.status).to eq 'success'
|
29
|
+
submission = response.submission
|
30
|
+
expect(submission.id).to start_with 'sub_'
|
31
|
+
expect(submission.expired).to eq false
|
32
|
+
expect(submission.state).to eq 'processed'
|
33
|
+
expect(submission.download_url).to include 'submissions/submission.pdf'
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe '#batch_generate_pdfs' do
|
38
|
+
it 'should submit a batch job and wait for all jobs to be processed' do
|
39
|
+
client = FormAPI::Client.new
|
40
|
+
template_id = 'tpl_000000000000000001'
|
41
|
+
|
42
|
+
expect(client).to receive(:sleep).with(1).once
|
43
|
+
|
44
|
+
response = client.batch_generate_pdfs(
|
45
|
+
metadata: { user_id: 123 },
|
46
|
+
test: true,
|
47
|
+
submissions: [
|
48
|
+
{
|
49
|
+
template_id: template_id,
|
50
|
+
data: {
|
51
|
+
title: 'Test PDF',
|
52
|
+
description: 'This PDF is great!',
|
53
|
+
}
|
54
|
+
},
|
55
|
+
{
|
56
|
+
template_id: template_id,
|
57
|
+
data: {
|
58
|
+
title: 'Test PDF 2',
|
59
|
+
description: 'This PDF is also great!',
|
60
|
+
}
|
61
|
+
}
|
62
|
+
]
|
63
|
+
)
|
64
|
+
|
65
|
+
expect(response.status).to eq 'success'
|
66
|
+
batch = response.submission_batch
|
67
|
+
expect(batch.id).to start_with 'sba_'
|
68
|
+
expect(batch.state).to eq 'processed'
|
69
|
+
expect(batch.total_count).to eq 2
|
70
|
+
expect(batch.pending_count).to eq 0
|
71
|
+
expect(batch.error_count).to eq 0
|
72
|
+
expect(batch.completion_percentage).to eq 100
|
73
|
+
|
74
|
+
expect(response.submissions.size).to eq 2
|
75
|
+
submission_response1 = response.submissions[0]
|
76
|
+
expect(submission_response1.status).to eq 'success'
|
77
|
+
submission1 = submission_response1.submission
|
78
|
+
expect(submission1.id).to start_with 'sub_'
|
79
|
+
expect(submission1.expired).to eq false
|
80
|
+
expect(submission1.state).to eq 'processed'
|
81
|
+
expect(submission1.download_url).to include 'submissions/submission.pdf'
|
82
|
+
|
83
|
+
submission_response2 = response.submissions[1]
|
84
|
+
expect(submission_response2.status).to eq 'success'
|
85
|
+
submission2 = submission_response2.submission
|
86
|
+
expect(submission2.id).to start_with 'sub_'
|
87
|
+
expect(submission2.expired).to eq false
|
88
|
+
expect(submission2.state).to eq 'processed'
|
89
|
+
end
|
90
|
+
|
91
|
+
it 'generates no PDFs if there are any errors' do
|
92
|
+
client = FormAPI::Client.new
|
93
|
+
template_id = 'tpl_000000000000000001'
|
94
|
+
|
95
|
+
# Response is immediately an error so no need to poll
|
96
|
+
expect(client).to_not receive(:sleep)
|
97
|
+
|
98
|
+
response = client.batch_generate_pdfs(
|
99
|
+
metadata: { user_id: 123 },
|
100
|
+
test: true,
|
101
|
+
submissions: [
|
102
|
+
{
|
103
|
+
template_id: template_id,
|
104
|
+
data: {
|
105
|
+
title: 'Test PDF',
|
106
|
+
description: 'This PDF is great!',
|
107
|
+
}
|
108
|
+
},
|
109
|
+
{
|
110
|
+
template_id: template_id,
|
111
|
+
data: {
|
112
|
+
description: 'This PDF is also great!',
|
113
|
+
}
|
114
|
+
}
|
115
|
+
]
|
116
|
+
)
|
117
|
+
|
118
|
+
expect(response.status).to eq 'error'
|
119
|
+
batch = response.submission_batch
|
120
|
+
expect(batch.id).to start_with 'sba_'
|
121
|
+
expect(batch.state).to eq 'error'
|
122
|
+
expect(batch.total_count).to eq 2
|
123
|
+
expect(batch.pending_count).to eq 0
|
124
|
+
expect(batch.error_count).to eq 1
|
125
|
+
expect(batch.completion_percentage).to eq 100
|
126
|
+
|
127
|
+
expect(response.submissions.size).to eq 2
|
128
|
+
submission_response1 = response.submissions[0]
|
129
|
+
expect(submission_response1.status).to eq 'valid_but_not_saved'
|
130
|
+
expect(submission_response1.submission).to be_nil
|
131
|
+
|
132
|
+
submission_response2 = response.submissions[1]
|
133
|
+
expect(submission_response2.status).to eq 'error'
|
134
|
+
submission2 = submission_response2.submission
|
135
|
+
expect(submission2.id).to start_with 'sub_'
|
136
|
+
expect(submission2.expired).to eq false
|
137
|
+
expect(submission2.state).to eq 'invalid_data'
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
describe '#combine_submissions' do
|
142
|
+
it 'should merge multiple PDFs and wait for the job to be processed' do
|
143
|
+
client = FormAPI::Client.new
|
144
|
+
expect(client).to receive(:sleep).with(1).once
|
145
|
+
|
146
|
+
response = client.combine_submissions(
|
147
|
+
submission_ids: %w[sub_000000000000000001 sub_000000000000000002])
|
148
|
+
|
149
|
+
expect(response.status).to eq 'success'
|
150
|
+
combined_submission = response.combined_submission
|
151
|
+
expect(combined_submission.id).to start_with 'com_'
|
152
|
+
expect(combined_submission.expired).to eq false
|
153
|
+
expect(combined_submission.state).to eq 'processed'
|
154
|
+
expect(combined_submission.submission_ids).to eq(
|
155
|
+
%w[sub_000000000000000001 sub_000000000000000002])
|
156
|
+
expect(combined_submission.download_url).to include(
|
157
|
+
'combined_submissions/combined_submission.pdf')
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
describe '#batch_generate_and_combine_pdfs' do
|
162
|
+
it 'should submit a batch job and combine the PDFs into a single PDF' do
|
163
|
+
client = FormAPI::Client.new
|
164
|
+
template_id = 'tpl_000000000000000001'
|
165
|
+
|
166
|
+
expect(client).to receive(:sleep).with(1).twice
|
167
|
+
|
168
|
+
response = client.batch_generate_and_combine_pdfs(
|
169
|
+
metadata: { user_id: 123 },
|
170
|
+
test: true,
|
171
|
+
submissions: [
|
172
|
+
{
|
173
|
+
template_id: template_id,
|
174
|
+
data: {
|
175
|
+
title: 'Test PDF',
|
176
|
+
description: 'This PDF is great!',
|
177
|
+
}
|
178
|
+
},
|
179
|
+
{
|
180
|
+
template_id: template_id,
|
181
|
+
data: {
|
182
|
+
title: 'Test PDF 2',
|
183
|
+
description: 'This PDF is also great!',
|
184
|
+
}
|
185
|
+
}
|
186
|
+
]
|
187
|
+
)
|
188
|
+
|
189
|
+
expect(response.status).to eq 'success'
|
190
|
+
combined_submission = response.combined_submission
|
191
|
+
expect(combined_submission.id).to start_with 'com_'
|
192
|
+
expect(combined_submission.expired).to eq false
|
193
|
+
expect(combined_submission.state).to eq 'processed'
|
194
|
+
expect(combined_submission.submission_ids.count).to eq 2
|
195
|
+
combined_submission.submission_ids.each do |sub_id|
|
196
|
+
expect(sub_id).to start_with 'sub_'
|
197
|
+
end
|
198
|
+
expect(combined_submission.download_url).to include(
|
199
|
+
'combined_submissions/combined_submission.pdf')
|
200
|
+
end
|
27
201
|
end
|
28
202
|
end
|
data/spec/api/pdf_api_spec.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
=begin
|
2
2
|
#API V1
|
3
3
|
|
4
|
-
#No description provided (generated by
|
4
|
+
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
5
5
|
|
6
6
|
OpenAPI spec version: v1
|
7
7
|
|
8
|
-
Generated by: https://
|
9
|
-
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 3.3.0-SNAPSHOT
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -14,121 +14,226 @@ require 'spec_helper'
|
|
14
14
|
require 'json'
|
15
15
|
|
16
16
|
# Unit tests for FormAPI::PDFApi
|
17
|
-
# Automatically generated by
|
17
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
18
18
|
# Please update as you see appropriate
|
19
19
|
describe 'PDFApi' do
|
20
20
|
before do
|
21
|
-
|
22
|
-
|
21
|
+
FormAPI.configure do |c|
|
22
|
+
c.api_token_id = 'api_token123'
|
23
|
+
c.api_token_secret = 'testsecret123'
|
24
|
+
c.host = 'http://localhost:31337'
|
25
|
+
end
|
23
26
|
end
|
24
27
|
|
28
|
+
let(:api_instance) { FormAPI::PDFApi.new }
|
29
|
+
|
25
30
|
after do
|
26
31
|
# run after each test
|
27
32
|
end
|
28
33
|
|
29
|
-
|
30
|
-
it 'should create an instance of PDFApi' do
|
31
|
-
expect(@instance).to be_instance_of(FormAPI::PDFApi)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
# unit tests for batch_generate_pdf
|
34
|
+
# integration tests for batch_generate_pdf (v1)
|
36
35
|
# Generates multiple PDFs
|
37
|
-
#
|
38
36
|
# @param template_id
|
37
|
+
# @param create_submission_data
|
39
38
|
# @param [Hash] opts the optional parameters
|
40
|
-
# @
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
39
|
+
# @return [Array<CreateSubmissionResponse>]
|
40
|
+
describe 'batch_generate_pdf v1 test' do
|
41
|
+
it 'should work' do
|
42
|
+
template_id = 'tpl_000000000000000001'
|
43
|
+
responses = api_instance.batch_generate_pdf_v1(template_id, [
|
44
|
+
{
|
45
|
+
data: {
|
46
|
+
title: 'Test PDF',
|
47
|
+
description: 'This PDF is great!',
|
48
|
+
}
|
49
|
+
},
|
50
|
+
{
|
51
|
+
data: {
|
52
|
+
title: 'Test PDF 2',
|
53
|
+
description: 'This PDF is also great!',
|
54
|
+
}
|
55
|
+
}
|
56
|
+
])
|
57
|
+
expect(responses.size).to eq 2
|
58
|
+
expect(responses.first.status).to eq 'success'
|
59
|
+
submission = responses.first.submission
|
60
|
+
expect(submission.id).to start_with 'sub_'
|
61
|
+
expect(submission.expired).to eq false
|
62
|
+
expect(submission.state).to eq 'pending'
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
# Integration tests for batch_generate_pdf (v2)
|
67
|
+
describe 'batch_generate_pdfs v2 test' do
|
68
|
+
it 'should work' do
|
69
|
+
template_id = 'tpl_000000000000000001'
|
70
|
+
response = api_instance.batch_generate_pdfs(
|
71
|
+
metadata: { user_id: 123 },
|
72
|
+
test: true,
|
73
|
+
submissions: [
|
74
|
+
{
|
75
|
+
template_id: template_id,
|
76
|
+
data: {
|
77
|
+
title: 'Test PDF',
|
78
|
+
description: 'This PDF is great!',
|
79
|
+
}
|
80
|
+
},
|
81
|
+
{
|
82
|
+
template_id: template_id,
|
83
|
+
data: {
|
84
|
+
title: 'Test PDF 2',
|
85
|
+
description: 'This PDF is also great!',
|
86
|
+
}
|
87
|
+
}
|
88
|
+
]
|
89
|
+
)
|
90
|
+
expect(response.status).to eq 'success'
|
91
|
+
batch = response.submission_batch
|
92
|
+
expect(batch.id).to start_with 'sba_'
|
93
|
+
expect(batch.state).to eq 'pending'
|
94
|
+
expect(batch.total_count).to eq 2
|
95
|
+
expect(batch.pending_count).to eq 2
|
96
|
+
expect(batch.error_count).to eq 0
|
97
|
+
expect(batch.completion_percentage).to eq 0
|
98
|
+
|
99
|
+
expect(response.submissions.size).to eq 2
|
100
|
+
submission_response = response.submissions.first
|
101
|
+
expect(submission_response.status).to eq 'success'
|
102
|
+
submission = submission_response.submission
|
103
|
+
expect(submission.id).to start_with 'sub_'
|
104
|
+
expect(submission.expired).to eq false
|
105
|
+
expect(submission.state).to eq 'pending'
|
45
106
|
end
|
46
107
|
end
|
47
108
|
|
48
|
-
|
109
|
+
describe 'get_submission_batch test' do
|
110
|
+
it 'should get the batch including submissions' do
|
111
|
+
submission_batch_id = 'sba_000000000000000001'
|
112
|
+
batch = api_instance.get_submission_batch(submission_batch_id, include_submissions: true)
|
113
|
+
expect(batch.id).to eq 'sba_000000000000000001'
|
114
|
+
expect(batch.total_count).to eq 2
|
115
|
+
expect(batch.pending_count).to eq 0
|
116
|
+
expect(batch.completion_percentage).to eq 100
|
117
|
+
expect(batch.state).to eq 'processed'
|
118
|
+
expect(batch.submissions.count).to eq 2
|
119
|
+
end
|
120
|
+
|
121
|
+
it 'should get the batch without submissions' do
|
122
|
+
submission_batch_id = 'sba_000000000000000001'
|
123
|
+
batch = api_instance.get_submission_batch(submission_batch_id)
|
124
|
+
expect(batch.id).to eq 'sba_000000000000000001'
|
125
|
+
expect(batch.submissions).to be_nil
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
# integration tests for combine_submissions
|
49
130
|
# Merge generated PDFs together
|
50
|
-
#
|
51
131
|
# @param [Hash] opts the optional parameters
|
52
|
-
# @option opts [
|
53
|
-
# @return [
|
132
|
+
# @option opts [CombinedSubmissionData] :combined_submission_data
|
133
|
+
# @return [CreateCombinedSubmissionResponse]
|
54
134
|
describe 'combine_submissions test' do
|
55
|
-
it
|
56
|
-
|
135
|
+
it 'should work' do
|
136
|
+
response = api_instance.combine_submissions(
|
137
|
+
submission_ids: %w[sub_000000000000000001 sub_000000000000000002])
|
138
|
+
expect(response.status).to eq 'success'
|
139
|
+
expect(response.combined_submission.id).to start_with 'com_'
|
140
|
+
expect(response.combined_submission.state).to eq 'pending'
|
57
141
|
end
|
58
142
|
end
|
59
|
-
|
60
|
-
# unit tests for expire_combined_submission
|
143
|
+
# integration tests for expire_combined_submission
|
61
144
|
# Expire a combined submission
|
62
|
-
#
|
63
145
|
# @param combined_submission_id
|
64
146
|
# @param [Hash] opts the optional parameters
|
65
|
-
# @return [
|
147
|
+
# @return [CombinedSubmission]
|
66
148
|
describe 'expire_combined_submission test' do
|
67
|
-
it
|
68
|
-
|
149
|
+
it 'should work' do
|
150
|
+
combined_submission_id = 'com_000000000000000001'
|
151
|
+
combined_submission = api_instance.expire_combined_submission(combined_submission_id)
|
152
|
+
expect(combined_submission.expired).to eq true
|
69
153
|
end
|
70
154
|
end
|
71
|
-
|
72
|
-
# unit tests for expire_submission
|
155
|
+
# integration tests for expire_submission
|
73
156
|
# Expire a PDF submission
|
74
|
-
#
|
75
157
|
# @param submission_id
|
76
158
|
# @param [Hash] opts the optional parameters
|
77
|
-
# @return [
|
159
|
+
# @return [Submission]
|
78
160
|
describe 'expire_submission test' do
|
79
|
-
it
|
80
|
-
|
161
|
+
it 'should work' do
|
162
|
+
submission_id = 'sub_000000000000000001'
|
163
|
+
submission = api_instance.expire_submission(submission_id)
|
164
|
+
expect(submission.expired).to eq true
|
81
165
|
end
|
82
166
|
end
|
83
|
-
|
84
|
-
# unit tests for generate_pdf
|
167
|
+
# integration tests for generate_pdf
|
85
168
|
# Generates a new PDF
|
86
|
-
#
|
87
169
|
# @param template_id
|
170
|
+
# @param create_submission_data
|
88
171
|
# @param [Hash] opts the optional parameters
|
89
|
-
# @
|
90
|
-
# @return [InlineResponse2011]
|
172
|
+
# @return [CreateSubmissionResponse]
|
91
173
|
describe 'generate_pdf test' do
|
92
|
-
it
|
93
|
-
|
174
|
+
it 'should work' do
|
175
|
+
template_id = 'tpl_000000000000000001'
|
176
|
+
response = api_instance.generate_pdf(template_id,
|
177
|
+
data: {
|
178
|
+
title: 'Test PDF',
|
179
|
+
description: 'This PDF is great!',
|
180
|
+
})
|
181
|
+
expect(response.status).to eq 'success'
|
182
|
+
submission = response.submission
|
183
|
+
expect(submission.id).to start_with 'sub_'
|
184
|
+
expect(submission.expired).to eq false
|
185
|
+
expect(submission.state).to eq 'pending'
|
94
186
|
end
|
95
187
|
end
|
96
|
-
|
97
|
-
# unit tests for get_combined_submission
|
188
|
+
# integration tests for get_combined_submission
|
98
189
|
# Check the status of a combined submission (merged PDFs)
|
99
|
-
#
|
100
190
|
# @param combined_submission_id
|
101
191
|
# @param [Hash] opts the optional parameters
|
102
|
-
# @return [
|
192
|
+
# @return [CombinedSubmission]
|
103
193
|
describe 'get_combined_submission test' do
|
104
|
-
it
|
105
|
-
|
194
|
+
it 'should work' do
|
195
|
+
combined_submission_id = 'com_000000000000000001'
|
196
|
+
combined_submission = api_instance.get_combined_submission(combined_submission_id)
|
197
|
+
expect(combined_submission.id).to start_with 'com_'
|
106
198
|
end
|
107
199
|
end
|
108
|
-
|
109
|
-
# unit tests for get_submission
|
200
|
+
# integration tests for get_submission
|
110
201
|
# Check the status of a PDF
|
111
|
-
#
|
112
202
|
# @param submission_id
|
113
203
|
# @param [Hash] opts the optional parameters
|
114
|
-
# @return [
|
204
|
+
# @return [Submission]
|
115
205
|
describe 'get_submission test' do
|
116
|
-
it
|
117
|
-
|
206
|
+
it 'should work' do
|
207
|
+
submission_id = 'sub_000000000000000001'
|
208
|
+
submission = api_instance.get_submission(submission_id)
|
209
|
+
expect(submission.id).to start_with 'sub_'
|
118
210
|
end
|
119
211
|
end
|
120
|
-
|
121
|
-
# unit tests for get_templates
|
212
|
+
# integration tests for get_templates
|
122
213
|
# Get a list of all templates
|
123
|
-
#
|
124
214
|
# @param [Hash] opts the optional parameters
|
125
215
|
# @option opts [Integer] :page Default: 1
|
126
216
|
# @option opts [Integer] :per_page Default: 50
|
127
|
-
# @return [Array<
|
217
|
+
# @return [Array<Template>]
|
128
218
|
describe 'get_templates test' do
|
129
|
-
it
|
130
|
-
|
219
|
+
it 'should work' do
|
220
|
+
opts = {
|
221
|
+
page: 1, # Integer | Default: 1
|
222
|
+
per_page: 10 # Integer | Default: 50
|
223
|
+
}
|
224
|
+
templates = api_instance.get_templates(opts)
|
225
|
+
expect(templates.size).to eq 2
|
226
|
+
expect(templates.first.id).to start_with 'tpl_'
|
227
|
+
end
|
228
|
+
end
|
229
|
+
# integration tests for test_authentication
|
230
|
+
# Test Authentication
|
231
|
+
# @param [Hash] opts the optional parameters
|
232
|
+
# @return [AuthenticationSuccessResponse]
|
233
|
+
describe 'test_authentication test' do
|
234
|
+
it 'should work' do
|
235
|
+
response = api_instance.test_authentication
|
236
|
+
expect(response.status).to eq 'success'
|
131
237
|
end
|
132
238
|
end
|
133
|
-
|
134
239
|
end
|