form_api 1.0.0 → 1.1.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.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +3 -3
  3. data/README.md +11 -5
  4. data/docs/CreateSubmissionBatchResponse.md +1 -1
  5. data/docs/{CreateSubmissionResponse1.md → CreateSubmissionBatchSubmissionsResponse.md} +1 -1
  6. data/docs/CreateSubmissionBatchV1SubmissionsResponse.md +10 -0
  7. data/docs/CreateSubmissionDataRequestTokenResponse.md +10 -0
  8. data/docs/CreateSubmissionDataRequestTokenResponseToken.md +11 -0
  9. data/docs/CreateSubmissionResponse.md +1 -0
  10. data/docs/PDFApi.md +102 -2
  11. data/docs/SubmissionDataRequest.md +16 -0
  12. data/form_api.gemspec +2 -2
  13. data/lib/form_api.rb +5 -1
  14. data/lib/form_api/api/client.rb +3 -3
  15. data/lib/form_api/api/pdf_api.rb +105 -3
  16. data/lib/form_api/api_client.rb +19 -2
  17. data/lib/form_api/models/create_submission_batch_response.rb +1 -1
  18. data/lib/form_api/models/{create_submission_response1.rb → create_submission_batch_submissions_response.rb} +1 -1
  19. data/lib/form_api/models/create_submission_batch_v1_submissions_response.rb +237 -0
  20. data/lib/form_api/models/create_submission_data_request_token_response.rb +237 -0
  21. data/lib/form_api/models/create_submission_data_request_token_response_token.rb +210 -0
  22. data/lib/form_api/models/create_submission_response.rb +12 -1
  23. data/lib/form_api/models/submission.rb +2 -2
  24. data/lib/form_api/models/submission_data_request.rb +336 -0
  25. data/lib/form_api/version.rb +1 -1
  26. data/spec/api/{client_spec.rb → client_integration_spec.rb} +20 -0
  27. data/spec/api/{pdf_api_spec.rb → pdf_api_integration_spec.rb} +39 -0
  28. data/spec/api/pdf_api_spec_original.skipped.rb +207 -0
  29. data/spec/configuration_spec.rb +11 -0
  30. data/spec/models/{create_submission_response1_spec.rb → create_submission_batch_submissions_response_spec.rb} +6 -6
  31. data/spec/models/create_submission_batch_v1_submissions_response_spec.rb +57 -0
  32. data/spec/models/create_submission_data_request_token_response_spec.rb +57 -0
  33. data/spec/models/create_submission_data_request_token_response_token_spec.rb +59 -0
  34. data/spec/models/create_submission_response_spec.rb +6 -0
  35. data/spec/models/submission_data_request_spec.rb +93 -0
  36. data/spec/models/submission_spec.rb +1 -1
  37. data/spec/spec_helper.rb +3 -0
  38. metadata +31 -13
@@ -11,5 +11,5 @@ OpenAPI Generator version: 3.3.0-SNAPSHOT
11
11
  =end
12
12
 
13
13
  module FormAPI
14
- VERSION = '1.0.0'
14
+ VERSION = '1.1.0'
15
15
  end
@@ -32,6 +32,26 @@ describe FormAPI::Client do
32
32
  expect(submission.state).to eq 'processed'
33
33
  expect(submission.download_url).to include 'submissions/submission.pdf'
34
34
  end
35
+
36
+ it 'should handle invalid data errors' do
37
+ client = FormAPI::Client.new
38
+ template_id = 'tpl_000000000000000001'
39
+
40
+ expect(client).to_not receive(:sleep)
41
+
42
+ expect {
43
+ client.generate_pdf(
44
+ template_id: template_id,
45
+ data: {
46
+ title: 'Test PDF'
47
+ }
48
+ )
49
+ }.to raise_error(
50
+ FormAPI::ApiError,
51
+ 'Unprocessable Entity: The root object did not contain a ' \
52
+ "required property of 'description'"
53
+ )
54
+ end
35
55
  end
36
56
 
37
57
  describe '#batch_generate_pdfs' do
