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
@@ -0,0 +1,254 @@
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
+ # A JPEG image of each page of a PDF template's PDF, at 140 DPI (a US Letter page is 1190 x 1540 pixels), to see the pages that fields are placed on. The template's `document.page_dimensions` gives each page's size in PDF points. Fields are placed in units where every page is 2480 wide: to place a field at a point on an image, multiply the point's pixel coordinates by 2480 and divide them by the image's `width`.
18
+ class TemplatePageImages < ApiModelBase
19
+ # The template's ID.
20
+ attr_accessor :template_id
21
+
22
+ # The published version the images are of, such as `1.2.0`. Null for the draft.
23
+ attr_accessor :version
24
+
25
+ # How many pages the PDF has.
26
+ attr_accessor :page_count
27
+
28
+ # An image of each page, in order: `pages[0]` is page 1. Their `download_url`s expire, so get them again when you need them.
29
+ attr_accessor :pages
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ :'template_id' => :'template_id',
35
+ :'version' => :'version',
36
+ :'page_count' => :'page_count',
37
+ :'pages' => :'pages'
38
+ }
39
+ end
40
+
41
+ # Returns attribute mapping this model knows about
42
+ def self.acceptable_attribute_map
43
+ attribute_map
44
+ end
45
+
46
+ # Returns all the JSON keys this model knows about
47
+ def self.acceptable_attributes
48
+ acceptable_attribute_map.values
49
+ end
50
+
51
+ # Attribute type mapping.
52
+ def self.openapi_types
53
+ {
54
+ :'template_id' => :'String',
55
+ :'version' => :'String',
56
+ :'page_count' => :'Integer',
57
+ :'pages' => :'Array<PageImage>'
58
+ }
59
+ end
60
+
61
+ # List of attributes with nullable: true
62
+ def self.openapi_nullable
63
+ Set.new([
64
+ :'version',
65
+ ])
66
+ end
67
+
68
+ # Returns attribute type mapping
69
+ def self.acceptable_openapi_types
70
+ openapi_types
71
+ end
72
+
73
+ # Returns the nullable attributes
74
+ def self.acceptable_openapi_nullable
75
+ openapi_nullable
76
+ end
77
+
78
+ # Initializes the object
79
+ # @param [Hash] attributes Model attributes in the form of hash
80
+ def initialize(attributes = {})
81
+ if (!attributes.is_a?(Hash))
82
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DocSpring::TemplatePageImages` initialize method"
83
+ end
84
+
85
+ # check to see if the attribute exists and convert string to symbol for hash key
86
+ acceptable_attribute_map = self.class.acceptable_attribute_map
87
+ attributes = attributes.each_with_object({}) { |(k, v), h|
88
+ if (!acceptable_attribute_map.key?(k.to_sym))
89
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DocSpring::TemplatePageImages`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
90
+ end
91
+ h[k.to_sym] = v
92
+ }
93
+
94
+ if attributes.key?(:'template_id')
95
+ self.template_id = attributes[:'template_id']
96
+ else
97
+ self.template_id = nil
98
+ end
99
+
100
+ if attributes.key?(:'version')
101
+ self.version = attributes[:'version']
102
+ else
103
+ self.version = nil
104
+ end
105
+
106
+ if attributes.key?(:'page_count')
107
+ self.page_count = attributes[:'page_count']
108
+ else
109
+ self.page_count = nil
110
+ end
111
+
112
+ if attributes.key?(:'pages')
113
+ if (value = attributes[:'pages']).is_a?(Array)
114
+ self.pages = value
115
+ end
116
+ else
117
+ self.pages = nil
118
+ end
119
+ end
120
+
121
+ # Show invalid properties with the reasons. Usually used together with valid?
122
+ # @return Array for valid properties with the reasons
123
+ def list_invalid_properties
124
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
125
+ invalid_properties = Array.new
126
+ if @template_id.nil?
127
+ invalid_properties.push('invalid value for "template_id", template_id cannot be nil.')
128
+ end
129
+
130
+ if @page_count.nil?
131
+ invalid_properties.push('invalid value for "page_count", page_count cannot be nil.')
132
+ end
133
+
134
+ if @pages.nil?
135
+ invalid_properties.push('invalid value for "pages", pages cannot be nil.')
136
+ end
137
+
138
+ invalid_properties
139
+ end
140
+
141
+ # Check to see if the all the properties in the model are valid
142
+ # @return true if the model is valid
143
+ def valid?
144
+ warn '[DEPRECATED] the `valid?` method is obsolete'
145
+ return false if @template_id.nil?
146
+ return false if @page_count.nil?
147
+ return false if @pages.nil?
148
+ true
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
+ # Custom attribute writer method with validation
162
+ # @param [Object] page_count Value to be assigned
163
+ def page_count=(page_count)
164
+ if page_count.nil?
165
+ fail ArgumentError, 'page_count cannot be nil'
166
+ end
167
+
168
+ @page_count = page_count
169
+ end
170
+
171
+ # Custom attribute writer method with validation
172
+ # @param [Object] pages Value to be assigned
173
+ def pages=(pages)
174
+ if pages.nil?
175
+ fail ArgumentError, 'pages cannot be nil'
176
+ end
177
+
178
+ @pages = pages
179
+ end
180
+
181
+ # Checks equality by comparing each attribute.
182
+ # @param [Object] Object to be compared
183
+ def ==(o)
184
+ return true if self.equal?(o)
185
+ self.class == o.class &&
186
+ template_id == o.template_id &&
187
+ version == o.version &&
188
+ page_count == o.page_count &&
189
+ pages == o.pages
190
+ end
191
+
192
+ # @see the `==` method
193
+ # @param [Object] Object to be compared
194
+ def eql?(o)
195
+ self == o
196
+ end
197
+
198
+ # Calculates hash code according to all attributes.
199
+ # @return [Integer] Hash code
200
+ def hash
201
+ [template_id, version, page_count, pages].hash
202
+ end
203
+
204
+ # Builds the object from hash
205
+ # @param [Hash] attributes Model attributes in the form of hash
206
+ # @return [Object] Returns the model itself
207
+ def self.build_from_hash(attributes)
208
+ return nil unless attributes.is_a?(Hash)
209
+ attributes = attributes.transform_keys(&:to_sym)
210
+ # include attributes inherited from allOf parents (the nearest declaration wins)
211
+ map = acceptable_attribute_map
212
+ transformed_hash = {}
213
+ acceptable_openapi_types.each_pair do |key, type|
214
+ if attributes.key?(map[key]) && attributes[map[key]].nil?
215
+ transformed_hash["#{key}"] = nil
216
+ elsif type =~ /\AArray<(.*)>/i
217
+ # check to ensure the input is an array given that the attribute
218
+ # is documented as an array but the input is not
219
+ if attributes[map[key]].is_a?(Array)
220
+ transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
221
+ end
222
+ elsif !attributes[map[key]].nil?
223
+ transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
224
+ end
225
+ end
226
+ # Responses can include enum values added after this client was released, so the enum setters
227
+ # accept any value while the model is built from a response
228
+ allocate.tap do |model|
229
+ model.instance_variable_set(:@_skip_enum_validation, true)
230
+ model.send(:initialize, transformed_hash)
231
+ model.remove_instance_variable(:@_skip_enum_validation)
232
+ end
233
+ end
234
+
235
+ # Returns the object in the form of hash
236
+ # @return [Hash] Returns the object in the form of hash
237
+ def to_hash
238
+ hash = {}
239
+ # include attributes inherited from allOf parents (the nearest declaration wins)
240
+ self.class.acceptable_attribute_map.each_pair do |attr, param|
241
+ value = self.send(attr)
242
+ if value.nil?
243
+ is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
244
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
245
+ end
246
+
247
+ hash[param] = _to_hash(value)
248
+ end
249
+ hash
250
+ end
251
+
252
+ end
253
+
254
+ end
@@ -14,12 +14,18 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module DocSpring
17
- # The new PDF.
17
+ # The new PDF, as one of `cache_id`, `document_url` and `document_base64`.
18
18
  class UpdateTemplateDocumentRequest < ApiModelBase
