docspring 4.0.0 → 4.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 (132) hide show
  1. checksums.yaml +4 -4
  2. data/.openapi-generator/FILES +84 -0
  3. data/.travis.yml +1 -1
  4. data/CHANGELOG.md +24 -0
  5. data/Gemfile.lock +2 -2
  6. data/README.md +10 -1
  7. data/docs/AddTemplateFieldsRequest.md +18 -0
  8. data/docs/Client.md +704 -33
  9. data/docs/CreateSubmissionBatchRequest.md +2 -0
  10. data/docs/CreateSubmissionRequest.md +2 -0
  11. data/docs/CreateTemplateRequest.md +10 -2
  12. data/docs/Field.md +198 -0
  13. data/docs/FieldDependency.md +22 -0
  14. data/docs/FieldDependencyInput.md +22 -0
  15. data/docs/FieldGroup.md +32 -0
  16. data/docs/FieldGroupInput.md +30 -0
  17. data/docs/FieldGroupType.md +15 -0
  18. data/docs/FieldInput.md +196 -0
  19. data/docs/FieldType.md +15 -0
  20. data/docs/GenerateFilesFormat.md +15 -0
  21. data/docs/GenerateSubmissionFilesRequest.md +18 -0
  22. data/docs/OutputFormat.md +15 -0
  23. data/docs/PageImage.md +34 -0
  24. data/docs/PageImages.md +24 -0
  25. data/docs/PredefinedField.md +30 -0
  26. data/docs/PredefinedFieldInput.md +30 -0
  27. data/docs/RemoveTemplateFieldsRequest.md +18 -0
  28. data/docs/ReorderTemplateFieldsRequest.md +18 -0
  29. data/docs/Submission.md +3 -1
  30. data/docs/SubmissionFiles.md +3 -1
  31. data/docs/SubmissionInput.md +2 -0
  32. data/docs/SubmissionValidation.md +24 -0
  33. data/docs/Template.md +6 -0
  34. data/docs/TemplateDiff.md +30 -0
  35. data/docs/TemplateDiffSummary.md +28 -0
  36. data/docs/TemplateDocument.md +3 -3
  37. data/docs/TemplateFieldChange.md +24 -0
  38. data/docs/TemplateFieldChanges.md +24 -0
  39. data/docs/TemplateFieldDependency.md +1 -1
  40. data/docs/TemplateFieldDependencyInput.md +1 -1
  41. data/docs/TemplateFieldMove.md +22 -0
  42. data/docs/TemplateFields.md +22 -0
  43. data/docs/TemplatePageImages.md +24 -0
  44. data/docs/UpdateTemplateDocumentRequest.md +6 -2
  45. data/docs/UpdateTemplateFieldsRequest.md +18 -0
  46. data/docs/UpdateTemplateRequest.md +6 -0
  47. data/docs/ValidateSubmissionRequest.md +38 -0
  48. data/lib/docspring/api/client.rb +666 -18
  49. data/lib/docspring/api_client.rb +1 -1
  50. data/lib/docspring/models/add_template_fields_request.rb +187 -0
  51. data/lib/docspring/models/create_submission_batch_request.rb +23 -1
  52. data/lib/docspring/models/create_submission_request.rb +23 -1
  53. data/lib/docspring/models/create_template_request.rb +48 -3
  54. data/lib/docspring/models/field.rb +2217 -0
  55. data/lib/docspring/models/field_dependency.rb +246 -0
  56. data/lib/docspring/models/field_dependency_input.rb +246 -0
  57. data/lib/docspring/models/field_group.rb +368 -0
  58. data/lib/docspring/models/field_group_input.rb +247 -0
  59. data/lib/docspring/models/field_group_type.rb +41 -0
  60. data/lib/docspring/models/field_input.rb +1109 -0
  61. data/lib/docspring/models/field_type.rb +54 -0
  62. data/lib/docspring/models/generate_files_format.rb +40 -0
  63. data/lib/docspring/models/generate_submission_files_request.rb +187 -0
  64. data/lib/docspring/models/output_format.rb +41 -0
  65. data/lib/docspring/models/page_image.rb +359 -0
  66. data/lib/docspring/models/page_images.rb +248 -0
  67. data/lib/docspring/models/predefined_field.rb +287 -0
  68. data/lib/docspring/models/predefined_field_input.rb +287 -0
  69. data/lib/docspring/models/remove_template_fields_request.rb +187 -0
  70. data/lib/docspring/models/reorder_template_fields_request.rb +187 -0
  71. data/lib/docspring/models/submission.rb +31 -2
  72. data/lib/docspring/models/submission_files.rb +13 -4
  73. data/lib/docspring/models/submission_input.rb +23 -1
  74. data/lib/docspring/models/submission_validation.rb +234 -0
  75. data/lib/docspring/models/template.rb +74 -1
  76. data/lib/docspring/models/template_diff.rb +321 -0
  77. data/lib/docspring/models/template_diff_summary.rb +320 -0
  78. data/lib/docspring/models/template_document.rb +3 -3
  79. data/lib/docspring/models/template_document_state.rb +3 -1
  80. data/lib/docspring/models/template_field_change.rb +266 -0
  81. data/lib/docspring/models/template_field_changes.rb +274 -0
  82. data/lib/docspring/models/template_field_dependency.rb +1 -1
  83. data/lib/docspring/models/template_field_dependency_input.rb +1 -1
  84. data/lib/docspring/models/template_field_move.rb +239 -0
  85. data/lib/docspring/models/template_fields.rb +227 -0
  86. data/lib/docspring/models/template_page_images.rb +254 -0
  87. data/lib/docspring/models/update_template_document_request.rb +23 -20
  88. data/lib/docspring/models/update_template_fields_request.rb +187 -0
  89. data/lib/docspring/models/update_template_request.rb +38 -1
  90. data/lib/docspring/models/validate_submission_request.rb +288 -0
  91. data/lib/docspring/request_schemas.json +3364 -1584
  92. data/lib/docspring/version.rb +1 -1
  93. data/lib/docspring.rb +28 -0
  94. data/spec/api/client_spec.rb +128 -9
  95. data/spec/models/add_template_fields_request_spec.rb +36 -0
  96. data/spec/models/create_submission_batch_request_spec.rb +6 -0
  97. data/spec/models/create_submission_request_spec.rb +6 -0
  98. data/spec/models/create_template_request_spec.rb +24 -0
  99. data/spec/models/field_dependency_input_spec.rb +48 -0
  100. data/spec/models/field_dependency_spec.rb +48 -0
  101. data/spec/models/field_group_input_spec.rb +72 -0
  102. data/spec/models/field_group_spec.rb +78 -0
  103. data/spec/models/field_group_type_spec.rb +30 -0
  104. data/spec/models/field_input_spec.rb +570 -0
  105. data/spec/models/field_spec.rb +576 -0
  106. data/spec/models/field_type_spec.rb +30 -0
  107. data/spec/models/generate_files_format_spec.rb +30 -0
  108. data/spec/models/generate_submission_files_request_spec.rb +36 -0
  109. data/spec/models/output_format_spec.rb +30 -0
  110. data/spec/models/page_image_spec.rb +84 -0
  111. data/spec/models/page_images_spec.rb +54 -0
  112. data/spec/models/predefined_field_input_spec.rb +72 -0
  113. data/spec/models/predefined_field_spec.rb +72 -0
  114. data/spec/models/remove_template_fields_request_spec.rb +36 -0
  115. data/spec/models/reorder_template_fields_request_spec.rb +36 -0
  116. data/spec/models/submission_files_spec.rb +6 -0
  117. data/spec/models/submission_input_spec.rb +6 -0
  118. data/spec/models/submission_spec.rb +6 -0
  119. data/spec/models/submission_validation_spec.rb +54 -0
  120. data/spec/models/template_diff_spec.rb +72 -0
  121. data/spec/models/template_diff_summary_spec.rb +66 -0
  122. data/spec/models/template_field_change_spec.rb +54 -0
  123. data/spec/models/template_field_changes_spec.rb +54 -0
  124. data/spec/models/template_field_move_spec.rb +48 -0
  125. data/spec/models/template_fields_spec.rb +48 -0
  126. data/spec/models/template_page_images_spec.rb +54 -0
  127. data/spec/models/template_spec.rb +18 -0
  128. data/spec/models/update_template_document_request_spec.rb +12 -0
  129. data/spec/models/update_template_fields_request_spec.rb +36 -0
  130. data/spec/models/update_template_request_spec.rb +18 -0
  131. data/spec/models/validate_submission_request_spec.rb +96 -0
  132. metadata +113 -1
