docspring 1.1.0 → 1.2.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 (55) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/Gemfile.lock +1 -1
  4. data/README.md +20 -15
  5. data/docs/AddFieldsData.md +8 -0
  6. data/docs/AddFieldsTemplateResponse.md +10 -0
  7. data/docs/CreateHtmlTemplateData.md +8 -0
  8. data/docs/CreateTemplateFromUploadData.md +8 -0
  9. data/docs/{TemplatesdesccachedUploadTemplate.md → HtmlTemplateData.md} +1 -2
  10. data/docs/PDFApi.md +60 -8
  11. data/docs/PendingTemplate.md +1 -0
  12. data/docs/Submission.md +1 -0
  13. data/docs/Template.md +1 -0
  14. data/docs/{TemplatestemplateIdTemplate.md → TemplateData.md} +1 -1
  15. data/docs/TemplatestemplateIdaddFieldsFields.md +92 -0
  16. data/docs/UpdateTemplateData.md +1 -1
  17. data/docs/UploadTemplateData.md +25 -0
  18. data/docs/UploadTemplateDataDocument.md +10 -0
  19. data/docs/{TemplatesdesccachedUploadTemplateDocumentMetadata.md → UploadTemplateDataDocumentMetadata.md} +1 -1
  20. data/lib/docspring.rb +10 -6
  21. data/lib/docspring/api/pdf_api.rb +77 -18
  22. data/lib/docspring/models/add_fields_data.rb +190 -0
  23. data/lib/docspring/models/add_fields_template_response.rb +239 -0
  24. data/lib/docspring/models/{create_template_data.rb → create_html_template_data.rb} +2 -2
  25. data/lib/docspring/models/{create_template_data1.rb → create_template_from_upload_data.rb} +2 -2
  26. data/lib/docspring/models/html_template_data.rb +373 -0
  27. data/lib/docspring/models/pending_template.rb +10 -1
  28. data/lib/docspring/models/submission.rb +10 -1
  29. data/lib/docspring/models/template.rb +10 -1
  30. data/lib/docspring/models/{templatestemplate_id_template.rb → template_data.rb} +1 -1
  31. data/lib/docspring/models/templatestemplate_idadd_fields_fields.rb +1306 -0
  32. data/lib/docspring/models/update_template_data.rb +1 -1
  33. data/lib/docspring/models/{templatesdesccached_upload_template.rb → upload_template_data.rb} +2 -2
  34. data/lib/docspring/models/{templatesdesccached_upload_template_document.rb → upload_template_data_document.rb} +2 -2
  35. data/lib/docspring/models/{templatesdesccached_upload_template_document_metadata.rb → upload_template_data_document_metadata.rb} +1 -1
  36. data/lib/docspring/version.rb +1 -1
  37. data/spec/api/pdf_api_integration_spec.rb +49 -18
  38. data/spec/api/pdf_api_spec_original.skipped.rb +20 -6
  39. data/spec/models/add_fields_data_spec.rb +41 -0
  40. data/spec/models/add_fields_template_response_spec.rb +57 -0
  41. data/spec/models/{create_template_data_spec.rb → create_html_template_data_spec.rb} +6 -6
  42. data/spec/models/{create_template_data1_spec.rb → create_template_from_upload_data_spec.rb} +6 -6
  43. data/spec/models/html_template_data_spec.rb +145 -0
  44. data/spec/models/pending_template_spec.rb +6 -0
  45. data/spec/models/submission_spec.rb +6 -0
  46. data/spec/models/{templatestemplate_id_template_spec.rb → template_data_spec.rb} +6 -6
  47. data/spec/models/template_spec.rb +6 -0
  48. data/spec/models/templatestemplate_idadd_fields_fields_spec.rb +589 -0
  49. data/spec/models/{templatesdesccached_upload_template_document_metadata_spec.rb → upload_template_data_document_metadata_spec.rb} +6 -6
  50. data/spec/models/{templatesdesccached_upload_template_document_spec.rb → upload_template_data_document_spec.rb} +6 -6
  51. data/spec/models/{templatesdesccached_upload_template_spec.rb → upload_template_data_spec.rb} +6 -6
  52. metadata +42 -26
  53. data/docs/CreateTemplateData.md +0 -8
  54. data/docs/CreateTemplateData1.md +0 -8
  55. data/docs/TemplatesdesccachedUploadTemplateDocument.md +0 -10
@@ -26,7 +26,7 @@ module DocSpring
26
26
  # Attribute type mapping.
27
27
  def self.openapi_types
