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
@@ -46,7 +46,7 @@ module DocSpring
46
46
  # Generate PDFs whose text and check fields stay fillable ("Generate Editable PDFs"). A submission's `editable` overrides it.
47
47
  attr_accessor :editable_submissions
48
48
 
49
- # 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.
49
+ # 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.
50
50
  attr_accessor :embed_domains
51
51
 
52
52
  # Allow the embedded template editor to change sensitive template settings (webhooks, redirect URL, encryption, public access, expiration and so on).
@@ -121,6 +121,9 @@ module DocSpring
121
121
  # Null resets the options to their defaults.
122
122
  attr_accessor :html_engine_options
123
123
 
124
+ # 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.
125
+ attr_accessor :html_escape_data
126
+
124
127
  class EnumAttributeValidator
125
128
  attr_reader :datatype
126
129
  attr_reader :allowable_values
@@ -180,7 +183,8 @@ module DocSpring
180
183
  :'scss' => :'scss',
181
184
  :'header_html' => :'header_html',
182
185
  :'footer_html' => :'footer_html',
183
- :'html_engine_options' => :'html_engine_options'
186
+ :'html_engine_options' => :'html_engine_options',
187
+ :'html_escape_data' => :'html_escape_data'
184
188
  }
185
189
  end
186
190
 
@@ -231,7 +235,8 @@ module DocSpring
231
235
  :'scss' => :'String',
232
236
  :'header_html' => :'String',
233
237
  :'footer_html' => :'String',
234
- :'html_engine_options' => :'HtmlEngineOptionsInput'
238
+ :'html_engine_options' => :'HtmlEngineOptionsInput',
239
+ :'html_escape_data' => :'Boolean'
235
240
  }
236
241
  end
237
242
 
@@ -248,7 +253,7 @@ module DocSpring
248
253
  :'scss',
249
254
  :'header_html',
250
255
  :'footer_html',
251
- :'html_engine_options'
256
+ :'html_engine_options',
252
257
  ])
253
258
  end
254
259
 
@@ -427,6 +432,10 @@ module DocSpring
427
432
  if attributes.key?(:'html_engine_options')
428
433
  self.html_engine_options = attributes[:'html_engine_options']
429
434
  end
435
+
436
+ if attributes.key?(:'html_escape_data')
437
+ self.html_escape_data = attributes[:'html_escape_data']
438
+ end
430
439
  end
431
440
 
432
441
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -483,7 +492,8 @@ module DocSpring
483
492
  scss == o.scss &&
484
493
  header_html == o.header_html &&
485
494
  footer_html == o.footer_html &&
486
- html_engine_options == o.html_engine_options
495
+ html_engine_options == o.html_engine_options &&
496
+ html_escape_data == o.html_escape_data
487
497
  end
488
498
 
489
499
  # @see the `==` method
@@ -495,7 +505,7 @@ module DocSpring
495
505
  # Calculates hash code according to all attributes.
496
506
  # @return [Integer] Hash code
497
507
  def hash
498
- [name, description, parent_folder_id, locked, add_signature_request_submission_id_footers, ai_field_naming_language, allow_additional_properties, allow_skipping_optional_fields, default_form_mode, editable_submissions, embed_domains, embed_edit_allow_settings, embed_edit_allow_versioning, embed_edit_allow_document_replacement, encrypt_pdfs, encrypt_pdfs_password, expire_submissions, expire_after, expiration_interval, merge_audit_trail_pdf, parse_dates_using_template_date_format, public_submissions, public_web_form, redirect_url, slack_webhook_url, defaults, field_dependencies, field_groups, predefined_fields, predefined_fields_sample_data, html, scss, header_html, footer_html, html_engine_options].hash
508
+ [name, description, parent_folder_id, locked, add_signature_request_submission_id_footers, ai_field_naming_language, allow_additional_properties, allow_skipping_optional_fields, default_form_mode, editable_submissions, embed_domains, embed_edit_allow_settings, embed_edit_allow_versioning, embed_edit_allow_document_replacement, encrypt_pdfs, encrypt_pdfs_password, expire_submissions, expire_after, expiration_interval, merge_audit_trail_pdf, parse_dates_using_template_date_format, public_submissions, public_web_form, redirect_url, slack_webhook_url, defaults, field_dependencies, field_groups, predefined_fields, predefined_fields_sample_data, html, scss, header_html, footer_html, html_engine_options, html_escape_data].hash
499
509
  end