@@ -67,7 +67,10 @@ module DocSpring
67
67
  # The text of each field that didn't fit in it, by field name. Left out (null) with `data`, and empty once the submission has expired.
68
68
  attr_accessor :truncated_text
69
69
 
70
- # The generated files: `pdf` once the submission has been processed, `audit_trail` once its signature requests are completed, and `preview` once a preview PDF has been generated. Empty once the submission has expired.
70
+ # What the submission makes: `pdf`, and `png` (an image of each page of the PDF, up to 100 pages) when you ask for it. Default `["pdf"]`. POST /submissions/{submission_id}/generate_files adds `png` to a processed submission.
71
+ attr_accessor :output_formats
72
+
73
+ # The generated files: `pdf` once the submission has been processed, `png` (the images of the PDF's pages, when `output_formats` has it: `files.png.pages[0]` is page 1), `audit_trail` once its signature requests are completed, and `preview` once a preview PDF has been generated. Empty once the submission has expired.
71
74
  attr_accessor :files
72
75
 
73
76
  # When the preview PDF was generated. Null if there is no preview.
@@ -130,6 +133,7 @@ module DocSpring
130
133
  :'signature_requests' => :'signature_requests',
131
134
  :'actions' => :'actions',
132
135
  :'truncated_text' => :'truncated_text',
