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
@@ -28,7 +28,7 @@ module DocSpring
28
28
  # `pdf`: fields placed on an uploaded PDF. `html`: a PDF rendered from HTML and SCSS. It can't be changed after the template is created.
29
29
  attr_accessor :template_type
30
30
 
31
- # Whether the template can generate PDFs. HTML templates are always ready. A PDF template is ready once its document has been processed (`document.state` is `processed`).
31
+ # Whether the template can generate PDFs. HTML templates are always ready. A PDF template is ready once DocSpring has stored its PDF, made an image of each page and finished looking for fields on each page, which can be after `document.state` becomes `processed`. A PDF template with no PDF (`document` is null) isn't ready.
32
32
  attr_accessor :ready
33
33
 
34
34
  # The PDF of a PDF template. Null for HTML templates, and for a PDF template that has no PDF yet.
@@ -40,9 +40,6 @@ module DocSpring
40
40
  # The path of the folder the template is in, such as `/Contracts`. `/` for a template at the root.
41
41
  attr_accessor :path
42
42
 
43
- # The published version this is, such as `1.2.0`. Null for the draft.
44
- attr_accessor :version
45
-
46
43
  # The template's latest published version. Null if no version has been published.
47
44
  attr_accessor :latest_version
48
45
 
@@ -52,6 +49,18 @@ module DocSpring
52
49
  # A locked template can't be changed or deleted until it's unlocked (`locked` can always be changed).
53
50
  attr_accessor :locked
54
51
 
52
+ # When the draft was last changed.
53
+ attr_accessor :last_changed_at
54
+
55
+ # When the template was created.
56
+ attr_accessor :created_at
57
+
58
+ # When the template was last updated.
59
+ attr_accessor :updated_at
60
+
61
+ # The published version this is, such as `1.2.0`. Null for the draft.
62
+ attr_accessor :version
63
+
55
64
  # Print the submission ID in the footer of each page of PDFs signed through signature requests.
56
65
  attr_accessor :add_signature_request_submission_id_footers
57
66
 
@@ -70,7 +79,7 @@ module DocSpring
70
79
  # Generate PDFs whose text and check fields stay fillable ("Generate Editable PDFs"). A submission's `editable` overrides it.
71
80
  attr_accessor :editable_submissions
72
81
 
73
- # The sites where the template's signature requests, forms and embedded template editor can be loaded: a host such as `app.example.com`, with an optional leading wildcard (`*.example.com`), port (`localhost:3000`) or scheme (`https://app.example.com`; without one, `http` and `https` both work). When it's empty, live signature requests don't load on any site, and the embedded template editor loads on every site.
82
+ # The sites that can embed the template's live signature requests and its embedded template editor: a host such as `app.example.com`, with an optional leading wildcard (`*.example.com`), port (`localhost:3000`) or scheme (`https://app.example.com`; without one, `http` and `https` both work). Browsers open a live signature request in a frame only on these sites (and DocSpring's), so with an empty list it can't be embedded anywhere; a test signature request can be embedded on any site. The embedded template editor loads only for a page on one of these sites (by its Referer or Origin header), and on any site when the list is empty. Forms embedded on a page (Visual Forms JS and the simple form) aren't restricted.
74
83
  attr_accessor :embed_domains
75
84
 
76
85
  # Allow the embedded template editor to change sensitive template settings (webhooks, redirect URL, encryption, public access, expiration and so on).
@@ -115,18 +124,9 @@ module DocSpring
115
124
  # Whether `slack_webhook_url` is set.
116
125
  attr_accessor :has_slack_webhook_url
117
126
 
118
- # When the draft was last changed.
119
- attr_accessor :last_changed_at
120
-
121
127
  # Who last changed the draft: a user in your account, an API token, or someone using the embedded template editor. Null if no change has been recorded.
122
128
  attr_accessor :last_changed_by
123
129
 
124
- # When the template was created.
125
- attr_accessor :created_at
126
-
127
- # When the template was last updated.
128
- attr_accessor :updated_at
129
-
130
130
  attr_accessor :defaults
131
131
 
132
132
  # Conditional logic: each rule shows or hides its target fields, or makes them required, depending on the values of other fields.