500
510
 
501
511
  # Builds the object from hash
@@ -25,7 +25,7 @@ module DocSpring
25
25
  # The values of the template's fields, by field name. Required for a PDF template, unless `signature_requests` collects the values.
26
26
  attr_accessor :data
27
27
 
28
- # Your own data about the submission, such as an ID from your app. It isn't printed on the PDF.
28
+ # Your own data about the submission, such as an ID from your app. It isn't printed on the PDF. Two keys also change the PDF: `pdf_filename` names its file (`files.pdf.filename`, and its download), and `pdf_title` is its title in the PDF's document properties (and an HTML template's `<title>`, unless its HTML has one). Without `pdf_title`, the title is the template's name. In `pdf_filename`, a `.pdf` ending is removed, each run of characters other than letters, digits, `-`, `_` and `.` becomes one `_`, and the first 128 characters are kept, then `.pdf` is added. Without it, the file is named after the submission's ID (`sub_1234567890abcdef01.pdf`).
29
29
  attr_accessor :metadata
30
30
 
31
31
  # A password that the PDF needs to be opened with. It's never returned; `has_password` says if it's set.
@@ -43,7 +43,7 @@ module DocSpring
43
43
  # For an HTML template, HTML to use instead of the template's.
44
44
  attr_accessor :html
45
45
 
46
- # For an HTML template, CSS to use instead of the template's.
46
+ # For an HTML template, SCSS (plain CSS works too) added after the template's styles, on the page and in its header and footer. It doesn't replace them: its rules come later, so they win over the template's rules of the same specificity.
47
47
  attr_accessor :css
48
48
 
49
49
  # The people who sign the PDF, and fill in their fields first. The PDF is generated once every signature request is completed. PDF templates only. Without `role`s, the first signature request is `Signer 1`, the second `Signer 2`, and so on. To leave a signer out, give every signature request its `role` and leave that one's out. Only the signers sign: a value for a signature or initials field in `data` makes the submission `invalid_data`.
@@ -635,7 +635,7 @@
635
635
  "name": {
636
636
  "type": "string",
637
637
  "minLength": 1,
638
- "maxLength": 255
638
+ "maxLength": 512
639
639
  },
640
640
  "parent_folder_id": {
641
641
  "type": [
@@ -944,7 +944,7 @@
944
944
  "string",
945
945
  "null"
946
946
  ],
947
- "maxLength": 255
947
+ "maxLength": 254
948
948
  },
949
949
  "fields": {
950
950
  "type": "array",
@@ -1172,7 +1172,7 @@
1172
1172
  "name": {
1173
1173
  "type": "string",
1174
1174
  "minLength": 1,
1175
- "maxLength": 255
1175
+ "maxLength": 512
1176
1176
  },
1177
1177
  "description": {
1178
1178
  "type": [
@@ -1711,6 +1711,9 @@
1711
1711
  },
1712
1712
  "additionalProperties": false
1713
1713
  },
1714
+ "html_escape_data": {
1715
+ "type": "boolean"
1716
+ },
1714
1717
  "cache_id": {
1715
1718
  "type": "string",
1716
1719
  "minLength": 1,
@@ -1765,6 +1768,34 @@
1765
1768
  }
1766
1769
  }
1767
1770
  },