136
+ :'output_formats' => :'output_formats',
133
137
  :'files' => :'files',
134
138
  :'preview_generated_at' => :'preview_generated_at',
135
139
  :'expired' => :'expired',
@@ -170,6 +174,7 @@ module DocSpring
170
174
  :'signature_requests' => :'Array<SignatureRequest>',
171
175
  :'actions' => :'Array<SubmissionAction>',
172
176
  :'truncated_text' => :'Hash<String, Array<String>>',
177
+ :'output_formats' => :'Array<OutputFormat>',
173
178
  :'files' => :'SubmissionFiles',
174
179
  :'preview_generated_at' => :'Time',
175
180
  :'expired' => :'Boolean',
@@ -335,6 +340,14 @@ module DocSpring
335
340
  self.truncated_text = nil
336
341
  end
337
342
 
343
+ if attributes.key?(:'output_formats')
344
+ if (value = attributes[:'output_formats']).is_a?(Array)
345
+ self.output_formats = value
346
+ end
347
+ else
348
+ self.output_formats = nil
349
+ end
350
+
338
351
  if attributes.key?(:'files')
339
352
  self.files = attributes[:'files']
340
353
  else
@@ -427,6 +440,10 @@ module DocSpring
427
440
  invalid_properties.push('invalid value for "actions", actions cannot be nil.')
428
441
  end
429
442
 
443
+ if @output_formats.nil?
444
+ invalid_properties.push('invalid value for "output_formats", output_formats cannot be nil.')
445
+ end
446
+
430
447
  if @files.nil?
431
448
  invalid_properties.push('invalid value for "files", files cannot be nil.')
432
449
  end
@@ -461,6 +478,7 @@ module DocSpring
461
478
  return false if @has_password.nil?
462
479
  return false if @signature_requests.nil?
463
480
  return false if @actions.nil?
481
+ return false if @output_formats.nil?
464
482
  return false if @files.nil?
465
483
  return false if @expired.nil?
466
484
  return false if @created_at.nil?
@@ -578,6 +596,16 @@ module DocSpring
578
596
  @actions = actions
579
597
  end
580
598
 
599
+ # Custom attribute writer method with validation
600
+ # @param [Object] output_formats Value to be assigned
601
+ def output_formats=(output_formats)
602
+ if output_formats.nil?
603
+ fail ArgumentError, 'output_formats cannot be nil'
604
+ end
605
+
606
+ @output_formats = output_formats
607
+ end
608
+
581
609
  # Custom attribute writer method with validation
582
610
  # @param [Object] files Value to be assigned
583
611
  def files=(files)
@@ -640,6 +668,7 @@ module DocSpring
640
668
  signature_requests == o.signature_requests &&
641
669
  actions == o.actions &&
642
670
  truncated_text == o.truncated_text &&
671
+ output_formats == o.output_formats &&
643
672
  files == o.files &&
644
673
  preview_generated_at == o.preview_generated_at &&
645
674
  expired == o.expired &&
@@ -658,7 +687,7 @@ module DocSpring
658
687
  # Calculates hash code according to all attributes.
659
688
  # @return [Integer] Hash code
660
689
  def hash