@@ -140,6 +140,25 @@ describe 'PDFApi' do
140
140
  expect(response.combined_submission.state).to eq 'pending'
141
141
  end
142
142
  end
143
+ # integration tests for create_data_request_token
144
+ # Creates a new data request token for form authentication
145
+ # @param data_request_id
146
+ # @param [Hash] opts the optional parameters
147
+ # @return [CreateSubmissionDataRequestTokenResponse]
148
+ describe 'create_data_request_token test' do
149
+ it 'should work' do
150
+ data_request_id = 'drq_000000000000000001' # String |
151
+ response = api_instance.create_data_request_token(data_request_id)
152
+ expect(response.status).to eq 'success'
153
+ expect(response.token.id).to_not be_nil
154
+ expect(response.token.secret).to_not be_nil
155
+ expect(response.token.data_request_url).to start_with \
156
+ 'http://localhost/data_requests/drq_000000000000000001?token_id='
157
+ expect(response.token.data_request_url).to include \
158
+ "?token_id=#{response.token.id}" \
159
+ "&token_secret=#{response.token.secret}"
160
+ end
161
+ end
143
162
  # integration tests for expire_combined_submission
144
163
  # Expire a combined submission
145
164
  # @param combined_submission_id
@@ -197,6 +216,26 @@ describe 'PDFApi' do
197
216
  expect(combined_submission.id).to start_with 'com_'
198
217
  end
199
218
  end
219
+ # integration tests for get_data_request
220
+ # Look up a submission data request
221
+ # @param data_request_id
222
+ # @param [Hash] opts the optional parameters
223
+ # @return [SubmissionDataRequest]
224
+ describe 'get_data_request test' do
225
+ it 'should work' do
226
+ data_request_id = 'drq_000000000000000001' # String |
227
+ data_request = api_instance.get_data_request(data_request_id)
228
+ expect(data_request.id).to start_with 'drq_'
229
+ expect(data_request.order).to eq 1
230
+ expect(data_request.name).to eq 'John Doe'
231
+ expect(data_request.email).to eq 'jdoe@example.com'
232
+ expect(data_request.fields).to eq ['description']
233
+ expect(data_request.metadata).to eq(user_id: 123)
234
+ expect(data_request.state).to eq 'pending'
235
+ expect(data_request.viewed_at).to eq '2018-10-23T13:00:00Z'
236
+ expect(data_request.completed_at).to be_nil
237
+ end
238
+ end
200
239
  # integration tests for get_submission
201
240
  # Check the status of a PDF
202
241
  # @param submission_id
