docspring 4.6.0 → 4.8.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 (94) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +24 -0
  3. data/README.md +25 -1
  4. data/lib/docspring/api/client.rb +1934 -209
  5. data/lib/docspring/api_client.rb +1 -1
  6. data/lib/docspring/models/add_page_numbers_request.rb +279 -0
  7. data/lib/docspring/models/ask_support_help_request.rb +217 -0
  8. data/lib/docspring/models/base64_job_source.rb +222 -0
  9. data/lib/docspring/models/combined_pdf_job_source.rb +222 -0
  10. data/lib/docspring/models/compress_pdf_request.rb +207 -0
  11. data/lib/docspring/models/create_template_request.rb +22 -2
  12. data/lib/docspring/models/custom_file_job_source.rb +222 -0
  13. data/lib/docspring/models/decrypt_pdf_request.rb +217 -0
  14. data/lib/docspring/models/encrypt_pdf_request.rb +237 -0
  15. data/lib/docspring/models/error_code.rb +4 -1
  16. data/lib/docspring/models/error_info.rb +25 -5
  17. data/lib/docspring/models/extract_pages_request.rb +234 -0
  18. data/lib/docspring/models/field.rb +1 -1
  19. data/lib/docspring/models/field_input.rb +1 -1
  20. data/lib/docspring/models/flatten_pdf_request.rb +207 -0
  21. data/lib/docspring/models/html_engine_options.rb +1 -1
  22. data/lib/docspring/models/html_engine_options_input.rb +1 -1
  23. data/lib/docspring/models/htmlto_pdf_request.rb +322 -0
  24. data/lib/docspring/models/image_format.rb +41 -0
  25. data/lib/docspring/models/images_to_pdf_request.rb +241 -0
  26. data/lib/docspring/models/job.rb +508 -0
  27. data/lib/docspring/models/job_file.rb +308 -0
  28. data/lib/docspring/models/job_file_job_source.rb +232 -0
  29. data/lib/docspring/models/job_html_engine.rb +41 -0
  30. data/lib/docspring/models/job_list.rb +200 -0
  31. data/lib/docspring/models/job_operation.rb +53 -0
  32. data/lib/docspring/models/job_operation_filter.rb +53 -0
  33. data/lib/docspring/models/job_options.rb +392 -0
  34. data/lib/docspring/models/job_page_margin.rb +198 -0
  35. data/lib/docspring/models/job_page_size.rb +51 -0
  36. data/lib/docspring/models/job_source.rb +267 -0
  37. data/lib/docspring/models/job_source_input.rb +66 -0
  38. data/lib/docspring/models/job_source_type.rb +46 -0
  39. data/lib/docspring/models/job_state.rb +42 -0
  40. data/lib/docspring/models/markdown_to_pdf_request.rb +312 -0
  41. data/lib/docspring/models/open_support_ticket_request.rb +363 -0
  42. data/lib/docspring/models/page_image.rb +3 -3
  43. data/lib/docspring/models/page_number_position.rb +45 -0
  44. data/lib/docspring/models/page_size.rb +45 -0
  45. data/lib/docspring/models/pdf_permissions.rb +198 -0
  46. data/lib/docspring/models/pdf_permissions_input.rb +198 -0
  47. data/lib/docspring/models/pdfto_images_request.rb +269 -0
  48. data/lib/docspring/models/pdfto_text_request.rb +217 -0
  49. data/lib/docspring/models/reply_to_support_ticket_request.rb +217 -0
  50. data/lib/docspring/models/rotate_pages_request.rb +244 -0
  51. data/lib/docspring/models/send_support_feedback_request.rb +363 -0
  52. data/lib/docspring/models/split_pdf_request.rb +229 -0
  53. data/lib/docspring/models/submission_job_source.rb +222 -0
  54. data/lib/docspring/models/support_feedback.rb +239 -0
  55. data/lib/docspring/models/support_help.rb +316 -0
  56. data/lib/docspring/models/support_help_source.rb +212 -0
  57. data/lib/docspring/models/support_help_state.rb +42 -0
  58. data/lib/docspring/models/support_help_turn.rb +234 -0
  59. data/lib/docspring/models/support_help_turn_role.rb +41 -0
  60. data/lib/docspring/models/support_message.rb +301 -0
  61. data/lib/docspring/models/support_message_author.rb +42 -0
  62. data/lib/docspring/models/support_report_agent.rb +188 -0
  63. data/lib/docspring/models/support_report_category.rb +57 -0
  64. data/lib/docspring/models/support_report_impact.rb +42 -0
  65. data/lib/docspring/models/support_report_kind.rb +47 -0
  66. data/lib/docspring/models/support_report_source.rb +41 -0
  67. data/lib/docspring/models/support_ticket.rb +637 -0
  68. data/lib/docspring/models/support_ticket_list.rb +200 -0
  69. data/lib/docspring/models/support_ticket_list_status.rb +42 -0
  70. data/lib/docspring/models/support_ticket_notifications.rb +197 -0
  71. data/lib/docspring/models/support_ticket_reply.rb +210 -0
  72. data/lib/docspring/models/support_ticket_reply_outcome.rb +41 -0
  73. data/lib/docspring/models/support_ticket_resolution.rb +45 -0
  74. data/lib/docspring/models/support_ticket_status.rb +43 -0
  75. data/lib/docspring/models/support_ticket_watch.rb +239 -0
  76. data/lib/docspring/models/template.rb +41 -2
  77. data/lib/docspring/models/template_blank_page.rb +212 -0
  78. data/lib/docspring/models/template_blank_page_input.rb +212 -0
  79. data/lib/docspring/models/template_document.rb +1 -1
  80. data/lib/docspring/models/template_html_engine.rb +41 -0
  81. data/lib/docspring/models/template_page_images.rb +3 -3
  82. data/lib/docspring/models/template_page_list.rb +243 -0
  83. data/lib/docspring/models/template_page_list_input.rb +243 -0
  84. data/lib/docspring/models/template_page_processing_status.rb +28 -1
  85. data/lib/docspring/models/update_template_request.rb +33 -2
  86. data/lib/docspring/models/upload_job_source.rb +222 -0
  87. data/lib/docspring/models/url_job_source.rb +222 -0
  88. data/lib/docspring/models/watermark_layer.rb +41 -0
  89. data/lib/docspring/models/watermark_pdf_request.rb +316 -0
  90. data/lib/docspring/models/webhook_event_type.rb +4 -1
  91. data/lib/docspring/request_schemas.json +2424 -46
  92. data/lib/docspring/version.rb +1 -1
  93. data/lib/docspring.rb +71 -0
  94. metadata +72 -1