661
- [id, template_id, template_type, template_version, batch_id, source, state, test, editable, data, data_errors, error_message, metadata, has_password, signature_requests, actions, truncated_text, files, preview_generated_at, expired, expires_at, processed_at, created_at, updated_at].hash
690
+ [id, template_id, template_type, template_version, batch_id, source, state, test, editable, data, data_errors, error_message, metadata, has_password, signature_requests, actions, truncated_text, output_formats, files, preview_generated_at, expired, expires_at, processed_at, created_at, updated_at].hash
662
691
  end
663
692
 
664
693
  # Builds the object from hash
@@ -25,12 +25,15 @@ module DocSpring
25
25
  # The preview PDF from POST /submissions/{submission_id}/generate_preview, such as for a submission still waiting for its signature requests.
26
26
  attr_accessor :preview
27
27
 
28
+ attr_accessor :png
29
+
28
30
  # Attribute mapping from ruby-style variable name to JSON key.
29
31
  def self.attribute_map
30
32
  {
31
33
  :'pdf' => :'pdf',
32
34
  :'audit_trail' => :'audit_trail',
33
- :'preview' => :'preview'
35
+ :'preview' => :'preview',
36
+ :'png' => :'png'
34
37
  }
35
38
  end
36
39
 
@@ -49,7 +52,8 @@ module DocSpring
49
52
  {
50
53
  :'pdf' => :'GeneratedFile',
51
54
  :'audit_trail' => :'GeneratedFile',
52
- :'preview' => :'GeneratedFile'
55
+ :'preview' => :'GeneratedFile',
56
+ :'png' => :'PageImages'
53
57
  }
54
58
  end
55
59
 
@@ -96,6 +100,10 @@ module DocSpring
96
100
  if attributes.key?(:'preview')
97
101
  self.preview = attributes[:'preview']
98
102
  end
103
+
104
+ if attributes.key?(:'png')
105
+ self.png = attributes[:'png']
106
+ end
99
107
  end
100
108
 
101
109
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -120,7 +128,8 @@ module DocSpring
120
128
  self.class == o.class &&
121
129
  pdf == o.pdf &&
122
130
  audit_trail == o.audit_trail &&
123
- preview == o.preview
131
+ preview == o.preview &&
132
+ png == o.png
124
133
  end
125
134
 
126
135
  # @see the `==` method
@@ -132,7 +141,7 @@ module DocSpring
132
141
  # Calculates hash code according to all attributes.
133
142
  # @return [Integer] Hash code
134
143
  def hash
135
- [pdf, audit_trail, preview].hash
144
+ [pdf, audit_trail, preview, png].hash
136
145
  end
137
146
 
138
147
  # Builds the object from hash
@@ -31,6 +31,9 @@ module DocSpring
31
31
  # A password that the PDF needs to be opened with. It's never returned; `has_password` says if it's set.
32
32
  attr_accessor :password
33
33
 
34
+ # What the submission makes: `pdf`, and `png` (an image of each page of the PDF, up to 100 pages) when you ask for it. Default `["pdf"]`. POST /submissions/{submission_id}/generate_files adds `png` to a processed submission.
35
+ attr_accessor :output_formats
36
+
34
37
  # Seconds after the PDF is generated until the submission expires, up to 10 years (315360000). Default the template's expiration setting. A submission that isn't processed, such as one with invalid data, is kept for at least 48 hours.
35
38
  attr_accessor :expires_in
36
39
 
@@ -57,6 +60,7 @@ module DocSpring
57
60
  :'data' => :'data',
58
61
  :'metadata' => :'metadata',
59
62
  :'password' => :'password',
63
+ :'output_formats' => :'output_formats',
60
64
  :'expires_in' => :'expires_in',
61
65
  :'field_overrides' => :'field_overrides',
62
66
  :'html' => :'html',
@@ -84,6 +88,7 @@ module DocSpring
84
88
  :'data' => :'Hash<String, Object>',
85
89
  :'metadata' => :'Hash<String, Object>',
86
90
  :'password' => :'String',
91
+ :'output_formats' => :'Array<OutputFormat>',
87
92
  :'expires_in' => :'Integer',
88
93
  :'field_overrides' => :'Hash<String, FieldOverride>',
89
94
  :'html' => :'String',
@@ -149,6 +154,12 @@ module DocSpring
149
154
  self.password = attributes[:'password']
150
155
  end
151
156
 
157
+ if attributes.key?(:'output_formats')
158
+ if (value = attributes[:'output_formats']).is_a?(Array)
159
+ self.output_formats = value
160
+ end
161
+ end
162
+
152
163
  if attributes.key?(:'expires_in')