@@ -0,0 +1,207 @@
1
+ =begin
2
+ #API V1
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ OpenAPI spec version: v1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 3.3.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+
16
+ # Unit tests for FormAPI::PDFApi
17
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
18
+ # Please update as you see appropriate
19
+ describe 'PDFApi' do
20
+ before do
21
+ FormAPI.configure do |c|
22
+ c.username = 'api_token123'
23
+ c.password = 'testsecret123'
24
+ c.host = 'localhost:31337'
25
+ c.scheme = 'http'
26
+ end
27
+ end
28
+
29
+ let(:api_instance) { FormAPI::PDFApi.new }
30
+
31
+ after do
32
+ # run after each test
33
+ end
34
+
35
+ describe 'test an instance of PDFApi' do
36
+ it 'should create an instance of PDFApi' do
37
+ expect(api_instance).to be_instance_of(FormAPI::PDFApi)
38
+ end
39
+ end
40
+
41
+ # integration tests for batch_generate_pdf_v1
42
+ # Generates multiple PDFs
43
+ # @param template_id
44
+ # @param create_submission_data
45
+ # @param [Hash] opts the optional parameters
46
+ # @return [Array<CreateSubmissionBatchV1SubmissionsResponse>]
47
+ describe 'batch_generate_pdf_v1 test' do
48
+ it 'should work' do
49
+ template_id = 'tpl_000000000000000001' # String |
50
+ create_submission_data = nil # Array<CreateSubmissionData> |
51
+ result = api_instance.batch_generate_pdf_v1(template_id, create_submission_data)
52
+ expect(result).to_not be_nil
53
+ end
54
+ end
55
+ # integration tests for batch_generate_pdfs
56
+ # Generates multiple PDFs
57
+ # @param submission_batch_data
58
+ # @param [Hash] opts the optional parameters
59
+ # @return [CreateSubmissionBatchResponse]
60
+ describe 'batch_generate_pdfs test' do
61
+ it 'should work' do
62
+ submission_batch_data = FormAPI::SubmissionBatchData.new # SubmissionBatchData |
63
+ result = api_instance.batch_generate_pdfs(submission_batch_data)
64
+ expect(result).to_not be_nil
65
+ end
66
+ end
67
+ # integration tests for combine_submissions
68
+ # Merge generated PDFs together
69
+ # @param combined_submission_data
70
+ # @param [Hash] opts the optional parameters
71
+ # @return [CreateCombinedSubmissionResponse]
72
+ describe 'combine_submissions test' do
73
+ it 'should work' do
74
+ combined_submission_data = FormAPI::CombinedSubmissionData.new # CombinedSubmissionData |
75
+ result = api_instance.combine_submissions(combined_submission_data)
76
+ expect(result).to_not be_nil
77
+ end
78
+ end
79
+ # integration tests for create_data_request_token
80
+ # Creates a new data request token for form authentication
81
+ # @param data_request_id
82
+ # @param [Hash] opts the optional parameters
83
+ # @return [CreateSubmissionDataRequestTokenResponse]
84
+ describe 'create_data_request_token test' do
85
+ it 'should work' do
86
+ data_request_id = 'drq_000000000000000001' # String |
87
+ result = api_instance.create_data_request_token(data_request_id)
88
+ expect(result).to_not be_nil
89
+ end
90
+ end
91
+ # integration tests for expire_combined_submission
92
+ # Expire a combined submission
93
+ # @param combined_submission_id
94
+ # @param [Hash] opts the optional parameters
95
+ # @return [CombinedSubmission]
96
+ describe 'expire_combined_submission test' do
97
+ it 'should work' do
98
+ combined_submission_id = 'com_000000000000000001' # String |
99
+ result = api_instance.expire_combined_submission(combined_submission_id)
100
+ expect(result).to_not be_nil
101
+ end
102
+ end
103
+ # integration tests for expire_submission
104
+ # Expire a PDF submission
105
+ # @param submission_id
106
+ # @param [Hash] opts the optional parameters
107
+ # @return [Submission]
108
+ describe 'expire_submission test' do
109
+ it 'should work' do
110
+ submission_id = 'sub_000000000000000001' # String |
111
+ result = api_instance.expire_submission(submission_id)
112
+ expect(result).to_not be_nil
113
+ end
114
+ end
115
+ # integration tests for generate_pdf
116
+ # Generates a new PDF
117
+ # @param template_id
118
+ # @param create_submission_data
119
+ # @param [Hash] opts the optional parameters
120
+ # @return [CreateSubmissionResponse]
121
+ describe 'generate_pdf test' do
122
+ it 'should work' do
123
+ template_id = 'tpl_000000000000000001' # String |
124
+ create_submission_data = FormAPI::CreateSubmissionData.new # CreateSubmissionData |
125
+ result = api_instance.generate_pdf(template_id, create_submission_data)
126
+ expect(result).to_not be_nil
127
+ end
128
+ end
129
+ # integration tests for get_combined_submission
130
+ # Check the status of a combined submission (merged PDFs)
131
+ # @param combined_submission_id
132
+ # @param [Hash] opts the optional parameters
133
+ # @return [CombinedSubmission]
134
+ describe 'get_combined_submission test' do
135
+ it 'should work' do
136
+ combined_submission_id = 'com_000000000000000001' # String |
137
+ result = api_instance.get_combined_submission(combined_submission_id)
138
+ expect(result).to_not be_nil
139
+ end
140
+ end
141
+ # integration tests for get_data_request
142
+ # Look up a submission data request
143
+ # @param data_request_id
144
+ # @param [Hash] opts the optional parameters
145
+ # @return [SubmissionDataRequest]
146
+ describe 'get_data_request test' do
147
+ it 'should work' do
148
+ data_request_id = 'drq_000000000000000001' # String |
149
+ result = api_instance.get_data_request(data_request_id)
150
+ expect(result).to_not be_nil
151
+ end
152
+ end
153
+ # integration tests for get_submission
154
+ # Check the status of a PDF
155
+ # @param submission_id
156
+ # @param [Hash] opts the optional parameters
157
+ # @return [Submission]
158
+ describe 'get_submission test' do
159
+ it 'should work' do
160
+ submission_id = 'sub_000000000000000001' # String |
161
+ result = api_instance.get_submission(submission_id)
162
+ expect(result).to_not be_nil
163
+ end
164
+ end
165
+ # integration tests for get_submission_batch
166
+ # Check the status of a submission batch job
167
+ # @param submission_batch_id
168
+ # @param [Hash] opts the optional parameters
169
+ # @option opts [BOOLEAN] :include_submissions
170
+ # @return [SubmissionBatch]
171
+ describe 'get_submission_batch test' do
172
+ it 'should work' do
173
+ submission_batch_id = 'sba_000000000000000001' # String |
174
+ opts = {
175
+ include_submissions: true # BOOLEAN |
176
+ }
177
+ result = api_instance.get_submission_batch(submission_batch_id, opts)
178
+ expect(result).to_not be_nil
179
+ end
180
+ end
181
+ # integration tests for get_templates
182
+ # Get a list of all templates
183
+ # @param [Hash] opts the optional parameters
184
+ # @option opts [Integer] :page Default: 1
185
+ # @option opts [Integer] :per_page Default: 50
186
+ # @return [Array<Template>]
187
+ describe 'get_templates test' do
188
+ it 'should work' do
189
+ opts = {
190
+ page: 2, # Integer | Default: 1
191
+ per_page: 1 # Integer | Default: 50
192
+ }
193
+ result = api_instance.get_templates(opts)
194
+ expect(result).to_not be_nil
195
+ end
196
+ end
197
+ # integration tests for test_authentication
198
+ # Test Authentication
199
+ # @param [Hash] opts the optional parameters
200
+ # @return [AuthenticationSuccessResponse]
201
+ describe 'test_authentication test' do
202
+ it 'should work' do
203
+ result = api_instance.test_authentication
204
+ expect(result).to_not be_nil
205
+ end
206
+ end
207
+ end
@@ -14,6 +14,7 @@ require 'spec_helper'
14
14
 
