form_api 0.2.0 → 1.0.0
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 +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/docs/Submission.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# FormAPI::Submission
|
|
2
|
+
|
|
3
|
+
## Properties
|
|
4
|
+
Name | Type | Description | Notes
|
|
5
|
+
------------ | ------------- | ------------- | -------------
|
|
6
|
+
**id** | **String** | |
|
|
7
|
+
**test** | **BOOLEAN** | |
|
|
8
|
+
**expired** | **BOOLEAN** | |
|
|
9
|
+
**expires_at** | **String** | | [optional]
|
|
10
|
+
**processed_at** | **String** | | [optional]
|
|
11
|
+
**state** | **String** | |
|
|
12
|
+
**metadata** | **Object** | | [optional]
|
|
13
|
+
**download_url** | **String** | | [optional]
|
|
14
|
+
**batch_id** | **String** | | [optional]
|
|
15
|
+
|
|
16
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# FormAPI::SubmissionBatch
|
|
2
|
+
|
|
3
|
+
## Properties
|
|
4
|
+
Name | Type | Description | Notes
|
|
5
|
+
------------ | ------------- | ------------- | -------------
|
|
6
|
+
**pending_count** | **Integer** | | [optional]
|
|
7
|
+
**completion_percentage** | **Integer** | | [optional]
|
|
8
|
+
**metadata** | **Object** | | [optional]
|
|
9
|
+
**total_count** | **Integer** | | [optional]
|
|
10
|
+
**submissions** | [**Array<Submission>**](Submission.md) | | [optional]
|
|
11
|
+
**processed_at** | **String** | | [optional]
|
|
12
|
+
**id** | **String** | | [optional]
|
|
13
|
+
**state** | **String** | | [optional]
|
|
14
|
+
**error_count** | **Integer** | | [optional]
|
|
15
|
+
|
|
16
|
+
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# FormAPI::SubmissionBatchData
|
|
2
|
+
|
|
3
|
+
## Properties
|
|
4
|
+
Name | Type | Description | Notes
|
|
5
|
+
------------ | ------------- | ------------- | -------------
|
|
6
|
+
**metadata** | **Object** | | [optional]
|
|
7
|
+
**test** | **BOOLEAN** | | [optional]
|
|
8
|
+
**template_id** | **String** | | [optional]
|
|
9
|
+
**submissions** | [**Array<CreateSubmissionDataBatchRequest>**](CreateSubmissionDataBatchRequest.md) | |
|
|
10
|
+
|
|
11
|
+
|
data/docs/Template.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# FormAPI::Template
|
|
2
|
+
|
|
3
|
+
## Properties
|
|
4
|
+
Name | Type | Description | Notes
|
|
5
|
+
------------ | ------------- | ------------- | -------------
|
|
6
|
+
**expiration_interval** | **String** | | [optional]
|
|
7
|
+
**webhook_url** | **String** | | [optional]
|
|
8
|
+
**expire_after** | **Float** | | [optional]
|
|
9
|
+
**allow_additional_properties** | **BOOLEAN** | | [optional]
|
|
10
|
+
**public_submissions** | **BOOLEAN** | | [optional]
|
|
11
|
+
**slack_webhook_url** | **String** | | [optional]
|
|
12
|
+
**blockchain_timestamp_verification** | **BOOLEAN** | | [optional]
|
|
13
|
+
**public_web_form** | **BOOLEAN** | | [optional]
|
|
14
|
+
**expire_submissions** | **BOOLEAN** | | [optional]
|
|
15
|
+
**name** | **String** | | [optional]
|
|
16
|
+
**template_type** | **String** | | [optional]
|
|
17
|
+
**id** | **String** | | [optional]
|
|
18
|
+
**page_dimensions** | **Array<Array<Float>>** | | [optional]
|
|
19
|
+
**redirect_url** | **String** | | [optional]
|
|
20
|
+
|
|
21
|
+
|
data/form_api.gemspec
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
=begin
|
|
4
4
|
#API V1
|
|
5
5
|
|
|
6
|
-
#No description provided (generated by
|
|
6
|
+
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
7
|
|
|
8
8
|
OpenAPI spec version: v1
|
|
9
9
|
|
|
10
|
-
Generated by: https://
|
|
11
|
-
|
|
10
|
+
Generated by: https://openapi-generator.tech
|
|
11
|
+
OpenAPI Generator version: 3.3.0-SNAPSHOT
|
|
12
12
|
|
|
13
13
|
=end
|
|
14
14
|
|
|
@@ -24,7 +24,7 @@ Gem::Specification.new do |s|
|
|
|
24
24
|
s.homepage = "https://github.com/FormAPI/formapi-ruby"
|
|
25
25
|
s.summary = "FormAPI API Client"
|
|
26
26
|
s.description = "Client library for the FormAPI PDF generation service"
|
|
27
|
-
s.license =
|
|
27
|
+
s.license = 'MIT'
|
|
28
28
|
s.required_ruby_version = ">= 1.9"
|
|
29
29
|
|
|
30
30
|
s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
|
|
@@ -38,12 +38,7 @@ Gem::Specification.new do |s|
|
|
|
38
38
|
s.add_development_dependency 'autotest-growl', '~> 0.2', '>= 0.2.16'
|
|
39
39
|
s.add_development_dependency 'autotest-fsevent', '~> 0.2', '>= 0.2.12'
|
|
40
40
|
|
|
41
|
-
#
|
|
42
|
-
s.add_development_dependency 'rake', '~>11.2', '>= 11.2.2'
|
|
43
|
-
s.add_development_dependency 'pry', '~>0.10', '>= 0.10.4'
|
|
44
|
-
# </added> : if the above lines are missing in the gemspec, then
|
|
45
|
-
# the matcher for autotest is probably broken
|
|
46
|
-
|
|
41
|
+
# Use git ls-files to ignore anything in .gitignore
|
|
47
42
|
s.files = `git ls-files`.split("\n").uniq.sort.select{|f| !f.empty? }
|
|
48
43
|
s.test_files = `git ls-files spec test`.split("\n")
|
|
49
44
|
s.executables = []
|
data/git_push.sh
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/bin/sh
|
|
2
2
|
#
|
|
3
|
-
# Generated by: https://
|
|
3
|
+
# Generated by: https://openapi-generator.tech
|
|
4
4
|
#
|
|
5
5
|
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
|
6
6
|
#
|
|
7
|
-
# Usage example: /bin/sh ./git_push.sh wing328
|
|
7
|
+
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update"
|
|
8
8
|
|
|
9
9
|
git_user_id=$1
|
|
10
10
|
git_repo_id=$2
|
|
@@ -39,7 +39,7 @@ git_remote=`git remote`
|
|
|
39
39
|
if [ "$git_remote" = "" ]; then # git remote not defined
|
|
40
40
|
|
|
41
41
|
if [ "$GIT_TOKEN" = "" ]; then
|
|
42
|
-
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git
|
|
42
|
+
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
|
43
43
|
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
|
|
44
44
|
else
|
|
45
45
|
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
|
data/lib/form_api.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
|
|
|
@@ -17,20 +17,27 @@ require 'form_api/version'
|
|
|
17
17
|
require 'form_api/configuration'
|
|
18
18
|
|
|
19
19
|
# Models
|
|
20
|
-
require 'form_api/models/
|
|
21
|
-
require 'form_api/models/
|
|
22
|
-
require 'form_api/models/
|
|
23
|
-
require 'form_api/models/
|
|
24
|
-
require 'form_api/models/
|
|
25
|
-
require 'form_api/models/
|
|
26
|
-
require 'form_api/models/
|
|
27
|
-
require 'form_api/models/
|
|
28
|
-
require 'form_api/models/
|
|
29
|
-
require 'form_api/models/
|
|
30
|
-
require 'form_api/models/
|
|
31
|
-
require 'form_api/models/
|
|
20
|
+
require 'form_api/models/authentication_error'
|
|
21
|
+
require 'form_api/models/authentication_success_response'
|
|
22
|
+
require 'form_api/models/combined_submission'
|
|
23
|
+
require 'form_api/models/combined_submission_data'
|
|
24
|
+
require 'form_api/models/create_combined_submission_response'
|
|
25
|
+
require 'form_api/models/create_submission_batch_response'
|
|
26
|
+
require 'form_api/models/create_submission_data'
|
|
27
|
+
require 'form_api/models/create_submission_data_batch_request'
|
|
28
|
+
require 'form_api/models/create_submission_response'
|
|
29
|
+
require 'form_api/models/create_submission_response1'
|
|
30
|
+
require 'form_api/models/error'
|
|
31
|
+
require 'form_api/models/invalid_request'
|
|
32
|
+
require 'form_api/models/submission'
|
|
33
|
+
require 'form_api/models/submission_batch'
|
|
34
|
+
require 'form_api/models/submission_batch_data'
|
|
35
|
+
require 'form_api/models/template'
|
|
32
36
|
|
|
33
37
|
# APIs
|
|
38
|
+
require 'form_api/api/pdf_api'
|
|
39
|
+
|
|
40
|
+
# Custom client
|
|
34
41
|
require 'form_api/api/client'
|
|
35
42
|
|
|
36
43
|
module FormAPI
|
data/lib/form_api/api/client.rb
CHANGED
|
@@ -1,82 +1,123 @@
|
|
|
1
1
|
require 'form_api/api/pdf_api'
|
|
2
2
|
|
|
3
|
-
# The original 'lib' files are overriden every time we
|
|
4
|
-
# regenerate the client, so custom methods go in here.
|
|
5
|
-
# Also I want to call it "Client".
|
|
6
|
-
|
|
7
3
|
module FormAPI
|
|
8
4
|
class Client < PDFApi
|
|
9
5
|
class InvalidDataError < ApiError; end
|
|
10
6
|
class PollTimeoutError < ApiError; end
|
|
11
7
|
class InvalidResponseError < ApiError; end
|
|
8
|
+
class FailedBatchError < ApiError; end
|
|
12
9
|
|
|
13
|
-
def generate_pdf(
|
|
14
|
-
unless
|
|
10
|
+
def generate_pdf(options)
|
|
11
|
+
unless options[:data].is_a?(::Hash)
|
|
15
12
|
raise InvalidDataError, "data is required, and must be a Hash."
|
|
16
13
|
end
|
|
17
14
|
|
|
18
15
|
# Wait for job to finish by default.
|
|
19
|
-
|
|
20
|
-
opts[:wait] = true
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
# FormAPI requires a nested :data object.
|
|
24
|
-
opts[:'create_submission_body'] = { data: opts.delete(:data) }
|
|
25
|
-
if opts[:metadata]
|
|
26
|
-
opts[:'create_submission_body'][:metadata] = opts.delete(:metadata)
|
|
27
|
-
end
|
|
16
|
+
options[:wait] = options.key?(:wait) ? options[:wait] : true
|
|
28
17
|
|
|
29
|
-
template_id =
|
|
30
|
-
|
|
18
|
+
template_id = options.delete :template_id
|
|
19
|
+
create_submission_data = options
|
|
20
|
+
response = super(template_id, create_submission_data)
|
|
31
21
|
|
|
32
|
-
return response unless
|
|
22
|
+
return response unless options[:wait]
|
|
33
23
|
|
|
34
24
|
submission = response.submission
|
|
35
|
-
timeout =
|
|
25
|
+
timeout = options[:timeout] || 60
|
|
36
26
|
start_time = Time.now
|
|
37
27
|
|
|
38
28
|
# Wait for submission to be ready
|
|
39
29
|
while submission.state == 'pending'
|
|
40
30
|
sleep 1
|
|
41
31
|
submission = get_submission(submission.id)
|
|
42
|
-
|
|
43
32
|
if Time.now - start_time > timeout
|
|
44
|
-
raise PollTimeoutError, "PDF was not
|
|
33
|
+
raise PollTimeoutError, "PDF was not processed after #{timeout} seconds!"
|
|
45
34
|
end
|
|
46
35
|
end
|
|
47
36
|
|
|
48
|
-
|
|
37
|
+
CreateSubmissionResponse.new(
|
|
49
38
|
status: submission.state == 'processed' ? 'success' : 'error',
|
|
50
39
|
submission: submission
|
|
51
40
|
)
|
|
52
41
|
end
|
|
53
42
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
43
|
+
def batch_generate_pdfs(options)
|
|
44
|
+
unless options[:submissions].is_a?(::Array)
|
|
45
|
+
raise InvalidDataError, ":submissions is required, and must be an Array."
|
|
46
|
+
end
|
|
47
|
+
options[:submissions].each do |submission|
|
|
48
|
+
unless submission[:data].is_a?(::Hash)
|
|
49
|
+
raise InvalidDataError,
|
|
50
|
+
":data is required for each submission, and must be a Hash."
|
|
51
|
+
end
|
|
58
52
|
end
|
|
59
53
|
|
|
60
54
|
# Wait for job to finish by default.
|
|
61
|
-
|
|
62
|
-
|
|
55
|
+
options[:wait] = options.key?(:wait) ? options[:wait] : true
|
|
56
|
+
|
|
57
|
+
submission_batch_data = options
|
|
58
|
+
response = super(submission_batch_data)
|
|
59
|
+
|
|
60
|
+
return response unless options[:wait]
|
|
61
|
+
|
|
62
|
+
batch = response.submission_batch
|
|
63
|
+
submissions = response.submissions
|
|
64
|
+
timeout = options[:timeout] || 600
|
|
65
|
+
start_time = Time.now
|
|
66
|
+
|
|
67
|
+
# Wait for submission to be ready
|
|
68
|
+
while batch.state == 'pending'
|
|
69
|
+
sleep 1
|
|
70
|
+
batch = get_submission_batch(batch.id)
|
|
71
|
+
if Time.now - start_time > timeout
|
|
72
|
+
raise PollTimeoutError, "PDFs were not processed after #{timeout} seconds!"
|
|
73
|
+
end
|
|
63
74
|
end
|
|
64
75
|
|
|
65
|
-
#
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
76
|
+
# While polling the batch status, we exclude any info about the submissions.
|
|
77
|
+
# We need to make one more request to fetch the updated submissions and
|
|
78
|
+
# prepare the correct responses for CreateSubmissionBatchResponse
|
|
79
|
+
batch_with_submissions = get_submission_batch(batch.id, include_submissions: true)
|
|
80
|
+
if batch_with_submissions.submissions && batch_with_submissions.submissions.any?
|
|
81
|
+
updated_submissions_hash =
|
|
82
|
+
batch_with_submissions.submissions.each_with_object({}) do |sub, h|
|
|
83
|
+
next h unless sub && sub.id
|
|
84
|
+
h[sub.id] = sub
|
|
85
|
+
end
|
|
86
|
+
submissions.each do |sub|
|
|
87
|
+
# If there's no submission it's already an error.
|
|
88
|
+
next unless sub.submission
|
|
89
|
+
updated_sub = updated_submissions_hash[sub.submission.id]
|
|
90
|
+
if updated_sub
|
|
91
|
+
sub.submission = updated_sub
|
|
92
|
+
sub.status = updated_sub.state == 'processed' ? 'success' : 'error'
|
|
93
|
+
else
|
|
94
|
+
sub.status = 'error'
|
|
95
|
+
end
|
|
96
|
+
end
|
|
69
97
|
end
|
|
70
|
-
|
|
71
|
-
|
|
98
|
+
|
|
99
|
+
CreateSubmissionBatchResponse.new(
|
|
100
|
+
status: batch.state == 'processed' ? 'success' : 'error',
|
|
101
|
+
submission_batch: batch,
|
|
102
|
+
submissions: submissions
|
|
103
|
+
)
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def combine_submissions(options)
|
|
107
|
+
unless options[:submission_ids].is_a?(::Array)
|
|
108
|
+
raise InvalidDataError, "submission_ids is required, and must be an Array."
|
|
72
109
|
end
|
|
73
110
|
|
|
74
|
-
|
|
111
|
+
# Wait for job to finish by default.
|
|
112
|
+
options[:wait] = options.key?(:wait) ? options[:wait] : true
|
|
113
|
+
|
|
114
|
+
# PdfAPI requires a :combined_submission_data option.
|
|
115
|
+
response = super(options)
|
|
75
116
|
|
|
76
|
-
return response unless
|
|
117
|
+
return response unless options[:wait]
|
|
77
118
|
|
|
78
119
|
combined_submission = response.combined_submission
|
|
79
|
-
timeout =
|
|
120
|
+
timeout = options[:timeout] || 600
|
|
80
121
|
start_time = Time.now
|
|
81
122
|
|
|
82
123
|
# Wait for submission to be ready
|
|
@@ -89,10 +130,22 @@ module FormAPI
|
|
|
89
130
|
end
|
|
90
131
|
end
|
|
91
132
|
|
|
92
|
-
|
|
133
|
+
CreateCombinedSubmissionResponse.new(
|
|
93
134
|
status: combined_submission.state == 'processed' ? 'success' : 'error',
|
|
94
135
|
combined_submission: combined_submission
|
|
95
136
|
)
|
|
96
137
|
end
|
|
138
|
+
|
|
139
|
+
def batch_generate_and_combine_pdfs(options)
|
|
140
|
+
# We pass the wait option to the combine_submissions method
|
|
141
|
+
wait = options.key?(:wait) ? options.delete(:wait) : true
|
|
142
|
+
|
|
143
|
+
response = batch_generate_pdfs(options)
|
|
144
|
+
if response.status == 'error'
|
|
145
|
+
raise FailedBatchError, 'Batch job failed, cannot combine PDFs!'
|
|
146
|
+
end
|
|
147
|
+
submission_ids = response.submissions.map { |s| s.submission.id }
|
|
148
|
+
combine_submissions(submission_ids: submission_ids, wait: wait)
|
|
149
|
+
end
|
|
97
150
|
end
|
|
98
151
|
end
|
data/lib/form_api/api/pdf_api.rb
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
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
|
-
require
|
|
13
|
+
require 'uri'
|
|
14
14
|
|
|
15
15
|
module FormAPI
|
|
16
16
|
class PDFApi
|
|
@@ -19,34 +19,35 @@ module FormAPI
|
|
|
19
19
|
def initialize(api_client = ApiClient.default)
|
|
20
20
|
@api_client = api_client
|
|
21
21
|
end
|
|
22
|
-
|
|
23
22
|
# Generates multiple PDFs
|
|
24
|
-
#
|
|
25
|
-
# @param
|
|
23
|
+
# @param template_id
|
|
24
|
+
# @param create_submission_data
|
|
26
25
|
# @param [Hash] opts the optional parameters
|
|
27
|
-
# @
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
data
|
|
31
|
-
return data
|
|
26
|
+
# @return [Array<CreateSubmissionResponse>]
|
|
27
|
+
def batch_generate_pdf_v1(template_id, create_submission_data, opts = {})
|
|
28
|
+
data, _status_code, _headers = batch_generate_pdf_v1_with_http_info(template_id, create_submission_data, opts)
|
|
29
|
+
data
|
|
32
30
|
end
|
|
33
31
|
|
|
34
32
|
# Generates multiple PDFs
|
|
35
|
-
#
|
|
36
|
-
# @param
|
|
33
|
+
# @param template_id
|
|
34
|
+
# @param create_submission_data
|
|
37
35
|
# @param [Hash] opts the optional parameters
|
|
38
|
-
# @
|
|
39
|
-
|
|
40
|
-
def batch_generate_pdf_with_http_info(template_id, opts = {})
|
|
36
|
+
# @return [Array<(Array<CreateSubmissionResponse>, Fixnum, Hash)>] Array<CreateSubmissionResponse> data, response status code and response headers
|
|
37
|
+
def batch_generate_pdf_v1_with_http_info(template_id, create_submission_data, opts = {})
|
|
41
38
|
if @api_client.config.debugging
|
|
42
|
-
@api_client.config.logger.debug
|
|
39
|
+
@api_client.config.logger.debug 'Calling API: PDFApi.batch_generate_pdf_v1 ...'
|
|
43
40
|
end
|
|
44
41
|
# verify the required parameter 'template_id' is set
|
|
45
42
|
if @api_client.config.client_side_validation && template_id.nil?
|
|
46
|
-
fail ArgumentError, "Missing the required parameter 'template_id' when calling PDFApi.
|
|
43
|
+
fail ArgumentError, "Missing the required parameter 'template_id' when calling PDFApi.batch_generate_pdf_v1"
|
|
44
|
+
end
|
|
45
|
+
# verify the required parameter 'create_submission_data' is set
|
|
46
|
+
if @api_client.config.client_side_validation && create_submission_data.nil?
|
|
47
|
+
fail ArgumentError, "Missing the required parameter 'create_submission_data' when calling PDFApi.batch_generate_pdf_v1"
|
|
47
48
|
end
|
|
48
49
|
# resource path
|
|
49
|
-
local_var_path =
|
|
50
|
+
local_var_path = '/templates/{template_id}/submissions/batch'.sub('{' + 'template_id' + '}', template_id.to_s)
|
|
50
51
|
|
|
51
52
|
# query parameters
|
|
52
53
|
query_params = {}
|
|
@@ -62,7 +63,7 @@ module FormAPI
|
|
|
62
63
|
form_params = {}
|
|
63
64
|
|
|
64
65
|
# http body (model)
|
|
65
|
-
post_body = @api_client.object_to_http_body(
|
|
66
|
+
post_body = @api_client.object_to_http_body(create_submission_data)
|
|
66
67
|
auth_names = ['api_token_basic']
|
|
67
68
|
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
|
68
69
|
:header_params => header_params,
|
|
@@ -70,34 +71,89 @@ module FormAPI
|
|
|
70
71
|
:form_params => form_params,
|
|
71
72
|
:body => post_body,
|
|
72
73
|
:auth_names => auth_names,
|
|
73
|
-
:return_type => 'Array<
|
|
74
|
+
:return_type => 'Array<CreateSubmissionResponse>')
|
|
74
75
|
if @api_client.config.debugging
|
|
75
|
-
@api_client.config.logger.debug "API called: PDFApi#
|
|
76
|
+
@api_client.config.logger.debug "API called: PDFApi#batch_generate_pdf_v1\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
77
|
+
end
|
|
78
|
+
return data, status_code, headers
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# Generates multiple PDFs
|
|
82
|
+
# @param submission_batch_data
|
|
83
|
+
# @param [Hash] opts the optional parameters
|
|
84
|
+
# @return [CreateSubmissionBatchResponse]
|
|
85
|
+
def batch_generate_pdfs(submission_batch_data, opts = {})
|
|
86
|
+
data, _status_code, _headers = batch_generate_pdfs_with_http_info(submission_batch_data, opts)
|
|
87
|
+
data
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# Generates multiple PDFs
|
|
91
|
+
# @param submission_batch_data
|
|
92
|
+
# @param [Hash] opts the optional parameters
|
|
93
|
+
# @return [Array<(CreateSubmissionBatchResponse, Fixnum, Hash)>] CreateSubmissionBatchResponse data, response status code and response headers
|
|
94
|
+
def batch_generate_pdfs_with_http_info(submission_batch_data, opts = {})
|
|
95
|
+
if @api_client.config.debugging
|
|
96
|
+
@api_client.config.logger.debug 'Calling API: PDFApi.batch_generate_pdfs ...'
|
|
97
|
+
end
|
|
98
|
+
# verify the required parameter 'submission_batch_data' is set
|
|
99
|
+
if @api_client.config.client_side_validation && submission_batch_data.nil?
|
|
100
|
+
fail ArgumentError, "Missing the required parameter 'submission_batch_data' when calling PDFApi.batch_generate_pdfs"
|
|
101
|
+
end
|
|
102
|
+
# resource path
|
|
103
|
+
local_var_path = '/submissions/batches'
|
|
104
|
+
|
|
105
|
+
# query parameters
|
|
106
|
+
query_params = {}
|
|
107
|
+
|
|
108
|
+
# header parameters
|
|
109
|
+
header_params = {}
|
|
110
|
+
# HTTP header 'Accept' (if needed)
|
|
111
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
112
|
+
# HTTP header 'Content-Type'
|
|
113
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
|
114
|
+
|
|
115
|
+
# form parameters
|
|
116
|
+
form_params = {}
|
|
117
|
+
|
|
118
|
+
# http body (model)
|
|
119
|
+
post_body = @api_client.object_to_http_body(submission_batch_data)
|
|
120
|
+
auth_names = ['api_token_basic']
|
|
121
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
|
122
|
+
:header_params => header_params,
|
|
123
|
+
:query_params => query_params,
|
|
124
|
+
:form_params => form_params,
|
|
125
|
+
:body => post_body,
|
|
126
|
+
:auth_names => auth_names,
|
|
127
|
+
:return_type => 'CreateSubmissionBatchResponse')
|
|
128
|
+
if @api_client.config.debugging
|
|
129
|
+
@api_client.config.logger.debug "API called: PDFApi#batch_generate_pdfs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
76
130
|
end
|
|
77
131
|
return data, status_code, headers
|
|
78
132
|
end
|
|
79
133
|
|
|
80
134
|
# Merge generated PDFs together
|
|
81
|
-
#
|
|
135
|
+
# @param combined_submission_data
|
|
82
136
|
# @param [Hash] opts the optional parameters
|
|
83
|
-
# @
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
data
|
|
87
|
-
return data
|
|
137
|
+
# @return [CreateCombinedSubmissionResponse]
|
|
138
|
+
def combine_submissions(combined_submission_data, opts = {})
|
|
139
|
+
data, _status_code, _headers = combine_submissions_with_http_info(combined_submission_data, opts)
|
|
140
|
+
data
|
|
88
141
|
end
|
|
89
142
|
|
|
90
143
|
# Merge generated PDFs together
|
|
91
|
-
#
|
|
144
|
+
# @param combined_submission_data
|
|
92
145
|
# @param [Hash] opts the optional parameters
|
|
93
|
-
# @
|
|
94
|
-
|
|
95
|
-
def combine_submissions_with_http_info(opts = {})
|
|
146
|
+
# @return [Array<(CreateCombinedSubmissionResponse, Fixnum, Hash)>] CreateCombinedSubmissionResponse data, response status code and response headers
|
|
147
|
+
def combine_submissions_with_http_info(combined_submission_data, opts = {})
|
|
96
148
|
if @api_client.config.debugging
|
|
97
|
-
@api_client.config.logger.debug
|
|
149
|
+
@api_client.config.logger.debug 'Calling API: PDFApi.combine_submissions ...'
|
|
150
|
+
end
|
|
151
|
+
# verify the required parameter 'combined_submission_data' is set
|
|
152
|
+
if @api_client.config.client_side_validation && combined_submission_data.nil?
|
|
153
|
+
fail ArgumentError, "Missing the required parameter 'combined_submission_data' when calling PDFApi.combine_submissions"
|
|
98
154
|
end
|
|
99
155
|
# resource path
|
|
100
|
-
local_var_path =
|
|
156
|
+
local_var_path = '/combined_submissions'
|
|
101
157
|
|
|
102
158
|
# query parameters
|
|
103
159
|
query_params = {}
|
|
@@ -113,7 +169,7 @@ module FormAPI
|
|
|
113
169
|
form_params = {}
|
|
114
170
|
|
|
115
171
|
# http body (model)
|
|
116
|
-
post_body = @api_client.object_to_http_body(
|
|
172
|
+
post_body = @api_client.object_to_http_body(combined_submission_data)
|
|
117
173
|
auth_names = ['api_token_basic']
|
|
118
174
|
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
|
119
175
|
:header_params => header_params,
|
|
@@ -121,7 +177,7 @@ module FormAPI
|
|
|
121
177
|
:form_params => form_params,
|
|
122
178
|
:body => post_body,
|
|
123
179
|
:auth_names => auth_names,
|
|
124
|
-
:return_type => '
|
|
180
|
+
:return_type => 'CreateCombinedSubmissionResponse')
|
|
125
181
|
if @api_client.config.debugging
|
|
126
182
|
@api_client.config.logger.debug "API called: PDFApi#combine_submissions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
127
183
|
end
|
|
@@ -129,30 +185,28 @@ module FormAPI
|
|
|
129
185
|
end
|
|
130
186
|
|
|
131
187
|
# Expire a combined submission
|
|
132
|
-
#
|
|
133
|
-
# @param combined_submission_id
|
|
188
|
+
# @param combined_submission_id
|
|
134
189
|
# @param [Hash] opts the optional parameters
|
|
135
|
-
# @return [
|
|
190
|
+
# @return [CombinedSubmission]
|
|
136
191
|
def expire_combined_submission(combined_submission_id, opts = {})
|
|
137
192
|
data, _status_code, _headers = expire_combined_submission_with_http_info(combined_submission_id, opts)
|
|
138
|
-
|
|
193
|
+
data
|
|
139
194
|
end
|
|
140
195
|
|
|
141
196
|
# Expire a combined submission
|
|
142
|
-
#
|
|
143
|
-
# @param combined_submission_id
|
|
197
|
+
# @param combined_submission_id
|
|
144
198
|
# @param [Hash] opts the optional parameters
|
|
145
|
-
# @return [Array<(
|
|
199
|
+
# @return [Array<(CombinedSubmission, Fixnum, Hash)>] CombinedSubmission data, response status code and response headers
|
|
146
200
|
def expire_combined_submission_with_http_info(combined_submission_id, opts = {})
|
|
147
201
|
if @api_client.config.debugging
|
|
148
|
-
@api_client.config.logger.debug
|
|
202
|
+
@api_client.config.logger.debug 'Calling API: PDFApi.expire_combined_submission ...'
|
|
149
203
|
end
|
|
150
204
|
# verify the required parameter 'combined_submission_id' is set
|
|
151
205
|
if @api_client.config.client_side_validation && combined_submission_id.nil?
|
|
152
206
|
fail ArgumentError, "Missing the required parameter 'combined_submission_id' when calling PDFApi.expire_combined_submission"
|
|
153
207
|
end
|
|
154
208
|
# resource path
|
|
155
|
-
local_var_path =
|
|
209
|
+
local_var_path = '/combined_submissions/{combined_submission_id}'.sub('{' + 'combined_submission_id' + '}', combined_submission_id.to_s)
|
|
156
210
|
|
|
157
211
|
# query parameters
|
|
158
212
|
query_params = {}
|
|
@@ -174,7 +228,7 @@ module FormAPI
|
|
|
174
228
|
:form_params => form_params,
|
|
175
229
|
:body => post_body,
|
|
176
230
|
:auth_names => auth_names,
|
|
177
|
-
:return_type => '
|
|
231
|
+
:return_type => 'CombinedSubmission')
|
|
178
232
|
if @api_client.config.debugging
|
|
179
233
|
@api_client.config.logger.debug "API called: PDFApi#expire_combined_submission\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
180
234
|
end
|
|
@@ -182,30 +236,28 @@ module FormAPI
|
|
|
182
236
|
end
|
|
183
237
|
|
|
184
238
|
# Expire a PDF submission
|
|
185
|
-
#
|
|
186
|
-
# @param submission_id
|
|
239
|
+
# @param submission_id
|
|
187
240
|
# @param [Hash] opts the optional parameters
|
|
188
|
-
# @return [
|
|
241
|
+
# @return [Submission]
|
|
189
242
|
def expire_submission(submission_id, opts = {})
|
|
190
243
|
data, _status_code, _headers = expire_submission_with_http_info(submission_id, opts)
|
|
191
|
-
|
|
244
|
+
data
|
|
192
245
|
end
|
|
193
246
|
|
|
194
247
|
# Expire a PDF submission
|
|
195
|
-
#
|
|
196
|
-
# @param submission_id
|
|
248
|
+
# @param submission_id
|
|
197
249
|
# @param [Hash] opts the optional parameters
|
|
198
|
-
# @return [Array<(
|
|
250
|
+
# @return [Array<(Submission, Fixnum, Hash)>] Submission data, response status code and response headers
|
|
199
251
|
def expire_submission_with_http_info(submission_id, opts = {})
|
|
200
252
|
if @api_client.config.debugging
|
|
201
|
-
@api_client.config.logger.debug
|
|
253
|
+
@api_client.config.logger.debug 'Calling API: PDFApi.expire_submission ...'
|
|
202
254
|
end
|
|
203
255
|
# verify the required parameter 'submission_id' is set
|
|
204
256
|
if @api_client.config.client_side_validation && submission_id.nil?
|
|
205
257
|
fail ArgumentError, "Missing the required parameter 'submission_id' when calling PDFApi.expire_submission"
|
|
206
258
|
end
|
|
207
259
|
# resource path
|
|
208
|
-
local_var_path =
|
|
260
|
+
local_var_path = '/submissions/{submission_id}'.sub('{' + 'submission_id' + '}', submission_id.to_s)
|
|
209
261
|
|
|
210
262
|
# query parameters
|
|
211
263
|
query_params = {}
|
|
@@ -227,7 +279,7 @@ module FormAPI
|
|
|
227
279
|
:form_params => form_params,
|
|
228
280
|
:body => post_body,
|
|
229
281
|
:auth_names => auth_names,
|
|
230
|
-
:return_type => '
|
|
282
|
+
:return_type => 'Submission')
|
|
231
283
|
if @api_client.config.debugging
|
|
232
284
|
@api_client.config.logger.debug "API called: PDFApi#expire_submission\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
233
285
|
end
|
|
@@ -235,32 +287,34 @@ module FormAPI
|
|
|
235
287
|
end
|
|
236
288
|
|
|
237
289
|
# Generates a new PDF
|
|
238
|
-
#
|
|
239
|
-
# @param
|
|
290
|
+
# @param template_id
|
|
291
|
+
# @param create_submission_data
|
|
240
292
|
# @param [Hash] opts the optional parameters
|
|
241
|
-
# @
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
data
|
|
245
|
-
return data
|
|
293
|
+
# @return [CreateSubmissionResponse]
|
|
294
|
+
def generate_pdf(template_id, create_submission_data, opts = {})
|
|
295
|
+
data, _status_code, _headers = generate_pdf_with_http_info(template_id, create_submission_data, opts)
|
|
296
|
+
data
|
|
246
297
|
end
|
|
247
298
|
|
|
248
299
|
# Generates a new PDF
|
|
249
|
-
#
|
|
250
|
-
# @param
|
|
300
|
+
# @param template_id
|
|
301
|
+
# @param create_submission_data
|
|
251
302
|
# @param [Hash] opts the optional parameters
|
|
252
|
-
# @
|
|
253
|
-
|
|
254
|
-
def generate_pdf_with_http_info(template_id, opts = {})
|
|
303
|
+
# @return [Array<(CreateSubmissionResponse, Fixnum, Hash)>] CreateSubmissionResponse data, response status code and response headers
|
|
304
|
+
def generate_pdf_with_http_info(template_id, create_submission_data, opts = {})
|
|
255
305
|
if @api_client.config.debugging
|
|
256
|
-
@api_client.config.logger.debug
|
|
306
|
+
@api_client.config.logger.debug 'Calling API: PDFApi.generate_pdf ...'
|
|
257
307
|
end
|
|
258
308
|
# verify the required parameter 'template_id' is set
|
|
259
309
|
if @api_client.config.client_side_validation && template_id.nil?
|
|
260
310
|
fail ArgumentError, "Missing the required parameter 'template_id' when calling PDFApi.generate_pdf"
|
|
261
311
|
end
|
|
312
|
+
# verify the required parameter 'create_submission_data' is set
|
|
313
|
+
if @api_client.config.client_side_validation && create_submission_data.nil?
|
|
314
|
+
fail ArgumentError, "Missing the required parameter 'create_submission_data' when calling PDFApi.generate_pdf"
|
|
315
|
+
end
|
|
262
316
|
# resource path
|
|
263
|
-
local_var_path =
|
|
317
|
+
local_var_path = '/templates/{template_id}/submissions'.sub('{' + 'template_id' + '}', template_id.to_s)
|
|
264
318
|
|
|
265
319
|
# query parameters
|
|
266
320
|
query_params = {}
|
|
@@ -276,7 +330,7 @@ module FormAPI
|
|
|
276
330
|
form_params = {}
|
|
277
331
|
|
|
278
332
|
# http body (model)
|
|
279
|
-
post_body = @api_client.object_to_http_body(
|
|
333
|
+
post_body = @api_client.object_to_http_body(create_submission_data)
|
|
280
334
|
auth_names = ['api_token_basic']
|
|
281
335
|
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
|
282
336
|
:header_params => header_params,
|
|
@@ -284,7 +338,7 @@ module FormAPI
|
|
|
284
338
|
:form_params => form_params,
|
|
285
339
|
:body => post_body,
|
|
286
340
|
:auth_names => auth_names,
|
|
287
|
-
:return_type => '
|
|
341
|
+
:return_type => 'CreateSubmissionResponse')
|
|
288
342
|
if @api_client.config.debugging
|
|
289
343
|
@api_client.config.logger.debug "API called: PDFApi#generate_pdf\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
290
344
|
end
|
|
@@ -292,30 +346,28 @@ module FormAPI
|
|
|
292
346
|
end
|
|
293
347
|
|
|
294
348
|
# Check the status of a combined submission (merged PDFs)
|
|
295
|
-
#
|
|
296
|
-
# @param combined_submission_id
|
|
349
|
+
# @param combined_submission_id
|
|
297
350
|
# @param [Hash] opts the optional parameters
|
|
298
|
-
# @return [
|
|
351
|
+
# @return [CombinedSubmission]
|
|
299
352
|
def get_combined_submission(combined_submission_id, opts = {})
|
|
300
353
|
data, _status_code, _headers = get_combined_submission_with_http_info(combined_submission_id, opts)
|
|
301
|
-
|
|
354
|
+
data
|
|
302
355
|
end
|
|
303
356
|
|
|
304
357
|
# Check the status of a combined submission (merged PDFs)
|
|
305
|
-
#
|
|
306
|
-
# @param combined_submission_id
|
|
358
|
+
# @param combined_submission_id
|
|
307
359
|
# @param [Hash] opts the optional parameters
|
|
308
|
-
# @return [Array<(
|
|
360
|
+
# @return [Array<(CombinedSubmission, Fixnum, Hash)>] CombinedSubmission data, response status code and response headers
|
|
309
361
|
def get_combined_submission_with_http_info(combined_submission_id, opts = {})
|
|
310
362
|
if @api_client.config.debugging
|
|
311
|
-
@api_client.config.logger.debug
|
|
363
|
+
@api_client.config.logger.debug 'Calling API: PDFApi.get_combined_submission ...'
|
|
312
364
|
end
|
|
313
365
|
# verify the required parameter 'combined_submission_id' is set
|
|
314
366
|
if @api_client.config.client_side_validation && combined_submission_id.nil?
|
|
315
367
|
fail ArgumentError, "Missing the required parameter 'combined_submission_id' when calling PDFApi.get_combined_submission"
|
|
316
368
|
end
|
|
317
369
|
# resource path
|
|
318
|
-
local_var_path =
|
|
370
|
+
local_var_path = '/combined_submissions/{combined_submission_id}'.sub('{' + 'combined_submission_id' + '}', combined_submission_id.to_s)
|
|
319
371
|
|
|
320
372
|
# query parameters
|
|
321
373
|
query_params = {}
|
|
@@ -337,7 +389,7 @@ module FormAPI
|
|
|
337
389
|
:form_params => form_params,
|
|
338
390
|
:body => post_body,
|
|
339
391
|
:auth_names => auth_names,
|
|
340
|
-
:return_type => '
|
|
392
|
+
:return_type => 'CombinedSubmission')
|
|
341
393
|
if @api_client.config.debugging
|
|
342
394
|
@api_client.config.logger.debug "API called: PDFApi#get_combined_submission\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
343
395
|
end
|
|
@@ -345,30 +397,28 @@ module FormAPI
|
|
|
345
397
|
end
|
|
346
398
|
|
|
347
399
|
# Check the status of a PDF
|
|
348
|
-
#
|
|
349
|
-
# @param submission_id
|
|
400
|
+
# @param submission_id
|
|
350
401
|
# @param [Hash] opts the optional parameters
|
|
351
|
-
# @return [
|
|
402
|
+
# @return [Submission]
|
|
352
403
|
def get_submission(submission_id, opts = {})
|
|
353
404
|
data, _status_code, _headers = get_submission_with_http_info(submission_id, opts)
|
|
354
|
-
|
|
405
|
+
data
|
|
355
406
|
end
|
|
356
407
|
|
|
357
408
|
# Check the status of a PDF
|
|
358
|
-
#
|
|
359
|
-
# @param submission_id
|
|
409
|
+
# @param submission_id
|
|
360
410
|
# @param [Hash] opts the optional parameters
|
|
361
|
-
# @return [Array<(
|
|
411
|
+
# @return [Array<(Submission, Fixnum, Hash)>] Submission data, response status code and response headers
|
|
362
412
|
def get_submission_with_http_info(submission_id, opts = {})
|
|
363
413
|
if @api_client.config.debugging
|
|
364
|
-
@api_client.config.logger.debug
|
|
414
|
+
@api_client.config.logger.debug 'Calling API: PDFApi.get_submission ...'
|
|
365
415
|
end
|
|
366
416
|
# verify the required parameter 'submission_id' is set
|
|
367
417
|
if @api_client.config.client_side_validation && submission_id.nil?
|
|
368
418
|
fail ArgumentError, "Missing the required parameter 'submission_id' when calling PDFApi.get_submission"
|
|
369
419
|
end
|
|
370
420
|
# resource path
|
|
371
|
-
local_var_path =
|
|
421
|
+
local_var_path = '/submissions/{submission_id}'.sub('{' + 'submission_id' + '}', submission_id.to_s)
|
|
372
422
|
|
|
373
423
|
# query parameters
|
|
374
424
|
query_params = {}
|
|
@@ -390,36 +440,100 @@ module FormAPI
|
|
|
390
440
|
:form_params => form_params,
|
|
391
441
|
:body => post_body,
|
|
392
442
|
:auth_names => auth_names,
|
|
393
|
-
:return_type => '
|
|
443
|
+
:return_type => 'Submission')
|
|
394
444
|
if @api_client.config.debugging
|
|
395
445
|
@api_client.config.logger.debug "API called: PDFApi#get_submission\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
396
446
|
end
|
|
397
447
|
return data, status_code, headers
|
|
398
448
|
end
|
|
399
449
|
|
|
450
|
+
# Check the status of a submission batch job
|
|
451
|
+
# @param submission_batch_id
|
|
452
|
+
# @param [Hash] opts the optional parameters
|
|
453
|
+
# @option opts [BOOLEAN] :include_submissions
|
|
454
|
+
# @return [SubmissionBatch]
|
|
455
|
+
def get_submission_batch(submission_batch_id, opts = {})
|
|
456
|
+
data, _status_code, _headers = get_submission_batch_with_http_info(submission_batch_id, opts)
|
|
457
|
+
data
|
|
458
|
+
end
|
|
459
|
+
|
|
460
|
+
# Check the status of a submission batch job
|
|
461
|
+
# @param submission_batch_id
|
|
462
|
+
# @param [Hash] opts the optional parameters
|
|
463
|
+
# @option opts [BOOLEAN] :include_submissions
|
|
464
|
+
# @return [Array<(SubmissionBatch, Fixnum, Hash)>] SubmissionBatch data, response status code and response headers
|
|
465
|
+
def get_submission_batch_with_http_info(submission_batch_id, opts = {})
|
|
466
|
+
if @api_client.config.debugging
|
|
467
|
+
@api_client.config.logger.debug 'Calling API: PDFApi.get_submission_batch ...'
|
|
468
|
+
end
|
|
469
|
+
# verify the required parameter 'submission_batch_id' is set
|
|
470
|
+
if @api_client.config.client_side_validation && submission_batch_id.nil?
|
|
471
|
+
fail ArgumentError, "Missing the required parameter 'submission_batch_id' when calling PDFApi.get_submission_batch"
|
|
472
|
+
end
|
|
473
|
+
# resource path
|
|
474
|
+
local_var_path = '/submissions/batches/{submission_batch_id}'.sub('{' + 'submission_batch_id' + '}', submission_batch_id.to_s)
|
|
475
|
+
|
|
476
|
+
# query parameters
|
|
477
|
+
query_params = {}
|
|
478
|
+
query_params[:'include_submissions'] = opts[:'include_submissions'] if !opts[:'include_submissions'].nil?
|
|
479
|
+
|
|
480
|
+
# header parameters
|
|
481
|
+
header_params = {}
|
|
482
|
+
# HTTP header 'Accept' (if needed)
|
|
483
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
484
|
+
|
|
485
|
+
# form parameters
|
|
486
|
+
form_params = {}
|
|
487
|
+
|
|
488
|
+
# http body (model)
|
|
489
|
+
post_body = nil
|
|
490
|
+
auth_names = ['api_token_basic']
|
|
491
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
|
492
|
+
:header_params => header_params,
|
|
493
|
+
:query_params => query_params,
|
|
494
|
+
:form_params => form_params,
|
|
495
|
+
:body => post_body,
|
|
496
|
+
:auth_names => auth_names,
|
|
497
|
+
:return_type => 'SubmissionBatch')
|
|
498
|
+
if @api_client.config.debugging
|
|
499
|
+
@api_client.config.logger.debug "API called: PDFApi#get_submission_batch\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
500
|
+
end
|
|
501
|
+
return data, status_code, headers
|
|
502
|
+
end
|
|
503
|
+
|
|
400
504
|
# Get a list of all templates
|
|
401
|
-
#
|
|
402
505
|
# @param [Hash] opts the optional parameters
|
|
403
506
|
# @option opts [Integer] :page Default: 1
|
|
404
507
|
# @option opts [Integer] :per_page Default: 50
|
|
405
|
-
# @return [Array<
|
|
508
|
+
# @return [Array<Template>]
|
|
406
509
|
def get_templates(opts = {})
|
|
407
510
|
data, _status_code, _headers = get_templates_with_http_info(opts)
|
|
408
|
-
|
|
511
|
+
data
|
|
409
512
|
end
|
|
410
513
|
|
|
411
514
|
# Get a list of all templates
|
|
412
|
-
#
|
|
413
515
|
# @param [Hash] opts the optional parameters
|
|
414
516
|
# @option opts [Integer] :page Default: 1
|
|
415
517
|
# @option opts [Integer] :per_page Default: 50
|
|
416
|
-
# @return [Array<(Array<
|
|
518
|
+
# @return [Array<(Array<Template>, Fixnum, Hash)>] Array<Template> data, response status code and response headers
|
|
417
519
|
def get_templates_with_http_info(opts = {})
|
|
418
520
|
if @api_client.config.debugging
|
|
419
|
-
@api_client.config.logger.debug
|
|
521
|
+
@api_client.config.logger.debug 'Calling API: PDFApi.get_templates ...'
|
|
522
|
+
end
|
|
523
|
+
if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1
|
|
524
|
+
fail ArgumentError, 'invalid value for "opts[:"page"]" when calling PDFApi.get_templates, must be greater than or equal to 1.'
|
|
525
|
+
end
|
|
526
|
+
|
|
527
|
+
if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] > 50
|
|
528
|
+
fail ArgumentError, 'invalid value for "opts[:"per_page"]" when calling PDFApi.get_templates, must be smaller than or equal to 50.'
|
|
529
|
+
end
|
|
530
|
+
|
|
531
|
+
if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] < 1
|
|
532
|
+
fail ArgumentError, 'invalid value for "opts[:"per_page"]" when calling PDFApi.get_templates, must be greater than or equal to 1.'
|
|
420
533
|
end
|
|
534
|
+
|
|
421
535
|
# resource path
|
|
422
|
-
local_var_path =
|
|
536
|
+
local_var_path = '/templates'
|
|
423
537
|
|
|
424
538
|
# query parameters
|
|
425
539
|
query_params = {}
|
|
@@ -443,7 +557,7 @@ module FormAPI
|
|
|
443
557
|
:form_params => form_params,
|
|
444
558
|
:body => post_body,
|
|
445
559
|
:auth_names => auth_names,
|
|
446
|
-
:return_type => 'Array<
|
|
560
|
+
:return_type => 'Array<Template>')
|
|
447
561
|
if @api_client.config.debugging
|
|
448
562
|
@api_client.config.logger.debug "API called: PDFApi#get_templates\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
449
563
|
end
|
|
@@ -451,24 +565,22 @@ module FormAPI
|
|
|
451
565
|
end
|
|
452
566
|
|
|
453
567
|
# Test Authentication
|
|
454
|
-
#
|
|
455
568
|
# @param [Hash] opts the optional parameters
|
|
456
|
-
# @return [
|
|
569
|
+
# @return [AuthenticationSuccessResponse]
|
|
457
570
|
def test_authentication(opts = {})
|
|
458
571
|
data, _status_code, _headers = test_authentication_with_http_info(opts)
|
|
459
|
-
|
|
572
|
+
data
|
|
460
573
|
end
|
|
461
574
|
|
|
462
575
|
# Test Authentication
|
|
463
|
-
#
|
|
464
576
|
# @param [Hash] opts the optional parameters
|
|
465
|
-
# @return [Array<(
|
|
577
|
+
# @return [Array<(AuthenticationSuccessResponse, Fixnum, Hash)>] AuthenticationSuccessResponse data, response status code and response headers
|
|
466
578
|
def test_authentication_with_http_info(opts = {})
|
|
467
579
|
if @api_client.config.debugging
|
|
468
|
-
@api_client.config.logger.debug
|
|
580
|
+
@api_client.config.logger.debug 'Calling API: PDFApi.test_authentication ...'
|
|
469
581
|
end
|
|
470
582
|
# resource path
|
|
471
|
-
local_var_path =
|
|
583
|
+
local_var_path = '/authentication'
|
|
472
584
|
|
|
473
585
|
# query parameters
|
|
474
586
|
query_params = {}
|
|
@@ -490,11 +602,12 @@ module FormAPI
|
|
|
490
602
|
:form_params => form_params,
|
|
491
603
|
:body => post_body,
|
|
492
604
|
:auth_names => auth_names,
|
|
493
|
-
:return_type => '
|
|
605
|
+
:return_type => 'AuthenticationSuccessResponse')
|
|
494
606
|
if @api_client.config.debugging
|
|
495
607
|
@api_client.config.logger.debug "API called: PDFApi#test_authentication\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
496
608
|
end
|
|
497
609
|
return data, status_code, headers
|
|
498
610
|
end
|
|
611
|
+
|
|
499
612
|
end
|
|
500
613
|
end
|