153
164
  self.expires_in = attributes[:'expires_in']
154
165
  end
@@ -191,6 +202,16 @@ module DocSpring
191
202
  true
192
203
  end
193
204
 
205
+ # Custom attribute writer method with validation
206
+ # @param [Object] output_formats Value to be assigned
207
+ def output_formats=(output_formats)
208
+ if output_formats.nil?
209
+ fail ArgumentError, 'output_formats cannot be nil'
210
+ end
211
+
212
+ @output_formats = output_formats
213
+ end
214
+
194
215
  # Checks equality by comparing each attribute.
195
216
  # @param [Object] Object to be compared
196
217
  def ==(o)
@@ -201,6 +222,7 @@ module DocSpring
201
222
  data == o.data &&
202
223
  metadata == o.metadata &&
203
224
  password == o.password &&
225
+ output_formats == o.output_formats &&
204
226
  expires_in == o.expires_in &&
205
227
  field_overrides == o.field_overrides &&
206
228
  html == o.html &&
@@ -218,7 +240,7 @@ module DocSpring
218
240
  # Calculates hash code according to all attributes.
219
241
  # @return [Integer] Hash code
220
242
  def hash
221
- [test, editable, data, metadata, password, expires_in, field_overrides, html, css, template_id, template_version].hash
243
+ [test, editable, data, metadata, password, output_formats, expires_in, field_overrides, html, css, template_id, template_version].hash
222
244
  end
223
245
 
224
246
  # Builds the object from hash