28
28
  {
29
- :'template' => :'TemplatestemplateIdTemplate'
29
+ :'template' => :'TemplateData'
30
30
  }
31
31
  end
32
32
 
@@ -13,7 +13,7 @@ OpenAPI Generator version: 3.3.0-SNAPSHOT
13
13
  require 'date'
14
14
 
15
15
  module DocSpring
16
- class TemplatesdesccachedUploadTemplate
16
+ class UploadTemplateData
17
17
  attr_accessor :expiration_interval
18
18
 
19
19
  attr_accessor :webhook_url
@@ -104,7 +104,7 @@ module DocSpring
104
104
  :'scss' => :'String',
105
105
  :'expire_after' => :'Float',
106
106
  :'allow_additional_properties' => :'BOOLEAN',
107
- :'document' => :'TemplatesdesccachedUploadTemplateDocument',
107
+ :'document' => :'UploadTemplateDataDocument',
108
108
  :'description' => :'String',
109
109
  :'public_submissions' => :'BOOLEAN',
110
110
  :'slack_webhook_url' => :'String',
@@ -13,7 +13,7 @@ OpenAPI Generator version: 3.3.0-SNAPSHOT
13
13
  require 'date'
14
14
 
15
15
  module DocSpring
16
- class TemplatesdesccachedUploadTemplateDocument
16
+ class UploadTemplateDataDocument
17
17
  attr_accessor :metadata
18
18
 
19
19
  attr_accessor :id
@@ -54,7 +54,7 @@ module DocSpring
54
54
  # Attribute type mapping.
55
55
  def self.openapi_types
56
56
  {
57
- :'metadata' => :'TemplatesdesccachedUploadTemplateDocumentMetadata',
57
+ :'metadata' => :'UploadTemplateDataDocumentMetadata',
58
58
  :'id' => :'String',
59
59
  :'storage' => :'String'
60
60
  }
@@ -13,7 +13,7 @@ OpenAPI Generator version: 3.3.0-SNAPSHOT
13
13
  require 'date'
14
14
 
15
15
  module DocSpring
16
- class TemplatesdesccachedUploadTemplateDocumentMetadata
16
+ class UploadTemplateDataDocumentMetadata
17
17
  attr_accessor :filename
18
18
 
19
19
  attr_accessor :size
@@ -11,5 +11,5 @@ OpenAPI Generator version: 3.3.0-SNAPSHOT
11
11
  =end
12
12
 
13
13
  module DocSpring
14
- VERSION = '1.1.0'
14
+ VERSION = '1.2.0'
15
15
  end
@@ -25,7 +25,7 @@ describe 'PDFApi' do
25
25
  end
26
26
  end
27
27
 
28
- let(:api_instance) { DocSpring::PDFApi.new }
28
+ let(:client) { DocSpring::PDFApi.new }
29
29
 
30
30
  after do
31
31
  # run after each test
@@ -40,7 +40,7 @@ describe 'PDFApi' do
40
40
  describe 'batch_generate_pdf v1 test' do
41
41
  it 'should work' do
42
42
  template_id = 'tpl_000000000000000001'