19
19
  # The `fields.key` of the new PDF, uploaded with the presigned upload (GET /uploads/presign).
20
20
  attr_accessor :cache_id
21
21
 
22
- # The PDF's file name, for a `cache_id` (presigned uploads don't send one).
22
+ # An https:// link to the template's PDF (up to 100 MB), instead of `cache_id`. DocSpring downloads it after responding, following redirects to other https:// links: the template's `document.state` is `downloading` until then (sync.api hosts wait for it). If it can't be downloaded, the state is `download_failed` and `document.error_message` says why.
23
+ attr_accessor :document_url
24
+
25
+ # The template's PDF, encoded as base64 (a `data:` URI works too), instead of `cache_id`. Up to 7 MB before it's encoded: send a larger file with `cache_id` or `document_url`.
26
+ attr_accessor :document_base64
27
+
28
+ # The PDF's file name, for a `cache_id` (presigned uploads don't send one) or `document_base64`. A `document_url`'s is the last part of its path unless you set it.
23
29
  attr_accessor :filename
24
30
 
25
31
  # Replace all of the template's fields with the fillable fields in the new PDF, once DocSpring has processed it (`document.field_reimport_state`). As on a first upload, the default typeface, font size, bold and color are taken from the PDF's fields; the template's other settings are kept. If the PDF has no fillable fields, the template keeps its fields. A locked template can't re-import its fields.