@@ -0,0 +1,234 @@
1
+ =begin
2
+ #DocSpring API
3
+
4
+ #Use DocSpring's API to programmatically fill out PDF forms, convert HTML to PDFs, merge PDFs, or request legally binding e-signatures.
5
+
6
+ The version of the OpenAPI document: v2
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.26.0-DOCSPRING
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module DocSpring
17
+ # Whether creating the submission would succeed, checked without saving it or making any files. `error` is the error that creating it would return (`validation_failed`, or `invalid_data` for data that doesn't match the template's fields), and is left out when `valid` is true.
18
+ class SubmissionValidation < ApiModelBase
19
+ # True when creating the submission would succeed.
20
+ attr_accessor :valid
21
+
22
+ # The template's ID.
23
+ attr_accessor :template_id
24
+
25
+ # The published version the request was checked against, such as `1.2.0`. Null for the draft.
26
+ attr_accessor :template_version
27
+
28
+ attr_accessor :error
29
+
30
+ # Attribute mapping from ruby-style variable name to JSON key.
31
+ def self.attribute_map
32
+ {
33
+ :'valid' => :'valid',
34
+ :'template_id' => :'template_id',
35
+ :'template_version' => :'template_version',
36
+ :'error' => :'error'
37
+ }
38
+ end
39
+
40
+ # Returns attribute mapping this model knows about
41
+ def self.acceptable_attribute_map
42
+ attribute_map
43
+ end
44
+
45
+ # Returns all the JSON keys this model knows about
46
+ def self.acceptable_attributes
47
+ acceptable_attribute_map.values
48
+ end
49
+
50
+ # Attribute type mapping.
51
+ def self.openapi_types
52
+ {
53
+ :'valid' => :'Boolean',
54
+ :'template_id' => :'String',
55
+ :'template_version' => :'String',
56
+ :'error' => :'ErrorInfo'
57
+ }
58
+ end
59
+
60
+ # List of attributes with nullable: true
61
+ def self.openapi_nullable
62
+ Set.new([
63
+ :'template_version',
64
+ ])
65
+ end
66
+
67
+ # Returns attribute type mapping
68
+ def self.acceptable_openapi_types
69
+ openapi_types
70
+ end
71
+
72
+ # Returns the nullable attributes
73
+ def self.acceptable_openapi_nullable
74
+ openapi_nullable
75
+ end
76
+
77
+ # Initializes the object
78
+ # @param [Hash] attributes Model attributes in the form of hash
79
+ def initialize(attributes = {})
80
+ if (!attributes.is_a?(Hash))
81
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DocSpring::SubmissionValidation` initialize method"
82
+ end
83
+
84
+ # check to see if the attribute exists and convert string to symbol for hash key
85
+ acceptable_attribute_map = self.class.acceptable_attribute_map
86
+ attributes = attributes.each_with_object({}) { |(k, v), h|
87
+ if (!acceptable_attribute_map.key?(k.to_sym))
88
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DocSpring::SubmissionValidation`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
89
+ end
90
+ h[k.to_sym] = v
91
+ }
92
+
93
+ if attributes.key?(:'valid')
94
+ self.valid = attributes[:'valid']
95
+ else
96
+ self.valid = nil
97
+ end
98
+
99
+ if attributes.key?(:'template_id')
100
+ self.template_id = attributes[:'template_id']
101
+ else
102
+ self.template_id = nil
103
+ end
104
+
105
+ if attributes.key?(:'template_version')
106
+ self.template_version = attributes[:'template_version']
107
+ else
108
+ self.template_version = nil
109
+ end
110
+
111
+ if attributes.key?(:'error')
112
+ self.error = attributes[:'error']
113
+ end
114
+ end
115
+
116
+ # Show invalid properties with the reasons. Usually used together with valid?
117
+ # @return Array for valid properties with the reasons
118
+ def list_invalid_properties
119
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
120
+ invalid_properties = Array.new
121
+ if @valid.nil?
122
+ invalid_properties.push('invalid value for "valid", valid cannot be nil.')
123
+ end
124
+
125
+ if @template_id.nil?
126
+ invalid_properties.push('invalid value for "template_id", template_id cannot be nil.')
127
+ end
128
+
129
+ invalid_properties
130
+ end
131
+
132
+ # Check to see if the all the properties in the model are valid
133
+ # @return true if the model is valid
134
+ def valid?
135
+ warn '[DEPRECATED] the `valid?` method is obsolete'
136
+ return false if @valid.nil?
137
+ return false if @template_id.nil?
138
+ true
139
+ end
140
+
141
+ # Custom attribute writer method with validation
142
+ # @param [Object] valid Value to be assigned
143
+ def valid=(valid)
144
+ if valid.nil?
145
+ fail ArgumentError, 'valid cannot be nil'
146
+ end
147
+
148
+ @valid = valid
149
+ end
150
+
151
+ # Custom attribute writer method with validation
152
+ # @param [Object] template_id Value to be assigned
153
+ def template_id=(template_id)
154
+ if template_id.nil?
155
+ fail ArgumentError, 'template_id cannot be nil'
156
+ end
157
+
158
+ @template_id = template_id
159
+ end
160
+
161
+ # Checks equality by comparing each attribute.
162
+ # @param [Object] Object to be compared
163
+ def ==(o)
164
+ return true if self.equal?(o)
165
+ self.class == o.class &&
166
+ valid == o.valid &&
167
+ template_id == o.template_id &&
168
+ template_version == o.template_version &&
169
+ error == o.error
170
+ end
171
+
172
+ # @see the `==` method
173
+ # @param [Object] Object to be compared
174
+ def eql?(o)
175
+ self == o
176
+ end
177
+
178
+ # Calculates hash code according to all attributes.
179
+ # @return [Integer] Hash code
180
+ def hash
181
+ [valid, template_id, template_version, error].hash
182
+ end
183
+
184
+ # Builds the object from hash
185
+ # @param [Hash] attributes Model attributes in the form of hash
186
+ # @return [Object] Returns the model itself
187
+ def self.build_from_hash(attributes)
188
+ return nil unless attributes.is_a?(Hash)
189
+ attributes = attributes.transform_keys(&:to_sym)
190
+ # include attributes inherited from allOf parents (the nearest declaration wins)
191
+ map = acceptable_attribute_map
192
+ transformed_hash = {}
193
+ acceptable_openapi_types.each_pair do |key, type|
194
+ if attributes.key?(map[key]) && attributes[map[key]].nil?
195
+ transformed_hash["#{key}"] = nil
196
+ elsif type =~ /\AArray<(.*)>/i
197
+ # check to ensure the input is an array given that the attribute
198
+ # is documented as an array but the input is not
199
+ if attributes[map[key]].is_a?(Array)
200
+ transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
201
+ end
202
+ elsif !attributes[map[key]].nil?
203
+ transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
204
+ end
205
+ end
206
+ # Responses can include enum values added after this client was released, so the enum setters
207
+ # accept any value while the model is built from a response
208
+ allocate.tap do |model|
209
+ model.instance_variable_set(:@_skip_enum_validation, true)
210
+ model.send(:initialize, transformed_hash)
211
+ model.remove_instance_variable(:@_skip_enum_validation)
212
+ end
213
+ end
214
+
215
+ # Returns the object in the form of hash
216
+ # @return [Hash] Returns the object in the form of hash
217
+ def to_hash
218
+ hash = {}
219
+ # include attributes inherited from allOf parents (the nearest declaration wins)
220
+ self.class.acceptable_attribute_map.each_pair do |attr, param|
221
+ value = self.send(attr)
222
+ if value.nil?
223
+ is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
224
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
225
+ end
226
+
227
+ hash[param] = _to_hash(value)
228
+ end
229
+ hash
230
+ end
231
+
232
+ end
233
+
234
+ end
@@ -132,6 +132,15 @@ module DocSpring
132
132
  # Conditional logic: each rule shows or hides its target fields, or makes them required, depending on the values of other fields.
