docspring 1.4.0 → 1.4.1

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.
@@ -0,0 +1,565 @@
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
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module DocSpring
16
+ class Template1
17
+ attr_accessor :document_processed
18
+
19
+ attr_accessor :expiration_interval
20
+
21
+ attr_accessor :scss
22
+
23
+ attr_accessor :document_state
24
+
25
+ attr_accessor :expire_after
26
+
27
+ attr_accessor :description
28
+
29
+ attr_accessor :slack_webhook_url
30
+
31
+ attr_accessor :demo
32
+
33
+ attr_accessor :path
34
+
35
+ attr_accessor :header_html
36
+
37
+ attr_accessor :public_web_form
38
+
39
+ attr_accessor :field_order
40
+
41
+ attr_accessor :permanent_document_url
42
+
43
+ attr_accessor :html
44
+
45
+ attr_accessor :template_type
46
+
47
+ attr_accessor :id
48
+
49
+ attr_accessor :page_dimensions
50
+
51
+ attr_accessor :locked
52
+
53
+ attr_accessor :page_count
54
+
55
+ attr_accessor :encrypt_pdfs
56
+
57
+ attr_accessor :webhook_url
58
+
59
+ attr_accessor :embed_domains
60
+
61
+ attr_accessor :parent_folder_id
62
+
63
+ attr_accessor :allow_additional_properties
64
+
65
+ attr_accessor :encrypt_pdfs_password
66
+
67
+ attr_accessor :public_submissions
68
+
69
+ attr_accessor :shared_field_data
70
+
71
+ attr_accessor :document_md5
72
+
73
+ attr_accessor :first_template
74
+
75
+ attr_accessor :defaults
76
+
77
+ attr_accessor :editable_submissions
78
+
79
+ attr_accessor :expire_submissions
80
+
81
+ attr_accessor :name
82
+
83
+ attr_accessor :footer_html
84
+
85
+ attr_accessor :document_parse_error
86
+
87
+ attr_accessor :fields
88
+
89
+ attr_accessor :document_filename
90
+
91
+ attr_accessor :redirect_url
92
+
93
+ attr_accessor :document_url
94
+
95
+ class EnumAttributeValidator
96
+ attr_reader :datatype
97
+ attr_reader :allowable_values
98
+
99
+ def initialize(datatype, allowable_values)
100
+ @allowable_values = allowable_values.map do |value|
101
+ case datatype.to_s
102
+ when /Integer/i
103
+ value.to_i
104
+ when /Float/i
105
+ value.to_f
106
+ else
107
+ value
108
+ end
109
+ end
110
+ end
111
+
112
+ def valid?(value)
113
+ !value || allowable_values.include?(value)
114
+ end
115
+ end
116
+
117
+ # Attribute mapping from ruby-style variable name to JSON key.
118
+ def self.attribute_map
119
+ {
120
+ :'document_processed' => :'document_processed',
121
+ :'expiration_interval' => :'expiration_interval',
122
+ :'scss' => :'scss',
123
+ :'document_state' => :'document_state',
124
+ :'expire_after' => :'expire_after',
125
+ :'description' => :'description',
126
+ :'slack_webhook_url' => :'slack_webhook_url',
127
+ :'demo' => :'demo',
128
+ :'path' => :'path',
129
+ :'header_html' => :'header_html',
130
+ :'public_web_form' => :'public_web_form',
131
+ :'field_order' => :'field_order',
132
+ :'permanent_document_url' => :'permanent_document_url',
133
+ :'html' => :'html',
134
+ :'template_type' => :'template_type',
135
+ :'id' => :'id',
136
+ :'page_dimensions' => :'page_dimensions',
137
+ :'locked' => :'locked',
138
+ :'page_count' => :'page_count',
139
+ :'encrypt_pdfs' => :'encrypt_pdfs',
140
+ :'webhook_url' => :'webhook_url',
141
+ :'embed_domains' => :'embed_domains',
142
+ :'parent_folder_id' => :'parent_folder_id',
143
+ :'allow_additional_properties' => :'allow_additional_properties',
144
+ :'encrypt_pdfs_password' => :'encrypt_pdfs_password',
145
+ :'public_submissions' => :'public_submissions',
146
+ :'shared_field_data' => :'shared_field_data',
147
+ :'document_md5' => :'document_md5',
148
+ :'first_template' => :'first_template',
149
+ :'defaults' => :'defaults',
150
+ :'editable_submissions' => :'editable_submissions',
151
+ :'expire_submissions' => :'expire_submissions',
152
+ :'name' => :'name',
153
+ :'footer_html' => :'footer_html',
154
+ :'document_parse_error' => :'document_parse_error',
155
+ :'fields' => :'fields',
156
+ :'document_filename' => :'document_filename',
157
+ :'redirect_url' => :'redirect_url',
158
+ :'document_url' => :'document_url'
159
+ }
160
+ end
161
+
162
+ # Attribute type mapping.
163
+ def self.openapi_types
164
+ {
165
+ :'document_processed' => :'BOOLEAN',
166
+ :'expiration_interval' => :'String',
167
+ :'scss' => :'String',
168
+ :'document_state' => :'String',
169
+ :'expire_after' => :'Float',
170
+ :'description' => :'String',
171
+ :'slack_webhook_url' => :'String',
172
+ :'demo' => :'BOOLEAN',
173
+ :'path' => :'String',
174
+ :'header_html' => :'String',
175
+ :'public_web_form' => :'BOOLEAN',
176
+ :'field_order' => :'Array<Array<Float>>',
177
+ :'permanent_document_url' => :'String',
178
+ :'html' => :'String',
179
+ :'template_type' => :'String',
180
+ :'id' => :'String',
181
+ :'page_dimensions' => :'Array<Array<Float>>',
182
+ :'locked' => :'BOOLEAN',
183
+ :'page_count' => :'Float',
184
+ :'encrypt_pdfs' => :'BOOLEAN',
185
+ :'webhook_url' => :'String',
186
+ :'embed_domains' => :'Array<String>',
187
+ :'parent_folder_id' => :'String',
188
+ :'allow_additional_properties' => :'BOOLEAN',
189
+ :'encrypt_pdfs_password' => :'String',
190
+ :'public_submissions' => :'BOOLEAN',
191
+ :'shared_field_data' => :'Object',
192
+ :'document_md5' => :'String',
193
+ :'first_template' => :'BOOLEAN',
194
+ :'defaults' => :'Template1Defaults',
195
+ :'editable_submissions' => :'BOOLEAN',
196
+ :'expire_submissions' => :'BOOLEAN',
197
+ :'name' => :'String',
198
+ :'footer_html' => :'String',
199
+ :'document_parse_error' => :'BOOLEAN',
200
+ :'fields' => :'Object',
201
+ :'document_filename' => :'String',
202
+ :'redirect_url' => :'String',
203
+ :'document_url' => :'String'
204
+ }
205
+ end
206
+
207
+ # Initializes the object
208
+ # @param [Hash] attributes Model attributes in the form of hash
209
+ def initialize(attributes = {})
210
+ return unless attributes.is_a?(Hash)
211
+
212
+ # convert string to symbol for hash key
213
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
214
+
215
+ if attributes.has_key?(:'document_processed')
216
+ self.document_processed = attributes[:'document_processed']
217
+ end
218
+
219
+ if attributes.has_key?(:'expiration_interval')
220
+ self.expiration_interval = attributes[:'expiration_interval']
221
+ end
222
+
223
+ if attributes.has_key?(:'scss')
224
+ self.scss = attributes[:'scss']
225
+ end
226
+
227
+ if attributes.has_key?(:'document_state')
228
+ self.document_state = attributes[:'document_state']
229
+ end
230
+
231
+ if attributes.has_key?(:'expire_after')
232
+ self.expire_after = attributes[:'expire_after']
233
+ end
234
+
235
+ if attributes.has_key?(:'description')
236
+ self.description = attributes[:'description']
237
+ end
238
+
239
+ if attributes.has_key?(:'slack_webhook_url')
240
+ self.slack_webhook_url = attributes[:'slack_webhook_url']
241
+ end
242
+
243
+ if attributes.has_key?(:'demo')
244
+ self.demo = attributes[:'demo']
245
+ end
246
+
247
+ if attributes.has_key?(:'path')
248
+ self.path = attributes[:'path']
249
+ end
250
+
251
+ if attributes.has_key?(:'header_html')
252
+ self.header_html = attributes[:'header_html']
253
+ end
254
+
255
+ if attributes.has_key?(:'public_web_form')
256
+ self.public_web_form = attributes[:'public_web_form']
257
+ end
258
+
259
+ if attributes.has_key?(:'field_order')
260
+ if (value = attributes[:'field_order']).is_a?(Array)
261
+ self.field_order = value
262
+ end
263
+ end
264
+
265
+ if attributes.has_key?(:'permanent_document_url')
266
+ self.permanent_document_url = attributes[:'permanent_document_url']
267
+ end
268
+
269
+ if attributes.has_key?(:'html')
270
+ self.html = attributes[:'html']
271
+ end
272
+
273
+ if attributes.has_key?(:'template_type')
274
+ self.template_type = attributes[:'template_type']
275
+ end
276
+
277
+ if attributes.has_key?(:'id')
278
+ self.id = attributes[:'id']
279
+ end
280
+
281
+ if attributes.has_key?(:'page_dimensions')
282
+ if (value = attributes[:'page_dimensions']).is_a?(Array)
283
+ self.page_dimensions = value
284
+ end
285
+ end
286
+
287
+ if attributes.has_key?(:'locked')
288
+ self.locked = attributes[:'locked']
289
+ end
290
+
291
+ if attributes.has_key?(:'page_count')
292
+ self.page_count = attributes[:'page_count']
293
+ end
294
+
295
+ if attributes.has_key?(:'encrypt_pdfs')
296
+ self.encrypt_pdfs = attributes[:'encrypt_pdfs']
297
+ end
298
+
299
+ if attributes.has_key?(:'webhook_url')
300
+ self.webhook_url = attributes[:'webhook_url']
301
+ end
302
+
303
+ if attributes.has_key?(:'embed_domains')
304
+ if (value = attributes[:'embed_domains']).is_a?(Array)
305
+ self.embed_domains = value
306
+ end
307
+ end
308
+
309
+ if attributes.has_key?(:'parent_folder_id')
310
+ self.parent_folder_id = attributes[:'parent_folder_id']
311
+ end
312
+
313
+ if attributes.has_key?(:'allow_additional_properties')
314
+ self.allow_additional_properties = attributes[:'allow_additional_properties']
315
+ end
316
+
317
+ if attributes.has_key?(:'encrypt_pdfs_password')
318
+ self.encrypt_pdfs_password = attributes[:'encrypt_pdfs_password']
319
+ end
320
+
321
+ if attributes.has_key?(:'public_submissions')
322
+ self.public_submissions = attributes[:'public_submissions']
323
+ end
324
+
325
+ if attributes.has_key?(:'shared_field_data')
326
+ self.shared_field_data = attributes[:'shared_field_data']
327
+ end
328
+
329
+ if attributes.has_key?(:'document_md5')
330
+ self.document_md5 = attributes[:'document_md5']
331
+ end
332
+
333
+ if attributes.has_key?(:'first_template')
334
+ self.first_template = attributes[:'first_template']
335
+ end
336
+
337
+ if attributes.has_key?(:'defaults')
338
+ self.defaults = attributes[:'defaults']
339
+ end
340
+
341
+ if attributes.has_key?(:'editable_submissions')
342
+ self.editable_submissions = attributes[:'editable_submissions']
343
+ end
344
+
345
+ if attributes.has_key?(:'expire_submissions')
346
+ self.expire_submissions = attributes[:'expire_submissions']
347
+ end
348
+
349
+ if attributes.has_key?(:'name')
350
+ self.name = attributes[:'name']
351
+ end
352
+
353
+ if attributes.has_key?(:'footer_html')
354
+ self.footer_html = attributes[:'footer_html']
355
+ end
356
+
357
+ if attributes.has_key?(:'document_parse_error')
358
+ self.document_parse_error = attributes[:'document_parse_error']
359
+ end
360
+
361
+ if attributes.has_key?(:'fields')
362
+ self.fields = attributes[:'fields']
363
+ end
364
+
365
+ if attributes.has_key?(:'document_filename')
366
+ self.document_filename = attributes[:'document_filename']
367
+ end
368
+
369
+ if attributes.has_key?(:'redirect_url')
370
+ self.redirect_url = attributes[:'redirect_url']
371
+ end
372
+
373
+ if attributes.has_key?(:'document_url')
374
+ self.document_url = attributes[:'document_url']
375
+ end
376
+ end
377
+
378
+ # Show invalid properties with the reasons. Usually used together with valid?
379
+ # @return Array for valid properties with the reasons
380
+ def list_invalid_properties
381
+ invalid_properties = Array.new
382
+ invalid_properties
383
+ end
384
+
385
+ # Check to see if the all the properties in the model are valid
386
+ # @return true if the model is valid
387
+ def valid?
388
+ expiration_interval_validator = EnumAttributeValidator.new('String', ['minutes', 'hours', 'days'])
389
+ return false unless expiration_interval_validator.valid?(@expiration_interval)
390
+ true
391
+ end
392
+
393
+ # Custom attribute writer method checking allowed values (enum).
394
+ # @param [Object] expiration_interval Object to be assigned
395
+ def expiration_interval=(expiration_interval)
396
+ validator = EnumAttributeValidator.new('String', ['minutes', 'hours', 'days'])
397
+ unless validator.valid?(expiration_interval)
398
+ fail ArgumentError, 'invalid value for "expiration_interval", must be one of #{validator.allowable_values}.'
399
+ end
400
+ @expiration_interval = expiration_interval
401
+ end
402
+
403
+ # Checks equality by comparing each attribute.
404
+ # @param [Object] Object to be compared
405
+ def ==(o)
406
+ return true if self.equal?(o)
407
+ self.class == o.class &&
408
+ document_processed == o.document_processed &&
409
+ expiration_interval == o.expiration_interval &&
410
+ scss == o.scss &&
411
+ document_state == o.document_state &&
412
+ expire_after == o.expire_after &&
413
+ description == o.description &&
414
+ slack_webhook_url == o.slack_webhook_url &&
415
+ demo == o.demo &&
416
+ path == o.path &&
417
+ header_html == o.header_html &&
418
+ public_web_form == o.public_web_form &&
419
+ field_order == o.field_order &&
420
+ permanent_document_url == o.permanent_document_url &&
421
+ html == o.html &&
422
+ template_type == o.template_type &&
423
+ id == o.id &&
424
+ page_dimensions == o.page_dimensions &&
425
+ locked == o.locked &&
426
+ page_count == o.page_count &&
427
+ encrypt_pdfs == o.encrypt_pdfs &&
428
+ webhook_url == o.webhook_url &&
429
+ embed_domains == o.embed_domains &&
430
+ parent_folder_id == o.parent_folder_id &&
431
+ allow_additional_properties == o.allow_additional_properties &&
432
+ encrypt_pdfs_password == o.encrypt_pdfs_password &&
433
+ public_submissions == o.public_submissions &&
434
+ shared_field_data == o.shared_field_data &&
435
+ document_md5 == o.document_md5 &&
436
+ first_template == o.first_template &&
437
+ defaults == o.defaults &&
438
+ editable_submissions == o.editable_submissions &&
439
+ expire_submissions == o.expire_submissions &&
440
+ name == o.name &&
441
+ footer_html == o.footer_html &&
442
+ document_parse_error == o.document_parse_error &&
443
+ fields == o.fields &&
444
+ document_filename == o.document_filename &&
445
+ redirect_url == o.redirect_url &&
446
+ document_url == o.document_url
447
+ end
448
+
449
+ # @see the `==` method
450
+ # @param [Object] Object to be compared
451
+ def eql?(o)
452
+ self == o
453
+ end
454
+
455
+ # Calculates hash code according to all attributes.
456
+ # @return [Fixnum] Hash code
457
+ def hash
458
+ [document_processed, expiration_interval, scss, document_state, expire_after, description, slack_webhook_url, demo, path, header_html, public_web_form, field_order, permanent_document_url, html, template_type, id, page_dimensions, locked, page_count, encrypt_pdfs, webhook_url, embed_domains, parent_folder_id, allow_additional_properties, encrypt_pdfs_password, public_submissions, shared_field_data, document_md5, first_template, defaults, editable_submissions, expire_submissions, name, footer_html, document_parse_error, fields, document_filename, redirect_url, document_url].hash
459
+ end
460
+
461
+ # Builds the object from hash
462
+ # @param [Hash] attributes Model attributes in the form of hash
463
+ # @return [Object] Returns the model itself
464
+ def build_from_hash(attributes)
465
+ return nil unless attributes.is_a?(Hash)
466
+ self.class.openapi_types.each_pair do |key, type|
467
+ if type =~ /\AArray<(.*)>/i
468
+ # check to ensure the input is an array given that the the attribute
469
+ # is documented as an array but the input is not
470
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
471
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
472
+ end
473
+ elsif !attributes[self.class.attribute_map[key]].nil?
474
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
475
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
476
+ end
477
+
478
+ self
479
+ end
480
+
481
+ # Deserializes the data based on type
482
+ # @param string type Data type
483
+ # @param string value Value to be deserialized
484
+ # @return [Object] Deserialized data
485
+ def _deserialize(type, value)
486
+ case type.to_sym
487
+ when :DateTime
488
+ DateTime.parse(value)
489
+ when :Date
490
+ Date.parse(value)
491
+ when :String
492
+ value.to_s
493
+ when :Integer
494
+ value.to_i
495
+ when :Float
496
+ value.to_f
497
+ when :BOOLEAN
498
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
499
+ true
500
+ else
501
+ false
502
+ end
503
+ when :Object
504
+ # generic object (usually a Hash), return directly
505
+ value
506
+ when /\AArray<(?<inner_type>.+)>\z/
507
+ inner_type = Regexp.last_match[:inner_type]
508
+ value.map { |v| _deserialize(inner_type, v) }
509
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
510
+ k_type = Regexp.last_match[:k_type]
511
+ v_type = Regexp.last_match[:v_type]
512
+ {}.tap do |hash|
513
+ value.each do |k, v|
514
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
515
+ end
516
+ end
517
+ else # model
518
+ temp_model = DocSpring.const_get(type).new
519
+ temp_model.build_from_hash(value)
520
+ end
521
+ end
522
+
523
+ # Returns the string representation of the object
524
+ # @return [String] String presentation of the object
525
+ def to_s
526
+ to_hash.to_s
527
+ end
528
+
529
+ # to_body is an alias to to_hash (backward compatibility)
530
+ # @return [Hash] Returns the object in the form of hash
531
+ def to_body
532
+ to_hash
533
+ end
534
+
535
+ # Returns the object in the form of hash
536
+ # @return [Hash] Returns the object in the form of hash
537
+ def to_hash
538
+ hash = {}
539
+ self.class.attribute_map.each_pair do |attr, param|
540
+ value = self.send(attr)
541
+ next if value.nil?
542
+ hash[param] = _to_hash(value)
543
+ end
544
+ hash
545
+ end
546
+
547
+ # Outputs non-array value in the form of hash
548
+ # For object, use to_hash. Otherwise, just return the value
549
+ # @param [Object] value Any valid value
550
+ # @return [Hash] Returns the value in the form of hash
551
+ def _to_hash(value)
552
+ if value.is_a?(Array)
553
+ value.compact.map { |v| _to_hash(v) }
554
+ elsif value.is_a?(Hash)
555
+ {}.tap do |hash|
556
+ value.each { |k, v| hash[k] = _to_hash(v) }
557
+ end
558
+ elsif value.respond_to? :to_hash
559
+ value.to_hash
560
+ else
561
+ value
562
+ end
563
+ end
564
+ end
565
+ end