@@ -29,6 +35,8 @@ module DocSpring
29
35
  def self.attribute_map
30
36
  {
31
37
  :'cache_id' => :'cache_id',
38
+ :'document_url' => :'document_url',
39
+ :'document_base64' => :'document_base64',
32
40
  :'filename' => :'filename',
33
41
  :'reimport_fields' => :'reimport_fields'
34
42
  }
@@ -48,6 +56,8 @@ module DocSpring
48
56
  def self.openapi_types
49
57
  {
50
58
  :'cache_id' => :'String',
59
+ :'document_url' => :'String',
60
+ :'document_base64' => :'String',
51
61
  :'filename' => :'String',
52
62
  :'reimport_fields' => :'Boolean'
53
63
  }
@@ -87,8 +97,14 @@ module DocSpring
87
97
 
88
98
  if attributes.key?(:'cache_id')
89
99
  self.cache_id = attributes[:'cache_id']
90
- else
91
- self.cache_id = nil
100
+ end
101
+
102
+ if attributes.key?(:'document_url')
103
+ self.document_url = attributes[:'document_url']
104
+ end
105
+
106
+ if attributes.key?(:'document_base64')
107
+ self.document_base64 = attributes[:'document_base64']
92
108
  end
93
109
 
94
110
  if attributes.key?(:'filename')
@@ -105,10 +121,6 @@ module DocSpring
105
121
  def list_invalid_properties
106
122
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
107
123
  invalid_properties = Array.new
108
- if @cache_id.nil?
109
- invalid_properties.push('invalid value for "cache_id", cache_id cannot be nil.')
110
- end
111
-
112
124
  invalid_properties
113
125
  end
114
126
 
@@ -116,26 +128,17 @@ module DocSpring
116
128
  # @return true if the model is valid
117
129
  def valid?
118
130
  warn '[DEPRECATED] the `valid?` method is obsolete'
119
- return false if @cache_id.nil?
120
131
  true
121
132
  end
122
133
 
123
- # Custom attribute writer method with validation
124
- # @param [Object] cache_id Value to be assigned
125
- def cache_id=(cache_id)
126
- if cache_id.nil?
127
- fail ArgumentError, 'cache_id cannot be nil'
128
- end
129
-
130
- @cache_id = cache_id
131
- end
132
-
133
134
  # Checks equality by comparing each attribute.
134
135
  # @param [Object] Object to be compared
135
136
  def ==(o)
136
137
  return true if self.equal?(o)
137
138
  self.class == o.class &&
138
139
  cache_id == o.cache_id &&
140
+ document_url == o.document_url &&
141
+ document_base64 == o.document_base64 &&
139
142
  filename == o.filename &&
140
143
  reimport_fields == o.reimport_fields
141
144
  end
@@ -149,7 +152,7 @@ module DocSpring
149
152
  # Calculates hash code according to all attributes.
150
153
  # @return [Integer] Hash code
151
154
  def hash
152
- [cache_id, filename, reimport_fields].hash
155
+ [cache_id, document_url, document_base64, filename, reimport_fields].hash
153
156
  end
154
157
 
155
158
  # Builds the object from hash