1771
+ "createTemplatePreview": {
1772
+ "query": {
1773
+ "version": {
1774
+ "required": false,
1775
+ "schema": {
1776
+ "type": "string",
1777
+ "pattern": "^(\\d+(\\.\\d+(\\.\\d+)?)?|latest|draft)$",
1778
+ "x-pattern-message": "must be a version like 1.2.3 or 1, or latest or draft"
1779
+ }
1780
+ }
1781
+ },
1782
+ "body": {
1783
+ "mediaType": "application/json",
1784
+ "required": true,
1785
+ "schema": {
1786
+ "type": "object",
1787
+ "required": [
1788
+ "data"
1789
+ ],
1790
+ "properties": {
1791
+ "data": {
1792
+ "type": "object"
1793
+ }
1794
+ },
1795
+ "additionalProperties": false
1796
+ }
1797
+ }
1798
+ },
1768
1799
  "createWebhook": {
1769
1800
  "body": {
1770
1801
  "mediaType": "application/json",
@@ -1777,7 +1808,7 @@
1777
1808
  "string",
1778
1809
  "null"
1779
1810
  ],
1780
- "maxLength": 255
1811
+ "maxLength": 512
1781
1812
  },
1782
1813
  "url": {
1783
1814
  "type": "string",
@@ -1995,6 +2026,12 @@
1995
2026
  "go"
1996
2027
  ]
1997
2028
  }
2029
+ },
2030
+ "just_types": {
2031
+ "required": false,
2032
+ "schema": {
2033
+ "type": "boolean"
2034
+ }
1998
2035
  }
1999
2036
  }
2000
2037
  },
@@ -2010,6 +2047,7 @@
2010
2047
  }
2011
2048
  }
2012
2049
  },
2050
+ "getTemplatePreview": {},
2013
2051
  "getTemplateSchema": {
2014
2052
  "query": {
2015
2053
  "version": {
@@ -2130,6 +2168,33 @@
2130
2168
  "schema": {
2131
2169
  "type": "string"
2132
2170
  }
2171
+ },
2172
+ "state": {
2173
+ "required": false,
2174
+ "schema": {
2175
+ "type": "string",
2176
+ "enum": [
2177
+ "pending",
2178
+ "processed",
2179
+ "invalid_data",
2180
+ "error",
2181
+ "image_download_failed",
2182
+ "image_processing_failed",
2183
+ "waiting_for_signature_requests",
2184
+ "syntax_error",
2185
+ "insufficient_credits",
2186
+ "account_suspended",
2187
+ "license_revoked",
2188
+ "accidental",
2189
+ "declined"
2190
+ ]
2191
+ }
2192
+ },
2193
+ "include_files": {
2194
+ "required": false,
2195
+ "schema": {
2196
+ "type": "boolean"
2197
+ }
2133
2198
  }
2134
2199
  }
2135
2200
  },
@@ -2186,6 +2251,33 @@
2186
2251
  "schema": {
2187
2252
  "type": "string"
2188
2253
  }
2254
+ },
2255
+ "state": {
2256
+ "required": false,
2257
+ "schema": {
2258
+ "type": "string",
2259
+ "enum": [
2260
+ "pending",
2261
+ "processed",
2262
+ "invalid_data",
2263
+ "error",
2264
+ "image_download_failed",
2265
+ "image_processing_failed",
2266
+ "waiting_for_signature_requests",
2267
+ "syntax_error",
2268
+ "insufficient_credits",
2269
+ "account_suspended",
2270
+ "license_revoked",
2271
+ "accidental",
2272
+ "declined"
2273
+ ]
2274
+ }
2275
+ },
2276
+ "include_files": {
2277
+ "required": false,
2278
+ "schema": {
2279
+ "type": "boolean"
2280
+ }
2189
2281
  }
2190
2282
  }
2191
2283
  },
@@ -2542,7 +2634,7 @@
2542
2634
  "name": {
2543
2635
  "type": "string",
2544
2636
  "minLength": 1,
2545
- "maxLength": 255
2637
+ "maxLength": 512
2546
2638
  },
2547
2639
  "description": {
2548
2640
  "type": [
@@ -3115,6 +3207,9 @@
3115
3207
  }
3116
3208
  },
