docspring 4.1.0 → 4.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 (69) hide show
  1. checksums.yaml +4 -4
  2. data/.openapi-generator/FILES +15 -0
  3. data/.travis.yml +1 -1
  4. data/AGENTS.md +3 -2
  5. data/CHANGELOG.md +40 -0
  6. data/Gemfile.lock +9 -9
  7. data/README.md +5 -1
  8. data/docs/Client.md +176 -10
  9. data/docs/CombinedPdf.md +1 -1
  10. data/docs/CreateCombinedPdfRequest.md +1 -1
  11. data/docs/CreateSubmissionRequest.md +2 -2
  12. data/docs/CreateTemplatePreviewRequest.md +18 -0
  13. data/docs/CreateTemplateRequest.md +3 -1
  14. data/docs/ErrorDetail.md +1 -1
  15. data/docs/ErrorInfo.md +4 -4
  16. data/docs/Submission.md +15 -15
  17. data/docs/SubmissionInput.md +2 -2
  18. data/docs/SubmissionList.md +1 -1
  19. data/docs/SubmissionSummary.md +54 -0
  20. data/docs/Template.md +12 -10
  21. data/docs/TemplateActor.md +1 -1
  22. data/docs/TemplateDocument.md +5 -5
  23. data/docs/TemplateDocumentSummary.md +24 -0
  24. data/docs/TemplatePreview.md +32 -0
  25. data/docs/TemplatePreviewState.md +15 -0
  26. data/docs/TemplateSummary.md +2 -48
  27. data/docs/UpdateTemplateRequest.md +4 -2
  28. data/docs/ValidateSubmissionRequest.md +2 -2
  29. data/lib/docspring/api/client.rb +178 -8
  30. data/lib/docspring/api_client.rb +4 -2
  31. data/lib/docspring/date_time_values.rb +33 -0
  32. data/lib/docspring/models/combined_pdf.rb +1 -1
  33. data/lib/docspring/models/create_combined_pdf_request.rb +1 -1
  34. data/lib/docspring/models/create_submission_request.rb +2 -2
  35. data/lib/docspring/models/create_template_preview_request.rb +187 -0
  36. data/lib/docspring/models/create_template_request.rb +12 -2
  37. data/lib/docspring/models/error_code.rb +3 -1
  38. data/lib/docspring/models/error_detail.rb +1 -1
  39. data/lib/docspring/models/error_info.rb +4 -4
  40. data/lib/docspring/models/submission.rb +140 -140
  41. data/lib/docspring/models/submission_input.rb +2 -2
  42. data/lib/docspring/models/submission_list.rb +1 -1
  43. data/lib/docspring/models/submission_summary.rb +601 -0
  44. data/lib/docspring/models/template.rb +96 -83
  45. data/lib/docspring/models/template_actor.rb +1 -1
  46. data/lib/docspring/models/template_document.rb +42 -42
  47. data/lib/docspring/models/template_document_summary.rb +260 -0
  48. data/lib/docspring/models/template_preview.rb +356 -0
  49. data/lib/docspring/models/template_preview_state.rb +42 -0
  50. data/lib/docspring/models/template_summary.rb +5 -572
  51. data/lib/docspring/models/update_template_request.rb +16 -6
  52. data/lib/docspring/models/validate_submission_request.rb +2 -2
  53. data/lib/docspring/request_schemas.json +105 -8
  54. data/lib/docspring/version.rb +1 -1
  55. data/lib/docspring/webhook_signature.rb +45 -0
  56. data/lib/docspring.rb +6 -0
  57. data/spec/api/client_spec.rb +39 -4
  58. data/spec/models/create_template_preview_request_spec.rb +36 -0
  59. data/spec/models/create_template_request_spec.rb +6 -0
  60. data/spec/models/submission_spec.rb +12 -12
  61. data/spec/models/submission_summary_spec.rb +144 -0
  62. data/spec/models/template_document_spec.rb +5 -5
  63. data/spec/models/template_document_summary_spec.rb +54 -0
  64. data/spec/models/template_preview_spec.rb +78 -0
  65. data/spec/models/template_preview_state_spec.rb +30 -0
  66. data/spec/models/template_spec.rb +28 -22
  67. data/spec/models/template_summary_spec.rb +0 -138
  68. data/spec/models/update_template_request_spec.rb +6 -0
  69. metadata +23 -1