15
15
  describe FormAPI::Configuration do
16
16
  let(:config) { FormAPI::Configuration.default }
17
+ let(:new_config) { FormAPI::Configuration.new }
17
18
 
18
19
  before(:each) do
19
20
  # uncomment below to setup host and base_path
@@ -25,6 +26,16 @@ describe FormAPI::Configuration do
25
26
  # end
26
27
  end
27
28
 
29
+ it 'adds aliases for #api_token_*, and loads the api token from ENV variables' do
30
+ ENV['FORMAPI_TOKEN_ID'] = 'test_token_id_from_env'
31
+ ENV['FORMAPI_TOKEN_SECRET'] = 'test_token_secret_from_env'
32
+
33
+ expect(new_config.username).to eq 'test_token_id_from_env'
34
+ expect(new_config.api_token_id).to eq 'test_token_id_from_env'
35
+ expect(new_config.password).to eq 'test_token_secret_from_env'
36
+ expect(new_config.api_token_secret).to eq 'test_token_secret_from_env'
37
+ end
38
+
28
39
  describe '#base_url' do
29
40
  it 'should have the default value' do
30
41
  # uncomment below to test default value of the base path
@@ -14,22 +14,22 @@ require 'spec_helper'
14
14
  require 'json'
15
15
  require 'date'
16
16
 
17
- # Unit tests for FormAPI::CreateSubmissionResponse1
17
+ # Unit tests for FormAPI::CreateSubmissionBatchSubmissionsResponse
18
18
  # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
19
  # Please update as you see appropriate