@@ -156,6 +156,9 @@ module DocSpring
156
156
  # How an HTML template's PDFs are printed. Null for PDF templates. Setting it replaces the whole object: options left out use their defaults.
157
157
  attr_accessor :html_engine_options
158
158
 
159
+ # Whether an HTML template HTML-escapes the values it prints. When true, `{{ value }}` prints a value as text, so a `<` or `&` in it is printed as that character, and `{{ value | raw }}` prints a value as HTML. New HTML templates default to true. Templates created before October 2026, or with API v1, default to false, which prints every value as HTML. Null for PDF templates.
160
+ attr_accessor :html_escape_data
161
+
159
162
  # The token that opens the template in the embedded template editor.
160
163
  attr_accessor :embed_edit_token
161
164
 
@@ -195,10 +198,13 @@ module DocSpring
195
198
  :'document' => :'document',
196
199
  :'parent_folder_id' => :'parent_folder_id',
197
200
  :'path' => :'path',
198
- :'version' => :'version',
199
201
  :'latest_version' => :'latest_version',
200
202
  :'version_published_at' => :'version_published_at',
201
203
  :'locked' => :'locked',
204
+ :'last_changed_at' => :'last_changed_at',
205
+ :'created_at' => :'created_at',
206
+ :'updated_at' => :'updated_at',
207
+ :'version' => :'version',
202
208
  :'add_signature_request_submission_id_footers' => :'add_signature_request_submission_id_footers',
203
209
  :'ai_field_naming_language' => :'ai_field_naming_language',
204
210
  :'allow_additional_properties' => :'allow_additional_properties',
@@ -220,10 +226,7 @@ module DocSpring
220
226
  :'public_web_form' => :'public_web_form',
221
227
  :'redirect_url' => :'redirect_url',
222
228
  :'has_slack_webhook_url' => :'has_slack_webhook_url',
223
- :'last_changed_at' => :'last_changed_at',
224
229
  :'last_changed_by' => :'last_changed_by',
225
- :'created_at' => :'created_at',
226
- :'updated_at' => :'updated_at',
227
230
  :'defaults' => :'defaults',
228
231
  :'field_dependencies' => :'field_dependencies',
229
232
  :'field_groups' => :'field_groups',
@@ -234,6 +237,7 @@ module DocSpring
234
237
  :'header_html' => :'header_html',
235
238
  :'footer_html' => :'footer_html',
236
239
  :'html_engine_options' => :'html_engine_options',
240
+ :'html_escape_data' => :'html_escape_data',
237
241
  :'embed_edit_token' => :'embed_edit_token',
238
242
  :'versions' => :'versions'
239
243
  }
@@ -260,10 +264,13 @@ module DocSpring
260
264
  :'document' => :'TemplateDocument',
261
265
  :'parent_folder_id' => :'String',
262
266
  :'path' => :'String',
263
- :'version' => :'String',
264
267
  :'latest_version' => :'String',
265
268
  :'version_published_at' => :'Time',
266
269
  :'locked' => :'Boolean',
270
+ :'last_changed_at' => :'Time',
271
+ :'created_at' => :'Time',
272
+ :'updated_at' => :'Time',
273
+ :'version' => :'String',
267
274
  :'add_signature_request_submission_id_footers' => :'Boolean',
268
275
  :'ai_field_naming_language' => :'AiFieldNamingLanguage',
269
276
  :'allow_additional_properties' => :'Boolean',
@@ -285,10 +292,7 @@ module DocSpring
285
292
  :'public_web_form' => :'Boolean',
286
293
  :'redirect_url' => :'String',
287
294
  :'has_slack_webhook_url' => :'Boolean',
288
- :'last_changed_at' => :'Time',
289
295
  :'last_changed_by' => :'TemplateActor',
290
- :'created_at' => :'Time',
291
- :'updated_at' => :'Time',
292
296
  :'defaults' => :'TemplateDefaults',
293
297
  :'field_dependencies' => :'Array<TemplateFieldDependency>',
294
298
  :'field_groups' => :'Array<FieldGroup>',
@@ -299,6 +303,7 @@ module DocSpring
299
303
  :'header_html' => :'String',
300
304
  :'footer_html' => :'String',
301
305
  :'html_engine_options' => :'HtmlEngineOptions',
306
+ :'html_escape_data' => :'Boolean',
302
307
  :'embed_edit_token' => :'String',