133
133
  attr_accessor :field_dependencies
134
134
 
135
+ # The groups of the template's fields, with their settings. A field's name puts it in groups: `address/city` is in the group `address`, and `items/0/price` is in the list `items` and its items' group `items/~`.
136
+ attr_accessor :field_groups
137
+
138
+ # The field names that people using the embedded template editor choose from, each with the data type and settings a field gets when it's given that name. Setting it replaces the whole list; an empty list turns them off.
139
+ attr_accessor :predefined_fields
140
+
141
+ # Sample submission data that sets `predefined_fields`: each value becomes a predefined field, with a type that fits it (`string`, `number`, `boolean`, `date`, `email` or `url`) and `required_in_template` true. Nested objects and arrays become names with `/`, such as `customer/email`. Without `predefined_fields` in the same request, it replaces them; with them, it adds to them and sets the types of the ones it has values for.
142
+ attr_accessor :predefined_fields_sample_data
143
+
135
144
  # The HTML of an HTML template, as a Liquid template. Null for PDF templates.
136
145
  attr_accessor :html
137
146
 
@@ -217,6 +226,9 @@ module DocSpring
217
226
  :'updated_at' => :'updated_at',
218
227
  :'defaults' => :'defaults',
219
228
  :'field_dependencies' => :'field_dependencies',
229
+ :'field_groups' => :'field_groups',
230
+ :'predefined_fields' => :'predefined_fields',
231
+ :'predefined_fields_sample_data' => :'predefined_fields_sample_data',
220
232
  :'html' => :'html',
221
233
  :'scss' => :'scss',
222
234
  :'header_html' => :'header_html',
@@ -279,6 +291,9 @@ module DocSpring
279
291
  :'updated_at' => :'Time',
280
292
  :'defaults' => :'TemplateDefaults',
281
293
  :'field_dependencies' => :'Array<TemplateFieldDependency>',
294
+ :'field_groups' => :'Array<FieldGroup>',
295
+ :'predefined_fields' => :'Array<PredefinedField>',
296
+ :'predefined_fields_sample_data' => :'Hash<String, Object>',
282
297
  :'html' => :'String',
283
298
  :'scss' => :'String',
284
299
  :'header_html' => :'String',
@@ -303,6 +318,7 @@ module DocSpring
303
318
  :'redirect_url',
304
319
  :'last_changed_at',
305
320
  :'last_changed_by',
321
+ :'predefined_fields_sample_data',
306
322
  :'html',
307
323
  :'scss',
308
324
  :'header_html',
@@ -576,6 +592,30 @@ module DocSpring
576
592
  self.field_dependencies = nil
577
593
  end
578
594
 
595
+ if attributes.key?(:'field_groups')
596
+ if (value = attributes[:'field_groups']).is_a?(Array)
597
+ self.field_groups = value
598
+ end
599
+ else
600
+ self.field_groups = nil
601
+ end
602
+
603
+ if attributes.key?(:'predefined_fields')
604
+ if (value = attributes[:'predefined_fields']).is_a?(Array)
605
+ self.predefined_fields = value
606
+ end
607
+ else
608
+ self.predefined_fields = nil
609
+ end
610
+
611
+ if attributes.key?(:'predefined_fields_sample_data')
612
+ if (value = attributes[:'predefined_fields_sample_data']).is_a?(Hash) || value.nil?
613
+ self.predefined_fields_sample_data = value
614
+ end
615
+ else
616
+ self.predefined_fields_sample_data = nil
617
+ end
618
+
579
619
  if attributes.key?(:'html')
580
620
  self.html = attributes[:'html']
581
621
  else
@@ -738,6 +778,14 @@ module DocSpring
738
778
  invalid_properties.push('invalid value for "field_dependencies", field_dependencies cannot be nil.')