20
- describe 'CreateSubmissionResponse1' do
20
+ describe 'CreateSubmissionBatchSubmissionsResponse' do
21
21
  before do
22
22
  # run before each test
23
- @instance = FormAPI::CreateSubmissionResponse1.new
23
+ @instance = FormAPI::CreateSubmissionBatchSubmissionsResponse.new
24
24
  end
25
25
 
26
26
  after do
27
27
  # run after each test
28
28
  end
29
29
 
30
- describe 'test an instance of CreateSubmissionResponse1' do
31
- it 'should create an instance of CreateSubmissionResponse1' do
32
- expect(@instance).to be_instance_of(FormAPI::CreateSubmissionResponse1)
30
+ describe 'test an instance of CreateSubmissionBatchSubmissionsResponse' do
31
+ it 'should create an instance of CreateSubmissionBatchSubmissionsResponse' do
32
+ expect(@instance).to be_instance_of(FormAPI::CreateSubmissionBatchSubmissionsResponse)
33
33
  end
34
34
  end
35
35
  describe 'test attribute "submission"' do
@@ -0,0 +1,57 @@
1
+ =begin
2
+ #API V1
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ OpenAPI spec version: v1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 3.3.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+ require 'date'
16
+
17
+ # Unit tests for FormAPI::CreateSubmissionBatchV1SubmissionsResponse
18
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
+ # Please update as you see appropriate
20
+ describe 'CreateSubmissionBatchV1SubmissionsResponse' do
21
+ before do
22
+ # run before each test
23
+ @instance = FormAPI::CreateSubmissionBatchV1SubmissionsResponse.new
24
+ end
25
+
26
+ after do
27
+ # run after each test
28
+ end
29
+
30
+ describe 'test an instance of CreateSubmissionBatchV1SubmissionsResponse' do
31
+ it 'should create an instance of CreateSubmissionBatchV1SubmissionsResponse' do
32
+ expect(@instance).to be_instance_of(FormAPI::CreateSubmissionBatchV1SubmissionsResponse)
33
+ end
34
+ end
35
+ describe 'test attribute "submission"' do
36
+ it 'should work' do
37
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
38
+ end
39
+ end
40
+
41
+ describe 'test attribute "errors"' do
42
+ it 'should work' do
43
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
44
+ end
45
+ end
46
+
47
+ describe 'test attribute "status"' do
48
+ it 'should work' do
49
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
50
+ # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["success", "error"])
51
+ # validator.allowable_values.each do |value|
52
+ # expect { @instance.status = value }.not_to raise_error
53
+ # end
54
+ end
55
+ end
56
+
57
+ end
@@ -0,0 +1,57 @@
1
+ =begin
2
+ #API V1
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ OpenAPI spec version: v1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 3.3.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+ require 'date'
16
+
17
+ # Unit tests for FormAPI::CreateSubmissionDataRequestTokenResponse
18
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
+ # Please update as you see appropriate
20
+ describe 'CreateSubmissionDataRequestTokenResponse' do
21
+ before do
22
+ # run before each test
23
+ @instance = FormAPI::CreateSubmissionDataRequestTokenResponse.new
24
+ end
25
+
26
+ after do
27
+ # run after each test
28
+ end
29
+
30
+ describe 'test an instance of CreateSubmissionDataRequestTokenResponse' do
31
+ it 'should create an instance of CreateSubmissionDataRequestTokenResponse' do
32
+ expect(@instance).to be_instance_of(FormAPI::CreateSubmissionDataRequestTokenResponse)
33
+ end
34
+ end
35
+ describe 'test attribute "errors"' do
36
+ it 'should work' do
37
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
38
+ end
39
+ end
40
+
41
+ describe 'test attribute "status"' do
42
+ it 'should work' do
43
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
44
+ # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["success", "error"])
45
+ # validator.allowable_values.each do |value|
46
+ # expect { @instance.status = value }.not_to raise_error
47
+ # end
48
+ end
49
+ end
50
+
51
+ describe 'test attribute "token"' do
52
+ it 'should work' do
53
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
54
+ end
55
+ end
56
+
57
+ end