303
308
  :'versions' => :'Array<TemplateVersion>'
304
309
  }
@@ -311,12 +316,12 @@ module DocSpring
311
316
  :'description',
312
317
  :'document',
313
318
  :'parent_folder_id',
314
- :'version',
315
319
  :'latest_version',
316
320
  :'version_published_at',
321
+ :'last_changed_at',
322
+ :'version',
317
323
  :'ai_field_naming_language',
318
324
  :'redirect_url',
319
- :'last_changed_at',
320
325
  :'last_changed_by',
321
326
  :'predefined_fields_sample_data',
322
327
  :'html',
@@ -324,6 +329,7 @@ module DocSpring
324
329
  :'header_html',
325
330
  :'footer_html',
326
331
  :'html_engine_options',
332
+ :'html_escape_data',
327
333
  :'embed_edit_token',
328
334
  ])
329
335
  end
@@ -402,12 +408,6 @@ module DocSpring
402
408
  self.path = nil
403
409
  end
404
410
 
405
- if attributes.key?(:'version')
406
- self.version = attributes[:'version']
407
- else
408
- self.version = nil
409
- end
410
-
411
411
  if attributes.key?(:'latest_version')
412
412
  self.latest_version = attributes[:'latest_version']
413
413
  else
@@ -426,6 +426,30 @@ module DocSpring
426
426
  self.locked = nil
427
427
  end
428
428
 
429
+ if attributes.key?(:'last_changed_at')
430
+ self.last_changed_at = attributes[:'last_changed_at']
431
+ else
432
+ self.last_changed_at = nil
433
+ end
434
+
435
+ if attributes.key?(:'created_at')
436
+ self.created_at = attributes[:'created_at']
437
+ else
438
+ self.created_at = nil
439
+ end
440
+
441
+ if attributes.key?(:'updated_at')
442
+ self.updated_at = attributes[:'updated_at']
443
+ else
444
+ self.updated_at = nil
445
+ end
446
+
447
+ if attributes.key?(:'version')
448
+ self.version = attributes[:'version']
449
+ else
450
+ self.version = nil
451
+ end
452
+
429
453
  if attributes.key?(:'add_signature_request_submission_id_footers')
430
454
  self.add_signature_request_submission_id_footers = attributes[:'add_signature_request_submission_id_footers']
431
455
  else
@@ -554,30 +578,12 @@ module DocSpring
554
578
  self.has_slack_webhook_url = nil
555
579
  end
556
580
 
557
- if attributes.key?(:'last_changed_at')
558
- self.last_changed_at = attributes[:'last_changed_at']
559
- else
560
- self.last_changed_at = nil
561
- end
562
-
563
581
  if attributes.key?(:'last_changed_by')
564
582
  self.last_changed_by = attributes[:'last_changed_by']
565
583
  else
566
584
  self.last_changed_by = nil
567
585
  end
568
586
 
569
- if attributes.key?(:'created_at')
570
- self.created_at = attributes[:'created_at']
571
- else
572
- self.created_at = nil
573
- end
574
-
575
- if attributes.key?(:'updated_at')
576
- self.updated_at = attributes[:'updated_at']
577
- else
578
- self.updated_at = nil
579
- end
580
-
581
587
  if attributes.key?(:'defaults')
582
588
  self.defaults = attributes[:'defaults']
583
589
  else
@@ -646,6 +652,12 @@ module DocSpring
646
652
  self.html_engine_options = nil
647
653
  end
648
654
 
655
+ if attributes.key?(:'html_escape_data')
656
+ self.html_escape_data = attributes[:'html_escape_data']
657
+ else
658
+ self.html_escape_data = nil
659
+ end
660
+
649
661
  if attributes.key?(:'embed_edit_token')
650
662
  self.embed_edit_token = attributes[:'embed_edit_token']
651
663
  else
@@ -686,6 +698,14 @@ module DocSpring
686
698
  invalid_properties.push('invalid value for "locked", locked cannot be nil.')
687
699
  end
688
700
 
701
+ if @created_at.nil?
702
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
703
+ end
704
+
705
+ if @updated_at.nil?
706
+ invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
707
+ end
708
+
689
709
  if @add_signature_request_submission_id_footers.nil?