3117
3209
  "additionalProperties": false
3210
+ },
3211
+ "html_escape_data": {
3212
+ "type": "boolean"
3118
3213
  }
3119
3214
  },
3120
3215
  "additionalProperties": false
@@ -3802,7 +3897,7 @@
3802
3897
  "string",
3803
3898
  "null"
3804
3899
  ],
3805
- "maxLength": 255
3900
+ "maxLength": 512
3806
3901
  },
3807
3902
  "url": {
3808
3903
  "type": "string",
@@ -3923,7 +4018,7 @@
3923
4018
  "name": {
3924
4019
  "type": "string",
3925
4020
  "minLength": 1,
3926
- "maxLength": 255
4021
+ "maxLength": 512
3927
4022
  },
3928
4023
  "description": {
3929
4024
  "type": "string"
@@ -4080,7 +4175,7 @@
4080
4175
  "string",
4081
4176
  "null"
4082
4177
  ],
4083
- "maxLength": 255
4178
+ "maxLength": 254
4084
4179
  },
4085
4180
  "fields": {
4086
4181
  "type": "array",
@@ -4202,6 +4297,7 @@
4202
4297
  "GET /templates/{template_id}/fields": "listTemplateFields",
4203
4298
  "GET /templates/{template_id}/model_code": "getTemplateModelCode",
4204
4299
  "GET /templates/{template_id}/page_images": "getTemplatePageImages",
4300
+ "GET /templates/{template_id}/previews/{preview_id}": "getTemplatePreview",
4205
4301
  "GET /templates/{template_id}/schema": "getTemplateSchema",
4206
4302
  "GET /templates/{template_id}/submissions": "listTemplateSubmissions",
4207
4303
  "GET /uploads/presign": "getPresignUrl",
@@ -4224,6 +4320,7 @@
4224
4320
  "POST /templates/{template_id}/fields/remove": "removeTemplateFields",
4225
4321
  "POST /templates/{template_id}/fields/reorder": "reorderTemplateFields",
4226
4322
  "POST /templates/{template_id}/move": "moveTemplate",
4323
+ "POST /templates/{template_id}/previews": "createTemplatePreview",
4227
4324
  "POST /templates/{template_id}/publish_version": "publishTemplateVersion",
4228
4325
  "POST /templates/{template_id}/restore_version": "restoreTemplateVersion",
4229
4326
  "POST /templates/{template_id}/submissions": "createSubmission",
@@ -11,5 +11,5 @@ Generator version: 7.26.0-DOCSPRING
11
11
  =end
12
12
 
13
13
  module DocSpring
14
- VERSION = '4.1.0'
14
+ VERSION = '4.2.0'
15
15
  end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'openssl'
4
+
5
+ module DocSpring
6
+ # The number of seconds a webhook request's signature stays valid (verify_webhook_signature)
7
+ WEBHOOK_SIGNATURE_TOLERANCE = 300
8
+
9
+ # Checks a webhook request's X-DocSpring-Signature header (https://docspring.com/docs/webhooks/verifying-signatures/).
10
+ # Returns true when one of its v1 signatures is the HMAC-SHA256 of "{t}.{payload}" with the webhook's secret, and its
11
+ # timestamp t is at most `tolerance` seconds from `now`. Returns false for anything else, including a missing or
12
+ # malformed header.
13
+ #
14
+ # payload: the request body exactly as it was received (Rails: request.raw_post), not parsed JSON.
15
+ # signature_header: the X-DocSpring-Signature header.
16
+ # secret: the webhook's signing secret.
17
+ # tolerance: how many seconds old (or early) the timestamp can be. 5 minutes by default.
18
+ # now: the current Unix time in seconds, for tests. The system clock by default.
19
+ def self.verify_webhook_signature(payload, signature_header, secret, tolerance: WEBHOOK_SIGNATURE_TOLERANCE, now: nil)
20
+ return false unless payload.is_a?(String) && signature_header.is_a?(String) && secret.is_a?(String) && !secret.empty?
21
+
22
+ parts = signature_header.split(',').map { |part| part.strip.split('=', 2) }
23
+ timestamp = parts.find { |key, _value| key == 't' }&.last
24
+ signatures = parts.filter_map { |key, value| value if key == 'v1' && value && !value.empty? }
25
+ return false unless timestamp&.match?(/\A\d+\z/) && !signatures.empty?
26
+
27
+ now = Time.now.to_i if now.nil?
28
+ return false if (now.to_i - timestamp.to_i).abs > tolerance
29
+
30
+ expected = OpenSSL::HMAC.hexdigest('SHA256', secret, "#{timestamp}.#{payload}")
31
+ signatures.any? { |signature| webhook_signature_equal?(signature, expected) }
32
+ end
33
+
34
+ # Compares two signatures in constant time, so a timing attack can't find a valid one byte by byte
35
+ def self.webhook_signature_equal?(signature, expected)
36
+ return false unless signature.bytesize == expected.bytesize
37
+ # OpenSSL 2.2 (Ruby 3.0) and later
38
+ return OpenSSL.fixed_length_secure_compare(signature, expected) if OpenSSL.respond_to?(:fixed_length_secure_compare)
39
+
40
+ difference = 0
41
+ signature.bytes.zip(expected.bytes) { |a, b| difference |= a ^ b }
42
+ difference == 0
43
+ end
44
+ private_class_method :webhook_signature_equal?
45
+ end
data/lib/docspring.rb CHANGED
@@ -14,6 +14,7 @@ Generator version: 7.26.0-DOCSPRING
14
14
  require 'docspring/api_client'
15
15
  require 'docspring/api_error'
16
16
  require 'docspring/request_validator'
17
+ require 'docspring/webhook_signature'
17
18
  require 'docspring/api_model_base'
18
19
  require 'docspring/version'
19
20
  require 'docspring/configuration'
@@ -41,6 +42,7 @@ require 'docspring/models/create_signature_request_event_request'
41
42
  require 'docspring/models/create_signature_request_token_request'
42
43
  require 'docspring/models/create_submission_batch_request'
43
44
  require 'docspring/models/create_submission_request'
45
+ require 'docspring/models/create_template_preview_request'
44
46
  require 'docspring/models/create_template_request'
45
47
  require 'docspring/models/create_webhook_request'
46
48
  require 'docspring/models/custom_file'
@@ -122,6 +124,7 @@ require 'docspring/models/submission_list'
122
124
  require 'docspring/models/submission_source'
123
125
  require 'docspring/models/submission_source_pdf'
124
126
  require 'docspring/models/submission_state'
127
+ require 'docspring/models/submission_summary'
125
128
  require 'docspring/models/submission_validation'
126
129
  require 'docspring/models/template'
127
130
  require 'docspring/models/template_actor'
@@ -132,6 +135,7 @@ require 'docspring/models/template_diff'
132
135
  require 'docspring/models/template_diff_summary'
133
136
  require 'docspring/models/template_document'
134
137
  require 'docspring/models/template_document_state'
138
+ require 'docspring/models/template_document_summary'
135
139
  require 'docspring/models/template_field_change'
136
140
  require 'docspring/models/template_field_changes'
137
141
  require 'docspring/models/template_field_dependency'
@@ -152,6 +156,8 @@ require 'docspring/models/template_page_fields_status'
152
156
  require 'docspring/models/template_page_image_status'
153
157
  require 'docspring/models/template_page_images'
154
158
  require 'docspring/models/template_page_processing_status'
159
+ require 'docspring/models/template_preview'
160
+ require 'docspring/models/template_preview_state'
155
161
  require 'docspring/models/template_source_pdf'
156
162
  require 'docspring/models/template_summary'
157
163
  require 'docspring/models/template_summary_list'
@@ -64,6 +64,7 @@ describe 'Client' do
64
64
  # @param body The PDFs to merge, and the combined PDF's settings.
65
65
  # @param [Hash] opts the optional parameters
66
66
  # @option opts [Boolean] :wait Wait until the PDF has been generated before responding. Default true on sync.api hosts.
67
+ # @option opts [String] :idempotency_key A key of your own, such as a UUID, that makes it safe to send this request again: for 24 hours, DocSpring answers a request with the same key from the same API token with the first request's response (and an `Idempotent-Replayed: true` header) instead of creating another combined PDF. Send a new key with each new combined PDF, and the same key each time you send the same request again, such as after a timeout, a network error or a 5xx. The same key with a different request is a 422 `idempotency_key_reused`. A 409 `idempotency_key_in_use` means the first request is still being processed: send the request again in a few seconds.
67
68
  # @return [CombinedPdf]
68
69
  describe 'create_combined_pdf test' do
69
70
  it 'should work' do
@@ -97,7 +98,7 @@ describe 'Client' do
97
98
 
98
99
  # unit tests for create_signature_request_event
99
100
  # Record a signature request event
100
- # Records something that happened outside DocSpring in the signature request's audit trail: you sent the request to the person (`send_request`). The audit trail shows it as reported by your account.
101
+ # Records something that happened outside DocSpring in the signature request's audit trail: you sent the request to the person (`send_request`). The audit trail shows it as reported by your account. A finished (completed, declined or expired) signature request's audit trail takes no more events, and a test API token can't record one for a live signature request.
101
102
  # @param signature_request_id The signature request's ID.
102
103
  # @param body The event to record.
103
104
  # @param [Hash] opts the optional parameters
@@ -129,6 +130,7 @@ describe 'Client' do
129
130
  # @param [Hash] opts the optional parameters
130
131
  # @option opts [String] :version The template version to use: a published version (`1.2.0`, or `1` for the latest 1.x.x), `latest` or `draft`. Default `latest` (the draft when no version has been published).
131
132
  # @option opts [Boolean] :wait Wait until the files have been generated before responding. Default true on sync.api hosts.
133
+ # @option opts [String] :idempotency_key A key of your own, such as a UUID, that makes it safe to send this request again: for 24 hours, DocSpring answers a request with the same key from the same API token with the first request's response (and an `Idempotent-Replayed: true` header) instead of creating another submission. Send a new key with each new submission, and the same key each time you send the same request again, such as after a timeout, a network error or a 5xx. The same key with a different request is a 422 `idempotency_key_reused`. A 409 `idempotency_key_in_use` means the first request is still being processed: send the request again in a few seconds.
132
134
  # @return [Submission]
133
135
  describe 'create_submission test' do
134
136
  it 'should work' do
@@ -142,6 +144,7 @@ describe 'Client' do
142
144
  # @param body The submissions to create, and the settings they share.
143
145
  # @param [Hash] opts the optional parameters
144
146
  # @option opts [Boolean] :wait Wait until every PDF in the batch has been generated before responding. Default true on sync.api hosts.
147
+ # @option opts [String] :idempotency_key A key of your own, such as a UUID, that makes it safe to send this request again: for 24 hours, DocSpring answers a request with the same key from the same API token with the first request's response (and an `Idempotent-Replayed: true` header) instead of creating another batch. Send a new key with each new batch, and the same key each time you send the same request again, such as after a timeout, a network error or a 5xx. The same key with a different request is a 422 `idempotency_key_reused`. A 409 `idempotency_key_in_use` means the first request is still being processed: send the request again in a few seconds.
145
148
  # @return [SubmissionBatch]
146
149
  describe 'create_submission_batch test' do
147
150
  it 'should work' do
@@ -162,6 +165,20 @@ describe 'Client' do
162
165
  end
163
166
  end
164
167
 
168
+ # unit tests for create_template_preview
169
+ # Preview a template with data
170
+ # Makes PNG images of a template's pages filled in with the data you send (not a PDF), so you can check how an HTML or PDF template prints with your data before you publish a version or send live data. It renders the template's draft, or the published `version` you ask for. A preview makes no submission and uses no credits, and its pages are watermarked like a test submission's PDF. It's `pending` while it renders: get it with GET /templates/{template_id}/previews/{preview_id} until it's `processed`, with an image of each page, or `error`.
171
+ # @param template_id The template's ID.
172
+ # @param body The data to render the template with.
173
+ # @param [Hash] opts the optional parameters
174
+ # @option opts [String] :version A published version (`1.2.0`, or `1` for the latest 1.x.x), `latest` or `draft`. Default `draft`.
175
+ # @return [TemplatePreview]
176
+ describe 'create_template_preview test' do
177
+ it 'should work' do
178
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
179
+ end
180
+ end
181
+
165
182
  # unit tests for create_webhook
166
183
  # Create a webhook
167
184
  # Creates a webhook that sends a POST request to your endpoint whenever a subscribed event happens. Scope it to API tokens, templates or folders to receive only their events.
@@ -385,11 +402,12 @@ describe 'Client' do
385
402
 
386
403
  # unit tests for get_template_model_code
387
404
  # Generate typed code for a template's submission data
388
- # Generates types for a template's submission data in TypeScript, JavaScript, Ruby, Python, PHP, Java, C#, Elixir or Go, so your app catches mistakes before it calls the API. `root_type_name` is the type of the whole `data` object. Java returns every class in `code`, each under a `// ClassName.java` comment. A template with no named fields returns 422.
405
+ # Generates types for a template's submission data in TypeScript, JavaScript, Ruby, Python, PHP, Java, C#, Elixir or Go, so your app catches mistakes before it calls the API. `root_type_name` is the type of the whole `data` object, and `just_types=true` leaves out the code that converts JSON to and from the types. Java returns every class in `code`, each under a `// ClassName.java` comment. A template with no named fields returns 422.
389
406
  # @param template_id The template's ID.
390
407
  # @param lang The language to generate the code in.
391
408
  # @param [Hash] opts the optional parameters
392
409
  # @option opts [String] :version The template version: a published version (`1.2.0`, or `1` for the latest 1.x.x), `latest` or `draft`. Default `latest` (the draft when no version has been published), the version a submission uses by default.
410
+ # @option opts [Boolean] :just_types Return only the types (interfaces, classes or structs), without the code that converts JSON to and from them. Default false. JavaScript has no types and PHP no types-only code, so theirs is the same either way.
393
411
  # @return [TemplateModelCode]
394
412
  describe 'get_template_model_code test' do
395
413
  it 'should work' do
@@ -410,6 +428,19 @@ describe 'Client' do
410
428
  end
411
429
  end
412
430
 
431
+ # unit tests for get_template_preview
432
+ # Get a template preview
433
+ # Returns a preview made with POST /templates/{template_id}/previews. Once it's `processed`, `pages` has a PNG image of each page with a temporary link to download it: a preview has no PDF. Previews are deleted an hour after they're created.
434
+ # @param template_id The template's ID.
435
+ # @param preview_id The preview's ID.
436
+ # @param [Hash] opts the optional parameters
437
+ # @return [TemplatePreview]
438
+ describe 'get_template_preview test' do
439
+ it 'should work' do
440
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
441
+ end
442
+ end
443
+
413
444
  # unit tests for get_template_schema
414
445
  # Get the JSON Schema of a template's submission data
415
446
  # Returns the JSON Schema that a submission's `data` must match. Use it to check data before you create submissions, or to build a form for the template's fields.
@@ -477,7 +508,7 @@ describe 'Client' do
477
508
 
478
509
  # unit tests for list_submissions
479
510
  # List submissions
480
- # Returns the submissions in your account, newest first, one page at a time. Lists leave out each submission's `data` unless you pass `include_data=true`.
511
+ # Returns the submissions in your account, newest first, one page at a time. Each one is a summary: its `data` is null unless you pass `include_data=true`, and its `files` are empty unless you pass `include_files=true`. Get a submission by its ID for its signature requests, uploads and page images.
481
512
  # @param [Hash] opts the optional parameters
482
513
  # @option opts [String] :template_id Only list this template's submissions.
483
514
  # @option opts [Boolean] :test Only list test submissions (true) or live submissions (false).
@@ -486,6 +517,8 @@ describe 'Client' do
486
517
  # @option opts [Boolean] :include_data Include each submission's `data` (null without it).
487
518
  # @option opts [Integer] :limit How many items to return (1-100, default 50).
488
519
  # @option opts [String] :cursor The previous page's `next_cursor`, to get the next page. It's the ID of that page's last item, so get the next page before you delete or change the items on this one.
520
+ # @option opts [SubmissionState] :state Only list submissions in this state (one state per request). The ones that failed are `invalid_data`, `error`, `syntax_error`, `image_download_failed` and `image_processing_failed`, and one still `pending` an hour after it was created is stuck.
521
+ # @option opts [Boolean] :include_files Include each submission's generated files and their download links (`files`, empty without it), without the page images' links.
489
522
  # @return [SubmissionList]
490
523
  describe 'list_submissions test' do
491
524
  it 'should work' do
@@ -517,6 +550,8 @@ describe 'Client' do
517
550
  # @option opts [Boolean] :include_data Include each submission's `data` (null without it).
518
551
  # @option opts [Integer] :limit How many items to return (1-100, default 50).
519
552
  # @option opts [String] :cursor The previous page's `next_cursor`, to get the next page. It's the ID of that page's last item, so get the next page before you delete or change the items on this one.
553
+ # @option opts [SubmissionState] :state Only list submissions in this state (one state per request). The ones that failed are `invalid_data`, `error`, `syntax_error`, `image_download_failed` and `image_processing_failed`, and one still `pending` an hour after it was created is stuck.
554
+ # @option opts [Boolean] :include_files Include each submission's generated files and their download links (`files`, empty without it), without the page images' links.
520
555
  # @return [SubmissionList]
521
556
  describe 'list_template_submissions test' do
522
557
  it 'should work' do
@@ -526,7 +561,7 @@ describe 'Client' do
526
561
 
527
562
  # unit tests for list_templates
528
563
  # List templates
529
- # Returns the templates in your account (their drafts), newest first, one page at a time. Get a template by its ID for its HTML, defaults and published versions.
564
+ # Returns the templates in your account (their drafts), newest first, one page at a time. Each one is a summary: get a template by its ID for its settings, its PDF in full, its HTML, defaults and published versions.
530
565
  # @param [Hash] opts the optional parameters
531
566
  # @option opts [String] :query Only list templates whose name contains this text (ignoring case).
532
567
  # @option opts [String] :parent_folder_id Only list the templates in this folder (not in its subfolders).
@@ -0,0 +1,36 @@
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 'spec_helper'
14
+ require 'json'
15
+ require 'date'
16
+
17
+ # Unit tests for DocSpring::CreateTemplatePreviewRequest
18
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
+ # Please update as you see appropriate
20
+ describe DocSpring::CreateTemplatePreviewRequest do
21
+ #let(:instance) { DocSpring::CreateTemplatePreviewRequest.new }
22
+
23
+ describe 'test an instance of CreateTemplatePreviewRequest' do
24
+ it 'should create an instance of CreateTemplatePreviewRequest' do
25
+ # uncomment below to test the instance creation
26
+ #expect(instance).to be_instance_of(DocSpring::CreateTemplatePreviewRequest)
27
+ end
28
+ end
29
+
30
+ describe 'test attribute "data"' do
31
+ it 'should work' do
32
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
33
+ end
34
+ end
35
+
36
+ end
@@ -237,6 +237,12 @@ describe DocSpring::CreateTemplateRequest do
237
237
  end
238
238
  end
239
239
 
240
+ describe 'test attribute "html_escape_data"' do
241
+ it 'should work' do
242
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
243
+ end
244
+ end
245
+
240
246
  describe 'test attribute "cache_id"' do
241
247
  it 'should work' do
242
248
  # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/