739
779
  end
740
780
 
781
+ if @field_groups.nil?
782
+ invalid_properties.push('invalid value for "field_groups", field_groups cannot be nil.')
783
+ end
784
+
785
+ if @predefined_fields.nil?
786
+ invalid_properties.push('invalid value for "predefined_fields", predefined_fields cannot be nil.')
787
+ end
788
+
741
789
  if @versions.nil?
742
790
  invalid_properties.push('invalid value for "versions", versions cannot be nil.')
743
791
  end
@@ -777,6 +825,8 @@ module DocSpring
777
825
  return false if @updated_at.nil?
778
826
  return false if @defaults.nil?
779
827
  return false if @field_dependencies.nil?
828
+ return false if @field_groups.nil?
829
+ return false if @predefined_fields.nil?
780
830
  return false if @versions.nil?
781
831
  true
782
832
  end
@@ -1061,6 +1111,26 @@ module DocSpring
1061
1111
  @field_dependencies = field_dependencies
1062
1112
  end
1063
1113
 
1114
+ # Custom attribute writer method with validation
1115
+ # @param [Object] field_groups Value to be assigned
1116
+ def field_groups=(field_groups)
1117
+ if field_groups.nil?
1118
+ fail ArgumentError, 'field_groups cannot be nil'
1119
+ end
1120
+
1121
+ @field_groups = field_groups
1122
+ end
1123
+
1124
+ # Custom attribute writer method with validation
1125
+ # @param [Object] predefined_fields Value to be assigned
1126
+ def predefined_fields=(predefined_fields)
1127
+ if predefined_fields.nil?
1128
+ fail ArgumentError, 'predefined_fields cannot be nil'
1129
+ end
1130
+
1131
+ @predefined_fields = predefined_fields
1132
+ end
1133
+
1064
1134
  # Custom attribute writer method with validation
1065
1135
  # @param [Object] versions Value to be assigned
1066
1136
  def versions=(versions)
@@ -1115,6 +1185,9 @@ module DocSpring
1115
1185
  updated_at == o.updated_at &&
1116
1186
  defaults == o.defaults &&
1117
1187
  field_dependencies == o.field_dependencies &&
1188
+ field_groups == o.field_groups &&
1189
+ predefined_fields == o.predefined_fields &&
1190
+ predefined_fields_sample_data == o.predefined_fields_sample_data &&
1118
1191
  html == o.html &&
1119
1192
  scss == o.scss &&
1120
1193
  header_html == o.header_html &&
@@ -1133,7 +1206,7 @@ module DocSpring
1133
1206
  # Calculates hash code according to all attributes.
1134
1207
  # @return [Integer] Hash code
1135
1208
  def hash
1136
- [id, name, description, template_type, ready, document, parent_folder_id, path, version, latest_version, version_published_at, locked, add_signature_request_submission_id_footers, ai_field_naming_language, allow_additional_properties, allow_skipping_optional_fields, default_form_mode, editable_submissions, embed_domains, embed_edit_allow_settings, embed_edit_allow_versioning, embed_edit_allow_document_replacement, encrypt_pdfs, has_encrypt_pdfs_password, expire_submissions, expire_after, expiration_interval, merge_audit_trail_pdf, parse_dates_using_template_date_format, public_submissions, public_web_form, redirect_url, has_slack_webhook_url, last_changed_at, last_changed_by, created_at, updated_at, defaults, field_dependencies, html, scss, header_html, footer_html, html_engine_options, embed_edit_token, versions].hash
1209
+ [id, name, description, template_type, ready, document, parent_folder_id, path, version, latest_version, version_published_at, locked, add_signature_request_submission_id_footers, ai_field_naming_language, allow_additional_properties, allow_skipping_optional_fields, default_form_mode, editable_submissions, embed_domains, embed_edit_allow_settings, embed_edit_allow_versioning, embed_edit_allow_document_replacement, encrypt_pdfs, has_encrypt_pdfs_password, expire_submissions, expire_after, expiration_interval, merge_audit_trail_pdf, parse_dates_using_template_date_format, public_submissions, public_web_form, redirect_url, has_slack_webhook_url, last_changed_at, last_changed_by, created_at, updated_at, defaults, field_dependencies, field_groups, predefined_fields, predefined_fields_sample_data, html, scss, header_html, footer_html, html_engine_options, embed_edit_token, versions].hash
1137
1210
  end
1138
1211
 
1139
1212
  # Builds the object from hash