690
710
  invalid_properties.push('invalid value for "add_signature_request_submission_id_footers", add_signature_request_submission_id_footers cannot be nil.')
691
711
  end
@@ -762,14 +782,6 @@ module DocSpring
762
782
  invalid_properties.push('invalid value for "has_slack_webhook_url", has_slack_webhook_url cannot be nil.')
763
783
  end
764
784
 
765
- if @created_at.nil?
766
- invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
767
- end
768
-
769
- if @updated_at.nil?
770
- invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
771
- end
772
-
773
785
  if @defaults.nil?
774
786
  invalid_properties.push('invalid value for "defaults", defaults cannot be nil.')
775
787
  end
@@ -802,6 +814,8 @@ module DocSpring
802
814
  return false if @ready.nil?
803
815
  return false if @path.nil?
804
816
  return false if @locked.nil?
817
+ return false if @created_at.nil?
818
+ return false if @updated_at.nil?
805
819
  return false if @add_signature_request_submission_id_footers.nil?
806
820
  return false if @allow_additional_properties.nil?
807
821
  return false if @allow_skipping_optional_fields.nil?
@@ -821,8 +835,6 @@ module DocSpring
821
835
  return false if @public_submissions.nil?
822
836
  return false if @public_web_form.nil?
823
837
  return false if @has_slack_webhook_url.nil?
824
- return false if @created_at.nil?
825
- return false if @updated_at.nil?
826
838
  return false if @defaults.nil?
827
839
  return false if @field_dependencies.nil?
828
840
  return false if @field_groups.nil?
@@ -881,6 +893,26 @@ module DocSpring
881
893
  @locked = locked
882
894
  end
883
895
 
896
+ # Custom attribute writer method with validation
897
+ # @param [Object] created_at Value to be assigned
898
+ def created_at=(created_at)
899
+ if created_at.nil?
900
+ fail ArgumentError, 'created_at cannot be nil'
901
+ end
902
+
903
+ @created_at = created_at
904
+ end
905
+
906
+ # Custom attribute writer method with validation
907
+ # @param [Object] updated_at Value to be assigned
908
+ def updated_at=(updated_at)
909
+ if updated_at.nil?
910
+ fail ArgumentError, 'updated_at cannot be nil'
911
+ end
912
+
913
+ @updated_at = updated_at
914
+ end
915
+
884
916
  # Custom attribute writer method with validation
885
917
  # @param [Object] add_signature_request_submission_id_footers Value to be assigned
886
918
  def add_signature_request_submission_id_footers=(add_signature_request_submission_id_footers)
@@ -1071,26 +1103,6 @@ module DocSpring
1071
1103
  @has_slack_webhook_url = has_slack_webhook_url
1072
1104
  end
1073
1105
 
1074
- # Custom attribute writer method with validation
1075
- # @param [Object] created_at Value to be assigned
1076
- def created_at=(created_at)
1077
- if created_at.nil?
1078
- fail ArgumentError, 'created_at cannot be nil'
1079
- end
1080
-
1081
- @created_at = created_at
1082
- end
1083
-
1084
- # Custom attribute writer method with validation
1085
- # @param [Object] updated_at Value to be assigned
1086
- def updated_at=(updated_at)
1087
- if updated_at.nil?
1088
- fail ArgumentError, 'updated_at cannot be nil'
1089
- end
1090
-
1091
- @updated_at = updated_at
1092
- end
1093
-
1094
1106
  # Custom attribute writer method with validation
1095
1107
  # @param [Object] defaults Value to be assigned
1096
1108
  def defaults=(defaults)
@@ -1154,10 +1166,13 @@ module DocSpring
1154
1166
  document == o.document &&
1155
1167
  parent_folder_id == o.parent_folder_id &&
1156
1168
  path == o.path &&
1157
- version == o.version &&
1158
1169
  latest_version == o.latest_version &&
1159
1170
  version_published_at == o.version_published_at &&
1160
1171
  locked == o.locked &&
1172
+ last_changed_at == o.last_changed_at &&
1173
+ created_at == o.created_at &&
1174
+ updated_at == o.updated_at &&
1175
+ version == o.version &&
1161
1176
  add_signature_request_submission_id_footers == o.add_signature_request_submission_id_footers &&