43
- responses = api_instance.batch_generate_pdf_v1(template_id, [
43
+ responses = client.batch_generate_pdf_v1(template_id, [
44
44
  {
45
45
  data: {
46
46
  title: 'Test PDF',
@@ -67,7 +67,7 @@ describe 'PDFApi' do
67
67
  describe 'batch_generate_pdfs v2 test' do
68
68
  it 'should work' do
69
69
  template_id = 'tpl_000000000000000001'
70
- response = api_instance.batch_generate_pdfs(
70
+ response = client.batch_generate_pdfs(
71
71
  metadata: { user_id: 123 },
72
72
  test: true,
73
73
  submissions: [
@@ -109,7 +109,7 @@ describe 'PDFApi' do
109
109
  describe 'get_submission_batch test' do
110
110
  it 'should get the batch including submissions' do
111
111
  submission_batch_id = 'sbb_000000000000000001'
112
- batch = api_instance.get_submission_batch(submission_batch_id, include_submissions: true)
112
+ batch = client.get_submission_batch(submission_batch_id, include_submissions: true)
113
113
  expect(batch.id).to eq 'sbb_000000000000000001'
114
114
  expect(batch.total_count).to eq 2
115
115
  expect(batch.pending_count).to eq 0
@@ -120,12 +120,43 @@ describe 'PDFApi' do
120
120
 
121
121
  it 'should get the batch without submissions' do
122
122
  submission_batch_id = 'sbb_000000000000000001'
123
- batch = api_instance.get_submission_batch(submission_batch_id)
123
+ batch = client.get_submission_batch(submission_batch_id)
124
124
  expect(batch.id).to eq 'sbb_000000000000000001'
125
125
  expect(batch.submissions).to be_nil
126
126
  end
127
127
  end
128
128
 
129
+ it 'should add fields to a template' do
130
+ template_id = 'tpl_000000000000000001'
131
+
132
+ response = client.add_fields_to_template(
133
+ template_id,
134
+ fields: [
135
+ {
136
+ name: 'new_field1',
137
+ page: 1,
138
+ required: false,
139
+ },
140
+ {
141
+ name: 'new_field2',
142
+ type: 'number',
143
+ page: 1,
144
+ required: false,
145
+ },
146
+ {
147
+ name: 'new_field3',
148
+ type: 'date',
149
+ page: 1,
150
+ required: false,
151
+ x: 300,
152
+ },
153
+ ]
154
+ )
155
+ expect(response.status).to eq 'success'
156
+ expect(response.new_field_ids).to eq [3, 4, 5]
157
+ expect(response.new_field_ids[0].class).to eq Integer
158
+ end
159
+
129
160
  # integration tests for combine_submissions
130
161
  # Merge generated PDFs together
131
162
  # @param [Hash] opts the optional parameters
@@ -133,7 +164,7 @@ describe 'PDFApi' do
133
164
  # @return [CreateCombinedSubmissionResponse]
134
165
  describe 'combine_submissions test' do
135
166
  it 'should work' do
136
- response = api_instance.combine_submissions(
167
+ response = client.combine_submissions(
137
168
  submission_ids: %w[sub_000000000000000001 sub_000000000000000002])
138
169
  expect(response.status).to eq 'success'
139
170
  expect(response.combined_submission.id).to start_with 'com_'
@@ -148,7 +179,7 @@ describe 'PDFApi' do
148
179
  describe 'create_data_request_token test' do
149
180
  it 'should work' do
150
181
  data_request_id = 'drq_000000000000000001' # String |
151
- response = api_instance.create_data_request_token(data_request_id)
182
+ response = client.create_data_request_token(data_request_id)
152
183
  expect(response.status).to eq 'success'
153
184
  expect(response.token.id).to_not be_nil
154
185
  expect(response.token.secret).to_not be_nil
@@ -167,7 +198,7 @@ describe 'PDFApi' do
167
198
  describe 'expire_combined_submission test' do
168
199
  it 'should work' do
169
200
  combined_submission_id = 'com_000000000000000001'
170
- combined_submission = api_instance.expire_combined_submission(combined_submission_id)
201
+ combined_submission = client.expire_combined_submission(combined_submission_id)
171
202
  expect(combined_submission.expired).to eq true
172
203
  end
173
204
  end
@@ -179,7 +210,7 @@ describe 'PDFApi' do
179
210
  describe 'expire_submission test' do
180
211
  it 'should work' do
181
212
  submission_id = 'sub_000000000000000001'
182
- submission = api_instance.expire_submission(submission_id)
213
+ submission = client.expire_submission(submission_id)
183
214
  expect(submission.expired).to eq true
184
215
  end
185
216
  end
@@ -192,7 +223,7 @@ describe 'PDFApi' do
192
223
  describe 'generate_pdf test' do
193
224
  it 'should work' do
194
225
  template_id = 'tpl_000000000000000001'
195
- response = api_instance.generate_pdf(template_id,
226
+ response = client.generate_pdf(template_id,
196
227
  data: {
197
228
  title: 'Test PDF',
198
229
  description: 'This PDF is great!',
@@ -213,7 +244,7 @@ describe 'PDFApi' do
213
244
  describe 'generate_pdf test with data_requests' do
214
245
  it 'should work' do
215
246
  template_id = 'tpl_000000000000000001'
216
- response = api_instance.generate_pdf(template_id,
247
+ response = client.generate_pdf(template_id,
217
248
  data: {
218
249
  title: 'Test PDF',
219
250
  },
@@ -254,7 +285,7 @@ describe 'PDFApi' do
254
285
  describe 'get_combined_submission test' do
255
286
  it 'should work' do
256
287
  combined_submission_id = 'com_000000000000000001'
257
- combined_submission = api_instance.get_combined_submission(combined_submission_id)
288
+ combined_submission = client.get_combined_submission(combined_submission_id)
258
289
  expect(combined_submission.id).to start_with 'com_'
259
290
  end
260
291
  end
@@ -266,7 +297,7 @@ describe 'PDFApi' do
266
297
  describe 'get_data_request test' do
267
298
  it 'should work' do
268
299
  data_request_id = 'drq_000000000000000001' # String |
269
- data_request = api_instance.get_data_request(data_request_id)
300
+ data_request = client.get_data_request(data_request_id)
270
301
  expect(data_request.id).to start_with 'drq_'
271
302
  expect(data_request.order).to eq 1
272
303
  expect(data_request.name).to eq 'John Doe'
@@ -287,7 +318,7 @@ describe 'PDFApi' do
287
318
  describe 'update_data_request test' do
288
319
  it 'should work' do
289
320
  data_request_id = 'drq_000000000000000001' # String |
290
- response = api_instance.update_data_request(
321
+ response = client.update_data_request(
291
322
  data_request_id,
292
323
  name: 'Harry Smith',
293
324
  email: 'hsmith@example.com',
@@ -323,7 +354,7 @@ describe 'PDFApi' do
323
354
  describe 'get_submission test' do
324
355
  it 'should work' do
325
356
  submission_id = 'sub_000000000000000001'
326
- submission = api_instance.get_submission(submission_id)
357
+ submission = client.get_submission(submission_id)
327
358
  expect(submission.id).to start_with 'sub_'
328
359
  end
329
360
  end
@@ -340,7 +371,7 @@ describe 'PDFApi' do
340
371
  page: 1, # Integer | Default: 1
341
372
  per_page: 10 # Integer | Default: 50
342
373
  }
343
- templates = api_instance.list_templates(opts)
374
+ templates = client.list_templates(opts)
344
375
  expect(templates.size).to eq 1
345
376
  expect(templates.first.id).to eq 'tpl_000000000000000002'
346
377
  end
@@ -359,7 +390,7 @@ describe 'PDFApi' do
359
390
  page: 2, # Integer | Default: 1
360
391
  per_page: 1 # Integer | Default: 50
361
392
  }
362
- result = api_instance.list_templates(opts)
393
+ result = client.list_templates(opts)
363
394
  expect(result).to_not be_nil
364
395
  end
365
396
  end
@@ -370,7 +401,7 @@ describe 'PDFApi' do
370
401
  # @return [AuthenticationSuccessResponse]
371
402
  describe 'test_authentication test' do
372
403
  it 'should work' do
373
- response = api_instance.test_authentication
404
+ response = client.test_authentication
374
405
  expect(response.status).to eq 'success'
375
406
  end
376
407
  end
@@ -38,6 +38,20 @@ describe 'PDFApi' do
38
38
  end
39
39
  end
40
40
 
41
+ # integration tests for add_fields_to_template
42
+ # Add new fields to a Template
43
+ # @param template_id
44
+ # @param add_fields_data
45
+ # @param [Hash] opts the optional parameters
46
+ # @return [AddFieldsTemplateResponse]
47
+ describe 'add_fields_to_template test' do
48
+ it 'should work' do
49
+ template_id = 'tpl_000000000000000002' # String |
50
+ add_fields_data = DocSpring::AddFieldsData.new # AddFieldsData |
51
+ result = api_instance.add_fields_to_template(template_id, add_fields_data)
52
+ expect(result).to_not be_nil
53
+ end
54
+ end
41
55
  # integration tests for batch_generate_pdf_v1
42
56
  # Generates multiple PDFs
43
57
  # @param template_id
@@ -126,13 +140,13 @@ describe 'PDFApi' do
126
140
  end
127
141
  # integration tests for create_html_template
128
142
  # Create a new HTML template
129
- # @param create_template_data1
143
+ # @param create_html_template_data
130
144
  # @param [Hash] opts the optional parameters
131
145
  # @return [PendingTemplate]
132
146
  describe 'create_html_template test' do
133
147
  it 'should work' do
134
- create_template_data1 = DocSpring::CreateTemplateData1.new # CreateTemplateData1 |
135
- result = api_instance.create_html_template(create_template_data1)
148
+ create_html_template_data = DocSpring::CreateHtmlTemplateData.new # CreateHtmlTemplateData |
149
+ result = api_instance.create_html_template(create_html_template_data)
136
150
  expect(result).to_not be_nil
137
151
  end
138
152
  end
@@ -156,13 +170,13 @@ describe 'PDFApi' do
156
170
  end
157
171
  # integration tests for create_pdf_template_from_upload
158
172
  # Create a new PDF template from a cached presign upload
159
- # @param create_template_data
173
+ # @param create_template_from_upload_data
160
174
  # @param [Hash] opts the optional parameters
161
175
  # @return [PendingTemplate]
162
176
  describe 'create_pdf_template_from_upload test' do
163
177
  it 'should work' do
164
- create_template_data = DocSpring::CreateTemplateData.new # CreateTemplateData |
165
- result = api_instance.create_pdf_template_from_upload(create_template_data)
178
+ create_template_from_upload_data = DocSpring::CreateTemplateFromUploadData.new # CreateTemplateFromUploadData |
179
+ result = api_instance.create_pdf_template_from_upload(create_template_from_upload_data)
166
180
  expect(result).to_not be_nil
167
181
  end
168
182
  end
@@ -0,0 +1,41 @@
1
+ =begin
2
+ #API v1
3
+
4
+ #DocSpring is a service that helps you fill out and sign PDF templates.
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 DocSpring::AddFieldsData
18
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
+ # Please update as you see appropriate
20
+ describe 'AddFieldsData' do
21
+ before do
22
+ # run before each test
23
+ @instance = DocSpring::AddFieldsData.new
24
+ end
25
+
26
+ after do
27
+ # run after each test
28
+ end
29
+
30
+ describe 'test an instance of AddFieldsData' do
31
+ it 'should create an instance of AddFieldsData' do
32
+ expect(@instance).to be_instance_of(DocSpring::AddFieldsData)
33
+ end
34
+ end
35
+ describe 'test attribute "fields"' 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
+ end
@@ -0,0 +1,57 @@
1
+ =begin
2
+ #API v1
3
+
4
+ #DocSpring is a service that helps you fill out and sign PDF templates.
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 DocSpring::AddFieldsTemplateResponse
18
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
+ # Please update as you see appropriate
20
+ describe 'AddFieldsTemplateResponse' do
21
+ before do
22
+ # run before each test
23
+ @instance = DocSpring::AddFieldsTemplateResponse.new
24
+ end
25
+
26
+ after do
27
+ # run after each test
28
+ end
29
+
30
+ describe 'test an instance of AddFieldsTemplateResponse' do
31
+ it 'should create an instance of AddFieldsTemplateResponse' do
32
+ expect(@instance).to be_instance_of(DocSpring::AddFieldsTemplateResponse)
33
+ end
34
+ end
35
+ describe 'test attribute "new_field_ids"' 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
@@ -14,22 +14,22 @@ require 'spec_helper'
14
14
  require 'json'
15
15
  require 'date'
16
16
 
17
- # Unit tests for DocSpring::CreateTemplateData
17
+ # Unit tests for DocSpring::CreateHtmlTemplateData
18
18
  # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
19
  # Please update as you see appropriate
20
- describe 'CreateTemplateData' do
20
+ describe 'CreateHtmlTemplateData' do
21
21
  before do
22
22
  # run before each test
23
- @instance = DocSpring::CreateTemplateData.new
23
+ @instance = DocSpring::CreateHtmlTemplateData.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 CreateTemplateData' do
31
- it 'should create an instance of CreateTemplateData' do
32
- expect(@instance).to be_instance_of(DocSpring::CreateTemplateData)
30
+ describe 'test an instance of CreateHtmlTemplateData' do
31
+ it 'should create an instance of CreateHtmlTemplateData' do
32
+ expect(@instance).to be_instance_of(DocSpring::CreateHtmlTemplateData)
33
33
  end
34
34
  end
35
35
  describe 'test attribute "template"' do
@@ -14,22 +14,22 @@ require 'spec_helper'
14
14
  require 'json'
15
15
  require 'date'
16
16
 
17
- # Unit tests for DocSpring::CreateTemplateData1
17
+ # Unit tests for DocSpring::CreateTemplateFromUploadData
18
18
  # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
19
  # Please update as you see appropriate
20
- describe 'CreateTemplateData1' do
20
+ describe 'CreateTemplateFromUploadData' do
21
21
  before do
22
22
  # run before each test
23
- @instance = DocSpring::CreateTemplateData1.new
23
+ @instance = DocSpring::CreateTemplateFromUploadData.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 CreateTemplateData1' do
31
- it 'should create an instance of CreateTemplateData1' do
32
- expect(@instance).to be_instance_of(DocSpring::CreateTemplateData1)
30
+ describe 'test an instance of CreateTemplateFromUploadData' do
31
+ it 'should create an instance of CreateTemplateFromUploadData' do
32
+ expect(@instance).to be_instance_of(DocSpring::CreateTemplateFromUploadData)
33
33
  end
34
34
  end
35
35
  describe 'test attribute "template"' do