@@ -0,0 +1,508 @@
1
+ =begin
2
+ #DocSpring API
3
+
4
+ #Use DocSpring's API to fill PDF forms, generate PDFs and Word documents from HTML or Word templates, merge PDFs, and 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 tool that DocSpring ran on your files: split a PDF, render its pages as images, encrypt it, add a watermark, convert HTML or Markdown to PDF, and so on. Create one with the tool's endpoint (POST /jobs/split_pdf, ...). Its files are kept until it expires: `expires_in` seconds after it finishes, or else by the account's expiry setting for the PDF tools.
18
+ class Job < ApiModelBase
19
+ # The job's ID.
20
+ attr_accessor :id
21
+
22
+ # The tool the job runs, from the endpoint that created it (`split_pdf` for POST /jobs/split_pdf).
23
+ attr_accessor :operation
24
+
25
+ # `pending` until the job has run, then `processed`, or `error` when it couldn't run (`error_message` says why).
26
+ attr_accessor :state
27
+
28
+ # The files the job reads, in order. Empty for an html_to_pdf or markdown_to_pdf job whose request sent the document itself.
29
+ attr_accessor :inputs
30
+
31
+ # The tool's options, as they were sent. Passwords are never shown, and options left out aren't either.
32
+ attr_accessor :options
33
+
34
+ # The files the job made, in order. Empty until it has run, and once it has expired.
35
+ attr_accessor :files
36
+
37
+ # The credits the job used: one unit of the tool's price for up to 10 pages, more for longer or larger files. Null until it has run.
38
+ attr_accessor :credits
39
+
40
+ # Your own data about the job, such as an ID from your app. Up to 50 keys.
41
+ attr_accessor :metadata
42
+
43
+ # Why the job couldn't run, when `state` is `error`.
44
+ attr_accessor :error_message
45
+
46
+ # An expired job's files, metadata and input URLs have been deleted.
47
+ attr_accessor :expired
48
+
49
+ # When the job's files are deleted. Null until it finishes.
50
+ attr_accessor :expires_at
51
+
52
+ # When the job ran. Null until then.
53
+ attr_accessor :processed_at
54
+
55
+ # When the job was created.
56
+ attr_accessor :created_at
57
+
58
+ # When the job was last updated.
59
+ attr_accessor :updated_at
60
+
61
+ class EnumAttributeValidator
62
+ attr_reader :datatype
63
+ attr_reader :allowable_values
64
+
65
+ def initialize(datatype, allowable_values)
66
+ @allowable_values = allowable_values.map do |value|
67
+ case datatype.to_s
68
+ when /Integer/i
69
+ value.to_i
70
+ when /Float/i
71
+ value.to_f
72
+ else
73
+ value
74
+ end
75
+ end
76
+ end
77
+
78
+ def valid?(value)
79
+ !value || allowable_values.include?(value)
80
+ end
81
+ end
82
+
83
+ # Attribute mapping from ruby-style variable name to JSON key.
84
+ def self.attribute_map
85
+ {
86
+ :'id' => :'id',
87
+ :'operation' => :'operation',
88
+ :'state' => :'state',
89
+ :'inputs' => :'inputs',
90
+ :'options' => :'options',
91
+ :'files' => :'files',
92
+ :'credits' => :'credits',
93
+ :'metadata' => :'metadata',
94
+ :'error_message' => :'error_message',
95
+ :'expired' => :'expired',
96
+ :'expires_at' => :'expires_at',
97
+ :'processed_at' => :'processed_at',
98
+ :'created_at' => :'created_at',
99
+ :'updated_at' => :'updated_at'
100
+ }
101
+ end
102
+
103
+ # Returns attribute mapping this model knows about
104
+ def self.acceptable_attribute_map
105
+ attribute_map
106
+ end
107
+
108
+ # Returns all the JSON keys this model knows about
109
+ def self.acceptable_attributes
110
+ acceptable_attribute_map.values
111
+ end
112
+
113
+ # Attribute type mapping.
114
+ def self.openapi_types
115
+ {
116
+ :'id' => :'String',
117
+ :'operation' => :'JobOperation',
118
+ :'state' => :'JobState',
119
+ :'inputs' => :'Array<JobSource>',
120
+ :'options' => :'JobOptions',
121
+ :'files' => :'Array<JobFile>',
122
+ :'credits' => :'Integer',
123
+ :'metadata' => :'Hash<String, Object>',
124
+ :'error_message' => :'String',
125
+ :'expired' => :'Boolean',
126
+ :'expires_at' => :'Time',
127
+ :'processed_at' => :'Time',
128
+ :'created_at' => :'Time',
129
+ :'updated_at' => :'Time'
130
+ }
131
+ end
132
+
133
+ # List of attributes with nullable: true
134
+ def self.openapi_nullable
135
+ Set.new([
136
+ :'credits',
137
+ :'error_message',
138
+ :'expires_at',
139
+ :'processed_at',
140
+ ])
141
+ end
142
+
143
+ # Returns attribute type mapping
144
+ def self.acceptable_openapi_types
145
+ openapi_types
146
+ end
147
+
148
+ # Returns the nullable attributes
149
+ def self.acceptable_openapi_nullable
150
+ openapi_nullable
151
+ end
152
+
153
+ # Initializes the object
154
+ # @param [Hash] attributes Model attributes in the form of hash
155
+ def initialize(attributes = {})
156
+ if (!attributes.is_a?(Hash))
157
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DocSpring::Job` initialize method"
158
+ end
159
+
160
+ # check to see if the attribute exists and convert string to symbol for hash key
161
+ acceptable_attribute_map = self.class.acceptable_attribute_map
162
+ attributes = attributes.each_with_object({}) { |(k, v), h|
163
+ if (!acceptable_attribute_map.key?(k.to_sym))
164
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DocSpring::Job`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
165
+ end
166
+ h[k.to_sym] = v
167
+ }
168
+
169
+ if attributes.key?(:'id')
170
+ self.id = attributes[:'id']
171
+ else
172
+ self.id = nil
173
+ end
174
+
175
+ if attributes.key?(:'operation')
176
+ self.operation = attributes[:'operation']
177
+ else
178
+ self.operation = nil
179
+ end
180
+
181
+ if attributes.key?(:'state')
182
+ self.state = attributes[:'state']
183
+ else
184
+ self.state = nil
185
+ end
186
+
187
+ if attributes.key?(:'inputs')
188
+ if (value = attributes[:'inputs']).is_a?(Array)
189
+ self.inputs = value
190
+ end
191
+ else
192
+ self.inputs = nil
193
+ end
194
+
195
+ if attributes.key?(:'options')
196
+ self.options = attributes[:'options']
197
+ else
198
+ self.options = nil
199
+ end
200
+
201
+ if attributes.key?(:'files')
202
+ if (value = attributes[:'files']).is_a?(Array)
203
+ self.files = value
204
+ end
205
+ else
206
+ self.files = nil
207
+ end
208
+
209
+ if attributes.key?(:'credits')
210
+ self.credits = attributes[:'credits']
211
+ else
212
+ self.credits = nil
213
+ end
214
+
215
+ if attributes.key?(:'metadata')
216
+ if (value = attributes[:'metadata']).is_a?(Hash)
217
+ self.metadata = value
218
+ end
219
+ else
220
+ self.metadata = nil
221
+ end
222
+
223
+ if attributes.key?(:'error_message')
224
+ self.error_message = attributes[:'error_message']
225
+ else
226
+ self.error_message = nil
227
+ end
228
+
229
+ if attributes.key?(:'expired')
230
+ self.expired = attributes[:'expired']
231
+ else
232
+ self.expired = nil
233
+ end
234
+
235
+ if attributes.key?(:'expires_at')
236
+ self.expires_at = attributes[:'expires_at']
237
+ else
238
+ self.expires_at = nil
239
+ end
240
+
241
+ if attributes.key?(:'processed_at')
242
+ self.processed_at = attributes[:'processed_at']
243
+ else
244
+ self.processed_at = nil
245
+ end
246
+
247
+ if attributes.key?(:'created_at')
248
+ self.created_at = attributes[:'created_at']
249
+ else
250
+ self.created_at = nil
251
+ end
252
+
253
+ if attributes.key?(:'updated_at')
254
+ self.updated_at = attributes[:'updated_at']
255
+ else
256
+ self.updated_at = nil
257
+ end
258
+ end
259
+
260
+ # Show invalid properties with the reasons. Usually used together with valid?
261
+ # @return Array for valid properties with the reasons
262
+ def list_invalid_properties
263
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
264
+ invalid_properties = Array.new
265
+ if @id.nil?
266
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
267
+ end
268
+
269
+ if @operation.nil?
270
+ invalid_properties.push('invalid value for "operation", operation cannot be nil.')
271
+ end
272
+
273
+ if @state.nil?
274
+ invalid_properties.push('invalid value for "state", state cannot be nil.')
275
+ end
276
+
277
+ if @inputs.nil?
278
+ invalid_properties.push('invalid value for "inputs", inputs cannot be nil.')
279
+ end
280
+
281
+ if @options.nil?
282
+ invalid_properties.push('invalid value for "options", options cannot be nil.')
283
+ end
284
+
285
+ if @files.nil?
286
+ invalid_properties.push('invalid value for "files", files cannot be nil.')
287
+ end
288
+
289
+ if @metadata.nil?
290
+ invalid_properties.push('invalid value for "metadata", metadata cannot be nil.')
291
+ end
292
+
293
+ if @expired.nil?
294
+ invalid_properties.push('invalid value for "expired", expired cannot be nil.')
295
+ end
296
+
297
+ if @created_at.nil?
298
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
299
+ end
300
+
301
+ if @updated_at.nil?
302
+ invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
303
+ end
304
+
305
+ invalid_properties
306
+ end
307
+
308
+ # Check to see if the all the properties in the model are valid
309
+ # @return true if the model is valid
310
+ def valid?
311
+ warn '[DEPRECATED] the `valid?` method is obsolete'
312
+ return false if @id.nil?
313
+ return false if @operation.nil?
314
+ return false if @state.nil?
315
+ return false if @inputs.nil?
316
+ return false if @options.nil?
317
+ return false if @files.nil?
318
+ return false if @metadata.nil?
319
+ return false if @expired.nil?
320
+ return false if @created_at.nil?
321
+ return false if @updated_at.nil?
322
+ true
323
+ end
324
+
325
+ # Custom attribute writer method with validation
326
+ # @param [Object] id Value to be assigned
327
+ def id=(id)
328
+ if id.nil?
329
+ fail ArgumentError, 'id cannot be nil'
330
+ end
331
+
332
+ @id = id
333
+ end
334
+
335
+ # Custom attribute writer method with validation
336
+ # @param [Object] operation Value to be assigned
337
+ def operation=(operation)
338
+ if operation.nil?
339
+ fail ArgumentError, 'operation cannot be nil'
340
+ end
341
+
342
+ @operation = operation
343
+ end
344
+
345
+ # Custom attribute writer method with validation
346
+ # @param [Object] state Value to be assigned
347
+ def state=(state)
348
+ if state.nil?
349
+ fail ArgumentError, 'state cannot be nil'
350
+ end
351
+
352
+ @state = state
353
+ end
354
+
355
+ # Custom attribute writer method with validation
356
+ # @param [Object] inputs Value to be assigned
357
+ def inputs=(inputs)
358
+ if inputs.nil?
359
+ fail ArgumentError, 'inputs cannot be nil'
360
+ end
361
+
362
+ @inputs = inputs
363
+ end
364
+
365
+ # Custom attribute writer method with validation
366
+ # @param [Object] options Value to be assigned
367
+ def options=(options)
368
+ if options.nil?
369
+ fail ArgumentError, 'options cannot be nil'
370
+ end
371
+
372
+ @options = options
373
+ end
374
+
375
+ # Custom attribute writer method with validation
376
+ # @param [Object] files Value to be assigned
377
+ def files=(files)
378
+ if files.nil?
379
+ fail ArgumentError, 'files cannot be nil'
380
+ end
381
+
382
+ @files = files
383
+ end
384
+
385
+ # Custom attribute writer method with validation
386
+ # @param [Object] metadata Value to be assigned
387
+ def metadata=(metadata)
388
+ if metadata.nil?
389
+ fail ArgumentError, 'metadata cannot be nil'
390
+ end
391
+
392
+ @metadata = metadata
393
+ end
394
+
395
+ # Custom attribute writer method with validation
396
+ # @param [Object] expired Value to be assigned
397
+ def expired=(expired)
398
+ if expired.nil?
399
+ fail ArgumentError, 'expired cannot be nil'
400
+ end
401
+
402
+ @expired = expired
403
+ end
404
+
405
+ # Custom attribute writer method with validation
406
+ # @param [Object] created_at Value to be assigned
407
+ def created_at=(created_at)
408
+ if created_at.nil?
409
+ fail ArgumentError, 'created_at cannot be nil'
410
+ end
411
+
412
+ @created_at = created_at
413
+ end
414
+
415
+ # Custom attribute writer method with validation
416
+ # @param [Object] updated_at Value to be assigned
417
+ def updated_at=(updated_at)
418
+ if updated_at.nil?
419
+ fail ArgumentError, 'updated_at cannot be nil'
420
+ end
421
+
422
+ @updated_at = updated_at
423
+ end
424
+
425
+ # Checks equality by comparing each attribute.
426
+ # @param [Object] Object to be compared
427
+ def ==(o)
428
+ return true if self.equal?(o)
429
+ self.class == o.class &&
430
+ id == o.id &&
431
+ operation == o.operation &&
432
+ state == o.state &&
433
+ inputs == o.inputs &&
434
+ options == o.options &&
435
+ files == o.files &&
436
+ credits == o.credits &&
437
+ metadata == o.metadata &&
438
+ error_message == o.error_message &&
439
+ expired == o.expired &&
440
+ expires_at == o.expires_at &&
441
+ processed_at == o.processed_at &&
442
+ created_at == o.created_at &&
443
+ updated_at == o.updated_at
444
+ end
445
+
446
+ # @see the `==` method
447
+ # @param [Object] Object to be compared
448
+ def eql?(o)
449
+ self == o
450
+ end
451
+
452
+ # Calculates hash code according to all attributes.
453
+ # @return [Integer] Hash code
454
+ def hash
455
+ [id, operation, state, inputs, options, files, credits, metadata, error_message, expired, expires_at, processed_at, created_at, updated_at].hash
456
+ end
457
+
458
+ # Builds the object from hash
459
+ # @param [Hash] attributes Model attributes in the form of hash
460
+ # @return [Object] Returns the model itself
461
+ def self.build_from_hash(attributes)
462
+ return nil unless attributes.is_a?(Hash)
463
+ attributes = attributes.transform_keys(&:to_sym)
464
+ # include attributes inherited from allOf parents (the nearest declaration wins)
465
+ map = acceptable_attribute_map
466
+ transformed_hash = {}
467
+ acceptable_openapi_types.each_pair do |key, type|
468
+ if attributes.key?(map[key]) && attributes[map[key]].nil?
469
+ transformed_hash["#{key}"] = nil
470
+ elsif type =~ /\AArray<(.*)>/i
471
+ # check to ensure the input is an array given that the attribute
472
+ # is documented as an array but the input is not
473
+ if attributes[map[key]].is_a?(Array)
474
+ transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
475
+ end
476
+ elsif !attributes[map[key]].nil?
477
+ transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
478
+ end
479
+ end
480
+ # Responses can include enum values added after this client was released, so the enum setters
481
+ # accept any value while the model is built from a response
482
+ allocate.tap do |model|
483
+ model.instance_variable_set(:@_skip_enum_validation, true)
484
+ model.send(:initialize, transformed_hash)
485
+ model.remove_instance_variable(:@_skip_enum_validation)
486
+ end
487
+ end
488
+
489
+ # Returns the object in the form of hash
490
+ # @return [Hash] Returns the object in the form of hash
491
+ def to_hash
492
+ hash = {}
493
+ # include attributes inherited from allOf parents (the nearest declaration wins)
494
+ self.class.acceptable_attribute_map.each_pair do |attr, param|
495
+ value = self.send(attr)
496
+ if value.nil?
497
+ is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
498
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
499
+ end
500
+
501
+ hash[param] = _to_hash(value)
502
+ end
503
+ hash
504
+ end
505
+
506
+ end
507
+
508
+ end