1162
1177
  ai_field_naming_language == o.ai_field_naming_language &&
1163
1178
  allow_additional_properties == o.allow_additional_properties &&
@@ -1179,10 +1194,7 @@ module DocSpring
1179
1194
  public_web_form == o.public_web_form &&
1180
1195
  redirect_url == o.redirect_url &&
1181
1196
  has_slack_webhook_url == o.has_slack_webhook_url &&
1182
- last_changed_at == o.last_changed_at &&
1183
1197
  last_changed_by == o.last_changed_by &&
1184
- created_at == o.created_at &&
1185
- updated_at == o.updated_at &&
1186
1198
  defaults == o.defaults &&
1187
1199
  field_dependencies == o.field_dependencies &&
1188
1200
  field_groups == o.field_groups &&
@@ -1193,6 +1205,7 @@ module DocSpring
1193
1205
  header_html == o.header_html &&
1194
1206
  footer_html == o.footer_html &&
1195
1207
  html_engine_options == o.html_engine_options &&
1208
+ html_escape_data == o.html_escape_data &&
1196
1209
  embed_edit_token == o.embed_edit_token &&
1197
1210
  versions == o.versions
1198
1211
  end
@@ -1206,7 +1219,7 @@ module DocSpring
1206
1219
  # Calculates hash code according to all attributes.
1207
1220
  # @return [Integer] Hash code
1208
1221
  def hash
1209
- [id, name, description, template_type, ready, document, parent_folder_id, path, version, latest_version, version_published_at, locked, add_signature_request_submission_id_footers, ai_field_naming_language, allow_additional_properties, allow_skipping_optional_fields, default_form_mode, editable_submissions, embed_domains, embed_edit_allow_settings, embed_edit_allow_versioning, embed_edit_allow_document_replacement, encrypt_pdfs, has_encrypt_pdfs_password, expire_submissions, expire_after, expiration_interval, merge_audit_trail_pdf, parse_dates_using_template_date_format, public_submissions, public_web_form, redirect_url, has_slack_webhook_url, last_changed_at, last_changed_by, created_at, updated_at, defaults, field_dependencies, field_groups, predefined_fields, predefined_fields_sample_data, html, scss, header_html, footer_html, html_engine_options, embed_edit_token, versions].hash
1222
+ [id, name, description, template_type, ready, document, parent_folder_id, path, latest_version, version_published_at, locked, last_changed_at, created_at, updated_at, version, add_signature_request_submission_id_footers, ai_field_naming_language, allow_additional_properties, allow_skipping_optional_fields, default_form_mode, editable_submissions, embed_domains, embed_edit_allow_settings, embed_edit_allow_versioning, embed_edit_allow_document_replacement, encrypt_pdfs, has_encrypt_pdfs_password, expire_submissions, expire_after, expiration_interval, merge_audit_trail_pdf, parse_dates_using_template_date_format, public_submissions, public_web_form, redirect_url, has_slack_webhook_url, last_changed_by, defaults, field_dependencies, field_groups, predefined_fields, predefined_fields_sample_data, html, scss, header_html, footer_html, html_engine_options, html_escape_data, embed_edit_token, versions].hash
1210
1223
  end
1211
1224
 
1212
1225
  # Builds the object from hash
@@ -16,7 +16,7 @@ require 'time'
16
16
  module DocSpring
17
17
  # A user in your account, an API token, or someone using the embedded template editor.
18
18
  class TemplateActor < ApiModelBase
19
- # `user`: a user in your account. `api`: an API token. `external_user`: someone using the embedded template editor, as identified by your app.
19
+ # `user`: a user in your account, also when they make the change with an app they connected (an OAuth access token). `api`: an API token. `external_user`: someone using the embedded template editor, as identified by your app.
20
20
  attr_accessor :type
21
21
 
22
22
  # The user's ID, for `user`.
@@ -19,21 +19,21 @@ module DocSpring
19
19
  # The PDF's file name. Null until a `document_url` has been downloaded.
20
20
  attr_accessor :filename
21
21
 
22
- # The MD5 hash of the PDF.
23
- attr_accessor :md5
24
-
25
- # `pending` while DocSpring processes the PDF, then `processed`. `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.
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.
26
23
  attr_accessor :state
27
24
 