@@ -0,0 +1,260 @@
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 PDF template's PDF, as template lists show it.
18
+ class TemplateDocumentSummary < ApiModelBase
19
+ # The PDF's file name. Null until a `document_url` has been downloaded.
20
+ attr_accessor :filename
21
+
22
+ # `pending` while DocSpring processes the PDF, then `processed` (`ready` says when its pages are done too). `password_required`, `malformed_pdf` and `unknown_error` mean the PDF couldn't be processed, and `error_message` says why: upload it again or upload another one. `downloading` while DocSpring downloads a `document_url`, then as for an upload. `download_failed` means it couldn't be downloaded, and `error_message` says why. A template keeps its PDF while a new one is downloaded, and when it couldn't be.
23
+ attr_accessor :state
24
+
25
+ # Why the PDF couldn't be processed or downloaded, and how to fix it. Null unless `state` is an error.
26
+ attr_accessor :error_message
27
+
28
+ # 0 until the PDF has been processed.
29
+ attr_accessor :page_count
30
+
31
+ class EnumAttributeValidator
32
+ attr_reader :datatype
33
+ attr_reader :allowable_values
34
+
35
+ def initialize(datatype, allowable_values)
36
+ @allowable_values = allowable_values.map do |value|
37
+ case datatype.to_s
38
+ when /Integer/i
39
+ value.to_i
40
+ when /Float/i
41
+ value.to_f
42
+ else
43
+ value
44
+ end
45
+ end
46
+ end
47
+
48
+ def valid?(value)
49
+ !value || allowable_values.include?(value)
50
+ end
51
+ end
52
+
53
+ # Attribute mapping from ruby-style variable name to JSON key.
54
+ def self.attribute_map
55
+ {
56
+ :'filename' => :'filename',
57
+ :'state' => :'state',
58
+ :'error_message' => :'error_message',
59
+ :'page_count' => :'page_count'
60
+ }
61
+ end
62
+
63
+ # Returns attribute mapping this model knows about
64
+ def self.acceptable_attribute_map
65
+ attribute_map
66
+ end
67
+
68
+ # Returns all the JSON keys this model knows about
69
+ def self.acceptable_attributes
70
+ acceptable_attribute_map.values
71
+ end
72
+
73
+ # Attribute type mapping.
74
+ def self.openapi_types
75
+ {
76
+ :'filename' => :'String',
77
+ :'state' => :'TemplateDocumentState',
78
+ :'error_message' => :'String',
79
+ :'page_count' => :'Integer'
80
+ }
81
+ end
82
+
83
+ # List of attributes with nullable: true
84
+ def self.openapi_nullable
85
+ Set.new([
86
+ :'filename',
87
+ :'error_message',
88
+ ])
89
+ end
90
+
91
+ # Returns attribute type mapping
92
+ def self.acceptable_openapi_types
93
+ openapi_types
94
+ end
95
+
96
+ # Returns the nullable attributes
97
+ def self.acceptable_openapi_nullable
98
+ openapi_nullable
99
+ end
100
+
101
+ # Initializes the object
102
+ # @param [Hash] attributes Model attributes in the form of hash
103
+ def initialize(attributes = {})
104
+ if (!attributes.is_a?(Hash))
105
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DocSpring::TemplateDocumentSummary` initialize method"
106
+ end
107
+
108
+ # check to see if the attribute exists and convert string to symbol for hash key
109
+ acceptable_attribute_map = self.class.acceptable_attribute_map
110
+ attributes = attributes.each_with_object({}) { |(k, v), h|
111
+ if (!acceptable_attribute_map.key?(k.to_sym))
112
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DocSpring::TemplateDocumentSummary`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
113
+ end
114
+ h[k.to_sym] = v
115
+ }
116
+
117
+ if attributes.key?(:'filename')
118
+ self.filename = attributes[:'filename']
119
+ else
120
+ self.filename = nil
121
+ end
122
+
123
+ if attributes.key?(:'state')
124
+ self.state = attributes[:'state']
125
+ else
126
+ self.state = nil
127
+ end
128
+
129
+ if attributes.key?(:'error_message')
130
+ self.error_message = attributes[:'error_message']
131
+ else
132
+ self.error_message = nil
133
+ end
134
+
135
+ if attributes.key?(:'page_count')
136
+ self.page_count = attributes[:'page_count']
137
+ else
138
+ self.page_count = nil
139
+ end
140
+ end
141
+
142
+ # Show invalid properties with the reasons. Usually used together with valid?
143
+ # @return Array for valid properties with the reasons
144
+ def list_invalid_properties
145
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
146
+ invalid_properties = Array.new
147
+ if @state.nil?
148
+ invalid_properties.push('invalid value for "state", state cannot be nil.')
149
+ end
150
+
151
+ if @page_count.nil?
152
+ invalid_properties.push('invalid value for "page_count", page_count cannot be nil.')
153
+ end
154
+
155
+ invalid_properties
156
+ end
157
+
158
+ # Check to see if the all the properties in the model are valid
159
+ # @return true if the model is valid
160
+ def valid?
161
+ warn '[DEPRECATED] the `valid?` method is obsolete'
162
+ return false if @state.nil?
163
+ return false if @page_count.nil?
164
+ true
165
+ end
166
+
167
+ # Custom attribute writer method with validation
168
+ # @param [Object] state Value to be assigned
169
+ def state=(state)
170
+ if state.nil?
171
+ fail ArgumentError, 'state cannot be nil'
172
+ end
173
+
174
+ @state = state
175
+ end
176
+
177
+ # Custom attribute writer method with validation
178
+ # @param [Object] page_count Value to be assigned
179
+ def page_count=(page_count)
180
+ if page_count.nil?
181
+ fail ArgumentError, 'page_count cannot be nil'
182
+ end
183
+
184
+ @page_count = page_count
185
+ end
186
+
187
+ # Checks equality by comparing each attribute.
188
+ # @param [Object] Object to be compared
189
+ def ==(o)
190
+ return true if self.equal?(o)
191
+ self.class == o.class &&
192
+ filename == o.filename &&
193
+ state == o.state &&
194
+ error_message == o.error_message &&
195
+ page_count == o.page_count
196
+ end
197
+
198
+ # @see the `==` method
199
+ # @param [Object] Object to be compared
200
+ def eql?(o)
201
+ self == o
202
+ end
203
+
204
+ # Calculates hash code according to all attributes.
205
+ # @return [Integer] Hash code
206
+ def hash
207
+ [filename, state, error_message, page_count].hash
208
+ end
209
+
210
+ # Builds the object from hash
211
+ # @param [Hash] attributes Model attributes in the form of hash
212
+ # @return [Object] Returns the model itself
213
+ def self.build_from_hash(attributes)
214
+ return nil unless attributes.is_a?(Hash)
215
+ attributes = attributes.transform_keys(&:to_sym)
216
+ # include attributes inherited from allOf parents (the nearest declaration wins)
217
+ map = acceptable_attribute_map
218
+ transformed_hash = {}
219
+ acceptable_openapi_types.each_pair do |key, type|
220
+ if attributes.key?(map[key]) && attributes[map[key]].nil?
221
+ transformed_hash["#{key}"] = nil
222
+ elsif type =~ /\AArray<(.*)>/i
223
+ # check to ensure the input is an array given that the attribute
224
+ # is documented as an array but the input is not
225
+ if attributes[map[key]].is_a?(Array)
226
+ transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
227
+ end
228
+ elsif !attributes[map[key]].nil?
229
+ transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
230
+ end
231
+ end
232
+ # Responses can include enum values added after this client was released, so the enum setters
233
+ # accept any value while the model is built from a response
234
+ allocate.tap do |model|
235
+ model.instance_variable_set(:@_skip_enum_validation, true)
236
+ model.send(:initialize, transformed_hash)
237
+ model.remove_instance_variable(:@_skip_enum_validation)
238
+ end
239
+ end
240
+
241
+ # Returns the object in the form of hash
242
+ # @return [Hash] Returns the object in the form of hash
243
+ def to_hash
244
+ hash = {}
245
+ # include attributes inherited from allOf parents (the nearest declaration wins)
246
+ self.class.acceptable_attribute_map.each_pair do |attr, param|
247
+ value = self.send(attr)
248
+ if value.nil?
249
+ is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
250
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
251
+ end
252
+
253
+ hash[param] = _to_hash(value)
254
+ end
255
+ hash
256
+ end
257
+
258
+ end
259
+
260
+ end
@@ -0,0 +1,356 @@
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
+ # PNG images of a template's pages filled in with data you send (not a PDF), to check how an HTML or PDF template prints with your data before you publish a version or send live data. A preview makes no submission and uses no credits. Its pages are watermarked like a test submission's PDF, and it's deleted an hour after it's created.
18
+ class TemplatePreview < ApiModelBase
19
+ # The preview's ID.
20
+ attr_accessor :id
21
+
22
+ # The template's ID.
23
+ attr_accessor :template_id
24
+
25
+ # The published version that was rendered, such as `1.2.0`. Null for the draft.
26
+ attr_accessor :version
27
+
28
+ # `pending` while it renders (usually a few seconds), then `processed`, or `error` with an `error_message`.
29
+ attr_accessor :state
30
+
31
+ # Why the preview couldn't be rendered, such as an error in an HTML template's Liquid, or a value in the data that a field can't print.
32
+ attr_accessor :error_message
33
+
34
+ # How many pages the template printed, once it's processed.
35
+ attr_accessor :page_count
36
+
37
+ # A PNG image of each page once it's processed, in order: `pages[0]` is page 1. A preview has no PDF. Their `download_url`s expire, so get the preview again when you need them.
38
+ attr_accessor :pages
39
+
40
+ # When the preview and its images are deleted.
41
+ attr_accessor :expires_at
42
+
43
+ class EnumAttributeValidator
44
+ attr_reader :datatype
45
+ attr_reader :allowable_values
46
+
47
+ def initialize(datatype, allowable_values)
48
+ @allowable_values = allowable_values.map do |value|
49
+ case datatype.to_s
50
+ when /Integer/i
51
+ value.to_i
52
+ when /Float/i
53
+ value.to_f
54
+ else
55
+ value
56
+ end
57
+ end
58
+ end
59
+
60
+ def valid?(value)
61
+ !value || allowable_values.include?(value)
62
+ end
63
+ end
64
+
65
+ # Attribute mapping from ruby-style variable name to JSON key.
66
+ def self.attribute_map
67
+ {
68
+ :'id' => :'id',
69
+ :'template_id' => :'template_id',
70
+ :'version' => :'version',
71
+ :'state' => :'state',
72
+ :'error_message' => :'error_message',
73
+ :'page_count' => :'page_count',
74
+ :'pages' => :'pages',
75
+ :'expires_at' => :'expires_at'
76
+ }
77
+ end
78
+
79
+ # Returns attribute mapping this model knows about
80
+ def self.acceptable_attribute_map
81
+ attribute_map
82
+ end
83
+
84
+ # Returns all the JSON keys this model knows about
85
+ def self.acceptable_attributes
86
+ acceptable_attribute_map.values
87
+ end
88
+
89
+ # Attribute type mapping.
90
+ def self.openapi_types
91
+ {
92
+ :'id' => :'String',
93
+ :'template_id' => :'String',
94
+ :'version' => :'String',
95
+ :'state' => :'TemplatePreviewState',
96
+ :'error_message' => :'String',
97
+ :'page_count' => :'Integer',
98
+ :'pages' => :'Array<PageImage>',
99
+ :'expires_at' => :'Time'
100
+ }
101
+ end
102
+
103
+ # List of attributes with nullable: true
104
+ def self.openapi_nullable
105
+ Set.new([
106
+ :'version',
107
+ :'error_message',
108
+ :'page_count',
109
+ ])
110
+ end
111
+
112
+ # Returns attribute type mapping
113
+ def self.acceptable_openapi_types
114
+ openapi_types
115
+ end
116
+
117
+ # Returns the nullable attributes
118
+ def self.acceptable_openapi_nullable
119
+ openapi_nullable
120
+ end
121
+
122
+ # Initializes the object
123
+ # @param [Hash] attributes Model attributes in the form of hash
124
+ def initialize(attributes = {})
125
+ if (!attributes.is_a?(Hash))
126
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DocSpring::TemplatePreview` initialize method"
127
+ end
128
+
129
+ # check to see if the attribute exists and convert string to symbol for hash key
130
+ acceptable_attribute_map = self.class.acceptable_attribute_map
131
+ attributes = attributes.each_with_object({}) { |(k, v), h|
132
+ if (!acceptable_attribute_map.key?(k.to_sym))
133
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DocSpring::TemplatePreview`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
134
+ end
135
+ h[k.to_sym] = v
136
+ }
137
+
138
+ if attributes.key?(:'id')
139
+ self.id = attributes[:'id']
140
+ else
141
+ self.id = nil
142
+ end
143
+
144
+ if attributes.key?(:'template_id')
145
+ self.template_id = attributes[:'template_id']
146
+ else
147
+ self.template_id = nil
148
+ end
149
+
150
+ if attributes.key?(:'version')
151
+ self.version = attributes[:'version']
152
+ else
153
+ self.version = nil
154
+ end
155
+
156
+ if attributes.key?(:'state')
157
+ self.state = attributes[:'state']
158
+ else
159
+ self.state = nil
160
+ end
161
+
162
+ if attributes.key?(:'error_message')
163
+ self.error_message = attributes[:'error_message']
164
+ else
165
+ self.error_message = nil
166
+ end
167
+
168
+ if attributes.key?(:'page_count')
169
+ self.page_count = attributes[:'page_count']
170
+ else
171
+ self.page_count = nil
172
+ end
173
+
174
+ if attributes.key?(:'pages')
175
+ if (value = attributes[:'pages']).is_a?(Array)
176
+ self.pages = value
177
+ end
178
+ else
179
+ self.pages = nil
180
+ end
181
+
182
+ if attributes.key?(:'expires_at')
183
+ self.expires_at = attributes[:'expires_at']
184
+ else
185
+ self.expires_at = nil
186
+ end
187
+ end
188
+
189
+ # Show invalid properties with the reasons. Usually used together with valid?
190
+ # @return Array for valid properties with the reasons
191
+ def list_invalid_properties
192
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
193
+ invalid_properties = Array.new
194
+ if @id.nil?
195
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
196
+ end
197
+
198
+ if @template_id.nil?
199
+ invalid_properties.push('invalid value for "template_id", template_id cannot be nil.')
200
+ end
201
+
202
+ if @state.nil?
203
+ invalid_properties.push('invalid value for "state", state cannot be nil.')
204
+ end
205
+
206
+ if @pages.nil?
207
+ invalid_properties.push('invalid value for "pages", pages cannot be nil.')
208
+ end
209
+
210
+ if @expires_at.nil?
211
+ invalid_properties.push('invalid value for "expires_at", expires_at cannot be nil.')
212
+ end
213
+
214
+ invalid_properties
215
+ end
216
+
217
+ # Check to see if the all the properties in the model are valid
218
+ # @return true if the model is valid
219
+ def valid?
220
+ warn '[DEPRECATED] the `valid?` method is obsolete'
221
+ return false if @id.nil?
222
+ return false if @template_id.nil?
223
+ return false if @state.nil?
224
+ return false if @pages.nil?
225
+ return false if @expires_at.nil?
226
+ true
227
+ end
228
+
229
+ # Custom attribute writer method with validation
230
+ # @param [Object] id Value to be assigned
231
+ def id=(id)
232
+ if id.nil?
233
+ fail ArgumentError, 'id cannot be nil'
234
+ end
235
+
236
+ @id = id
237
+ end
238
+
239
+ # Custom attribute writer method with validation
240
+ # @param [Object] template_id Value to be assigned
241
+ def template_id=(template_id)
242
+ if template_id.nil?
243
+ fail ArgumentError, 'template_id cannot be nil'
244
+ end
245
+
246
+ @template_id = template_id
247
+ end
248
+
249
+ # Custom attribute writer method with validation
250
+ # @param [Object] state Value to be assigned
251
+ def state=(state)
252
+ if state.nil?
253
+ fail ArgumentError, 'state cannot be nil'
254
+ end
255
+
256
+ @state = state
257
+ end
258
+
259
+ # Custom attribute writer method with validation
260
+ # @param [Object] pages Value to be assigned
261
+ def pages=(pages)
262
+ if pages.nil?
263
+ fail ArgumentError, 'pages cannot be nil'
264
+ end
265
+
266
+ @pages = pages
267
+ end
268
+
269
+ # Custom attribute writer method with validation
270
+ # @param [Object] expires_at Value to be assigned
271
+ def expires_at=(expires_at)
272
+ if expires_at.nil?
273
+ fail ArgumentError, 'expires_at cannot be nil'
274
+ end
275
+
276
+ @expires_at = expires_at
277
+ end
278
+
279
+ # Checks equality by comparing each attribute.
280
+ # @param [Object] Object to be compared
281
+ def ==(o)
282
+ return true if self.equal?(o)
283
+ self.class == o.class &&
284
+ id == o.id &&
285
+ template_id == o.template_id &&
286
+ version == o.version &&
287
+ state == o.state &&
288
+ error_message == o.error_message &&
289
+ page_count == o.page_count &&
290
+ pages == o.pages &&
291
+ expires_at == o.expires_at
292
+ end
293
+
294
+ # @see the `==` method
295
+ # @param [Object] Object to be compared
296
+ def eql?(o)
297
+ self == o
298
+ end
299
+
300
+ # Calculates hash code according to all attributes.
301
+ # @return [Integer] Hash code
302
+ def hash
303
+ [id, template_id, version, state, error_message, page_count, pages, expires_at].hash
304
+ end
305
+
306
+ # Builds the object from hash
307
+ # @param [Hash] attributes Model attributes in the form of hash
308
+ # @return [Object] Returns the model itself
309
+ def self.build_from_hash(attributes)
310
+ return nil unless attributes.is_a?(Hash)
311
+ attributes = attributes.transform_keys(&:to_sym)
312
+ # include attributes inherited from allOf parents (the nearest declaration wins)
313
+ map = acceptable_attribute_map
314
+ transformed_hash = {}
315
+ acceptable_openapi_types.each_pair do |key, type|
316
+ if attributes.key?(map[key]) && attributes[map[key]].nil?
317
+ transformed_hash["#{key}"] = nil
318
+ elsif type =~ /\AArray<(.*)>/i
319
+ # check to ensure the input is an array given that the attribute
320
+ # is documented as an array but the input is not
321
+ if attributes[map[key]].is_a?(Array)
322
+ transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
323
+ end
324
+ elsif !attributes[map[key]].nil?
325
+ transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
326
+ end
327
+ end
328
+ # Responses can include enum values added after this client was released, so the enum setters
329
+ # accept any value while the model is built from a response
330
+ allocate.tap do |model|
331
+ model.instance_variable_set(:@_skip_enum_validation, true)
332
+ model.send(:initialize, transformed_hash)
333
+ model.remove_instance_variable(:@_skip_enum_validation)
334
+ end
335
+ end
336
+
337
+ # Returns the object in the form of hash
338
+ # @return [Hash] Returns the object in the form of hash
339
+ def to_hash
340
+ hash = {}
341
+ # include attributes inherited from allOf parents (the nearest declaration wins)
342
+ self.class.acceptable_attribute_map.each_pair do |attr, param|
343
+ value = self.send(attr)
344
+ if value.nil?
345
+ is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
346
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
347
+ end
348
+
349
+ hash[param] = _to_hash(value)
350
+ end
351
+ hash
352
+ end
353
+
354
+ end
355
+
356
+ end
@@ -0,0 +1,42 @@
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
+ class TemplatePreviewState
18
+ PENDING = "pending".freeze
19
+ PROCESSED = "processed".freeze
20
+ ERROR = "error".freeze
21
+
22
+ def self.all_vars
23
+ @all_vars ||= [PENDING, PROCESSED, ERROR].freeze
24
+ end
25
+
26
+ # Builds the enum from string
27
+ # @param [String] The enum value in the form of the string
28
+ # @return [String] The enum value
29
+ def self.build_from_hash(value)
30
+ new.build_from_hash(value)
31
+ end
32
+
33
+ # Builds the enum from string
34
+ # @param [String] The enum value in the form of the string
35
+ # @return [String] The enum value
36
+ def build_from_hash(value)
37
+ # Only responses are built from hashes, and a value added to the API after this client was released is kept as it
38
+ # is: the constants are the values this client knows
39
+ value
40
+ end
41
+ end
42
+ end