@@ -0,0 +1,187 @@
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
+ # The fields to change in the template's draft.
18
+ class UpdateTemplateFieldsRequest < ApiModelBase
19
+ # The changes, each with the `id` of the field it changes. Settings left out keep their values. Changing a shared setting changes it for every field with the same name. Renaming a field moves it to the shared settings of its new name, and conditional logic and formulas that use the old name follow it when no other field has that name.
20
+ attr_accessor :fields
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'fields' => :'fields'
26
+ }
27
+ end
28
+
29
+ # Returns attribute mapping this model knows about
30
+ def self.acceptable_attribute_map
31
+ attribute_map
32
+ end
33
+
34
+ # Returns all the JSON keys this model knows about
35
+ def self.acceptable_attributes
36
+ acceptable_attribute_map.values
37
+ end
38
+
39
+ # Attribute type mapping.
40
+ def self.openapi_types
41
+ {
42
+ :'fields' => :'Array<FieldInput>'
43
+ }
44
+ end
45
+
46
+ # List of attributes with nullable: true
47
+ def self.openapi_nullable
48
+ Set.new([
49
+ ])
50
+ end
51
+
52
+ # Returns attribute type mapping
53
+ def self.acceptable_openapi_types
54
+ openapi_types
55
+ end
56
+
57
+ # Returns the nullable attributes
58
+ def self.acceptable_openapi_nullable
59
+ openapi_nullable
60
+ end
61
+
62
+ # Initializes the object
63
+ # @param [Hash] attributes Model attributes in the form of hash
64
+ def initialize(attributes = {})
65
+ if (!attributes.is_a?(Hash))
66
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DocSpring::UpdateTemplateFieldsRequest` initialize method"
67
+ end
68
+
69
+ # check to see if the attribute exists and convert string to symbol for hash key
70
+ acceptable_attribute_map = self.class.acceptable_attribute_map
71
+ attributes = attributes.each_with_object({}) { |(k, v), h|
72
+ if (!acceptable_attribute_map.key?(k.to_sym))
73
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DocSpring::UpdateTemplateFieldsRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
74
+ end
75
+ h[k.to_sym] = v
76
+ }
77
+
78
+ if attributes.key?(:'fields')
79
+ if (value = attributes[:'fields']).is_a?(Array)
80
+ self.fields = value
81
+ end
82
+ else
83
+ self.fields = nil
84
+ end
85
+ end
86
+
87
+ # Show invalid properties with the reasons. Usually used together with valid?
88
+ # @return Array for valid properties with the reasons
89
+ def list_invalid_properties
90
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
91
+ invalid_properties = Array.new
92
+ if @fields.nil?
93
+ invalid_properties.push('invalid value for "fields", fields cannot be nil.')
94
+ end
95
+
96
+ invalid_properties
97
+ end
98
+
99
+ # Check to see if the all the properties in the model are valid
100
+ # @return true if the model is valid
101
+ def valid?
102
+ warn '[DEPRECATED] the `valid?` method is obsolete'
103
+ return false if @fields.nil?
104
+ true
105
+ end
106
+
107
+ # Custom attribute writer method with validation
108
+ # @param [Object] fields Value to be assigned
109
+ def fields=(fields)
110
+ if fields.nil?
111
+ fail ArgumentError, 'fields cannot be nil'
112
+ end
113
+
114
+ @fields = fields
115
+ end
116
+
117
+ # Checks equality by comparing each attribute.
118
+ # @param [Object] Object to be compared
119
+ def ==(o)
120
+ return true if self.equal?(o)
121
+ self.class == o.class &&
122
+ fields == o.fields
123
+ end
124
+
125
+ # @see the `==` method
126
+ # @param [Object] Object to be compared
127
+ def eql?(o)
128
+ self == o
129
+ end
130
+
131
+ # Calculates hash code according to all attributes.
132
+ # @return [Integer] Hash code
133
+ def hash
134
+ [fields].hash
135
+ end
136
+
137
+ # Builds the object from hash
138
+ # @param [Hash] attributes Model attributes in the form of hash
139
+ # @return [Object] Returns the model itself
140
+ def self.build_from_hash(attributes)
141
+ return nil unless attributes.is_a?(Hash)
142
+ attributes = attributes.transform_keys(&:to_sym)
143
+ # include attributes inherited from allOf parents (the nearest declaration wins)
144
+ map = acceptable_attribute_map
145
+ transformed_hash = {}
146
+ acceptable_openapi_types.each_pair do |key, type|
147
+ if attributes.key?(map[key]) && attributes[map[key]].nil?
148
+ transformed_hash["#{key}"] = nil
149
+ elsif type =~ /\AArray<(.*)>/i
150
+ # check to ensure the input is an array given that the attribute
151
+ # is documented as an array but the input is not
152
+ if attributes[map[key]].is_a?(Array)
153
+ transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
154
+ end
155
+ elsif !attributes[map[key]].nil?
156
+ transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
157
+ end
158
+ end
159
+ # Responses can include enum values added after this client was released, so the enum setters
160
+ # accept any value while the model is built from a response
161
+ allocate.tap do |model|
162
+ model.instance_variable_set(:@_skip_enum_validation, true)
163
+ model.send(:initialize, transformed_hash)
164
+ model.remove_instance_variable(:@_skip_enum_validation)
165
+ end
166
+ end
167
+
168
+ # Returns the object in the form of hash
169
+ # @return [Hash] Returns the object in the form of hash
170
+ def to_hash
171
+ hash = {}
172
+ # include attributes inherited from allOf parents (the nearest declaration wins)
173
+ self.class.acceptable_attribute_map.each_pair do |attr, param|
174
+ value = self.send(attr)
175
+ if value.nil?
176
+ is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
177
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
178
+ end
179
+
180
+ hash[param] = _to_hash(value)
181
+ end
182
+ hash
183
+ end
184
+
185
+ end
186
+
187
+ end
@@ -97,6 +97,15 @@ module DocSpring
97
97
  # The template's conditional logic rules. Setting them replaces all of the rules.
98
98
  attr_accessor :field_dependencies
99
99
 
100
+ # Changes to the settings of the template's field groups, each with the `name` of the group it changes. Settings left out keep their values, and groups left out are unchanged.
101
+ attr_accessor :field_groups
102
+
103
+ # 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.
104
+ attr_accessor :predefined_fields
105
+
106
+ # 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.
107
+ attr_accessor :predefined_fields_sample_data
108
+
100
109
  # The HTML of an HTML template, as a Liquid template. Null for PDF templates.
101
110
  attr_accessor :html
102
111
 
@@ -164,6 +173,9 @@ module DocSpring
164
173
  :'slack_webhook_url' => :'slack_webhook_url',
165
174
  :'defaults' => :'defaults',
166
175
  :'field_dependencies' => :'field_dependencies',
176
+ :'field_groups' => :'field_groups',
177
+ :'predefined_fields' => :'predefined_fields',
178
+ :'predefined_fields_sample_data' => :'predefined_fields_sample_data',
167
179
  :'html' => :'html',
168
180
  :'scss' => :'scss',
169
181
  :'header_html' => :'header_html',
@@ -212,6 +224,9 @@ module DocSpring
212
224
  :'slack_webhook_url' => :'String',
213
225
  :'defaults' => :'TemplateDefaultsInput',
214
226
  :'field_dependencies' => :'Array<TemplateFieldDependencyInput>',
227
+ :'field_groups' => :'Array<FieldGroupInput>',
228
+ :'predefined_fields' => :'Array<PredefinedFieldInput>',
229
+ :'predefined_fields_sample_data' => :'Hash<String, Object>',
215
230
  :'html' => :'String',
216
231
  :'scss' => :'String',
217
232
  :'header_html' => :'String',
@@ -228,6 +243,7 @@ module DocSpring
228
243
  :'encrypt_pdfs_password',
229
244
  :'redirect_url',
230
245
  :'slack_webhook_url',
246
+ :'predefined_fields_sample_data',
231
247
  :'html',
232
248
  :'scss',
233
249
  :'header_html',
@@ -374,6 +390,24 @@ module DocSpring
374
390
  end
375
391
  end
376
392
 
393
+ if attributes.key?(:'field_groups')
394
+ if (value = attributes[:'field_groups']).is_a?(Array)
395
+ self.field_groups = value
396
+ end
397
+ end
398
+
399
+ if attributes.key?(:'predefined_fields')
400
+ if (value = attributes[:'predefined_fields']).is_a?(Array)
401
+ self.predefined_fields = value
402
+ end
403
+ end
404
+
405
+ if attributes.key?(:'predefined_fields_sample_data')
406
+ if (value = attributes[:'predefined_fields_sample_data']).is_a?(Hash) || value.nil?
407
+ self.predefined_fields_sample_data = value
408
+ end
409
+ end
410
+
377
411
  if attributes.key?(:'html')
378
412
  self.html = attributes[:'html']
379
413
  end
@@ -442,6 +476,9 @@ module DocSpring
442
476
  slack_webhook_url == o.slack_webhook_url &&
443
477
  defaults == o.defaults &&
444
478
  field_dependencies == o.field_dependencies &&
479
+ field_groups == o.field_groups &&
480
+ predefined_fields == o.predefined_fields &&
481
+ predefined_fields_sample_data == o.predefined_fields_sample_data &&
445
482
  html == o.html &&
446
483
  scss == o.scss &&
447
484
  header_html == o.header_html &&
@@ -458,7 +495,7 @@ module DocSpring
458
495
  # Calculates hash code according to all attributes.
459
496
  # @return [Integer] Hash code
460
497
  def hash
461
- [name, description, parent_folder_id, 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, 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, slack_webhook_url, defaults, field_dependencies, html, scss, header_html, footer_html, html_engine_options].hash
498
+ [name, description, parent_folder_id, 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, 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, slack_webhook_url, defaults, field_dependencies, field_groups, predefined_fields, predefined_fields_sample_data, html, scss, header_html, footer_html, html_engine_options].hash
462
499
  end
463
500
 
464
501
  # Builds the object from hash