28
25
  # Why the PDF couldn't be processed or downloaded, and how to fix it. Null unless `state` is an error.
29
26
  attr_accessor :error_message
30
27
 
31
- # Whether the fields are being re-imported from this PDF (`reimport_fields` when the PDF was replaced): `requested` while DocSpring processes the PDF, then `imported`, or `no_fields` when the PDF had no fillable fields and the template kept its fields. `none` when no re-import was asked for, or when it couldn't run (the PDF couldn't be processed, or the template was locked or published while it was).
32
- attr_accessor :field_reimport_state
33
-
34
28
  # 0 until the PDF has been processed.
35
29
  attr_accessor :page_count
36
30
 
31
+ # The MD5 hash of the PDF.
32
+ attr_accessor :md5
33
+
34
+ # Whether the fields are being re-imported from this PDF (`reimport_fields` when the PDF was replaced): `requested` while DocSpring processes the PDF, then `imported`, or `no_fields` when the PDF had no fillable fields and the template kept its fields. `none` when no re-import was asked for, or when it couldn't run (the PDF couldn't be processed, or the template was locked or published while it was).
35
+ attr_accessor :field_reimport_state
36
+
37
37
  # Each page's width and height in PDF points. Null until the PDF has been processed.
38
38
  attr_accessor :page_dimensions
39
39
 
@@ -78,11 +78,11 @@ module DocSpring
78
78
  def self.attribute_map
79
79
  {
80
80
  :'filename' => :'filename',
81
- :'md5' => :'md5',
82
81
  :'state' => :'state',
83
82
  :'error_message' => :'error_message',
84
- :'field_reimport_state' => :'field_reimport_state',
85
83
  :'page_count' => :'page_count',
84
+ :'md5' => :'md5',
85
+ :'field_reimport_state' => :'field_reimport_state',
86
86
  :'page_dimensions' => :'page_dimensions',
87
87
  :'has_fillable_fields' => :'has_fillable_fields',
88
88
  :'page_processing_statuses' => :'page_processing_statuses',
@@ -106,11 +106,11 @@ module DocSpring
106
106
  def self.openapi_types
107
107
  {
108
108
  :'filename' => :'String',
109
- :'md5' => :'String',
110
109
  :'state' => :'TemplateDocumentState',
111
110
  :'error_message' => :'String',
112
- :'field_reimport_state' => :'FieldReimportState',
113
111
  :'page_count' => :'Integer',
112
+ :'md5' => :'String',
113
+ :'field_reimport_state' => :'FieldReimportState',
114
114
  :'page_dimensions' => :'Array<Array<Float>>',
115
115
  :'has_fillable_fields' => :'Boolean',
116
116
  :'page_processing_statuses' => :'Array<TemplatePageProcessingStatus>',
@@ -124,8 +124,8 @@ module DocSpring
124
124
  def self.openapi_nullable
125
125
  Set.new([
126
126
  :'filename',
127
- :'md5',
128
127
  :'error_message',
128
+ :'md5',
129
129
  :'page_dimensions',
130
130
  :'has_fillable_fields',
131
131
  :'field_logic_status',
@@ -166,12 +166,6 @@ module DocSpring
166
166
  self.filename = nil
167
167
  end
168
168
 
169
- if attributes.key?(:'md5')
170
- self.md5 = attributes[:'md5']
171
- else
172
- self.md5 = nil
173
- end
174
-
175
169
  if attributes.key?(:'state')
176
170
  self.state = attributes[:'state']
177
171
  else
@@ -184,18 +178,24 @@ module DocSpring
184
178
  self.error_message = nil
185
179
  end
186
180
 
187
- if attributes.key?(:'field_reimport_state')
188
- self.field_reimport_state = attributes[:'field_reimport_state']
189
- else
190
- self.field_reimport_state = nil
191
- end
192
-
193
181
  if attributes.key?(:'page_count')
194
182
  self.page_count = attributes[:'page_count']
195
183
  else
196
184
  self.page_count = nil
197
185
  end
198
186
 
187
+ if attributes.key?(:'md5')
188
+ self.md5 = attributes[:'md5']
189
+ else
190
+ self.md5 = nil
191
+ end
192
+
193
+ if attributes.key?(:'field_reimport_state')
194
+ self.field_reimport_state = attributes[:'field_reimport_state']
195
+ else
196
+ self.field_reimport_state = nil
197
+ end
198
+
199
199
  if attributes.key?(:'page_dimensions')
200
200
  if (value = attributes[:'page_dimensions']).is_a?(Array) || value.nil?
201
201
  self.page_dimensions = value
@@ -246,14 +246,14 @@ module DocSpring
246
246
  invalid_properties.push('invalid value for "state", state cannot be nil.')
247
247
  end
248
248
 
249
- if @field_reimport_state.nil?
250
- invalid_properties.push('invalid value for "field_reimport_state", field_reimport_state cannot be nil.')
251
- end
252
-
253
249
  if @page_count.nil?
254
250
  invalid_properties.push('invalid value for "page_count", page_count cannot be nil.')
255
251
  end
256
252
 
253
+ if @field_reimport_state.nil?
254
+ invalid_properties.push('invalid value for "field_reimport_state", field_reimport_state cannot be nil.')
255
+ end
256
+
257
257
  if @page_processing_statuses.nil?
258
258
  invalid_properties.push('invalid value for "page_processing_statuses", page_processing_statuses cannot be nil.')
259
259
  end
@@ -266,8 +266,8 @@ module DocSpring
266
266
  def valid?
267
267
  warn '[DEPRECATED] the `valid?` method is obsolete'
268
268
  return false if @state.nil?
269
- return false if @field_reimport_state.nil?
270
269
  return false if @page_count.nil?
270
+ return false if @field_reimport_state.nil?
271
271
  return false if @page_processing_statuses.nil?
272
272
  true
273
273
  end
@@ -282,16 +282,6 @@ module DocSpring
282
282
  @state = state
283
283
  end
284
284
 
285
- # Custom attribute writer method with validation
286
- # @param [Object] field_reimport_state Value to be assigned
287
- def field_reimport_state=(field_reimport_state)
288
- if field_reimport_state.nil?
289
- fail ArgumentError, 'field_reimport_state cannot be nil'
290
- end
291
-
292
- @field_reimport_state = field_reimport_state
293
- end
294
-
295
285
  # Custom attribute writer method with validation
296
286
  # @param [Object] page_count Value to be assigned
297
287
  def page_count=(page_count)
@@ -302,6 +292,16 @@ module DocSpring
302
292
  @page_count = page_count
303
293
  end
304
294
 
295
+ # Custom attribute writer method with validation
296
+ # @param [Object] field_reimport_state Value to be assigned
297
+ def field_reimport_state=(field_reimport_state)
298
+ if field_reimport_state.nil?
299
+ fail ArgumentError, 'field_reimport_state cannot be nil'
300
+ end
301
+
302
+ @field_reimport_state = field_reimport_state
303
+ end
304
+
305
305
  # Custom attribute writer method with validation
306
306
  # @param [Object] page_processing_statuses Value to be assigned
307
307
  def page_processing_statuses=(page_processing_statuses)
@@ -318,11 +318,11 @@ module DocSpring
318
318
  return true if self.equal?(o)
319
319
  self.class == o.class &&
320
320
  filename == o.filename &&
321
- md5 == o.md5 &&
322
321
  state == o.state &&
323
322
  error_message == o.error_message &&
324
- field_reimport_state == o.field_reimport_state &&
325
323
  page_count == o.page_count &&
324
+ md5 == o.md5 &&
325
+ field_reimport_state == o.field_reimport_state &&
326
326
  page_dimensions == o.page_dimensions &&
327
327
  has_fillable_fields == o.has_fillable_fields &&
328
328
  page_processing_statuses == o.page_processing_statuses &&
@@ -340,7 +340,7 @@ module DocSpring
340
340
  # Calculates hash code according to all attributes.
341
341
  # @return [Integer] Hash code
342
342
  def hash
343
- [filename, md5, state, error_message, field_reimport_state, page_count, page_dimensions, has_fillable_fields, page_processing_statuses, field_logic_status, download_url, permanent_url].hash
343
+ [filename, state, error_message, page_count, md5, field_reimport_state, page_dimensions, has_fillable_fields, page_processing_statuses, field_logic_status, download_url, permanent_url].hash
344
344
  end
345
345
 
346
346
  # Builds the object from hash