docspring 4.1.0 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/.openapi-generator/FILES +15 -0
  3. data/.travis.yml +1 -1
  4. data/AGENTS.md +3 -2
  5. data/CHANGELOG.md +40 -0
  6. data/Gemfile.lock +9 -9
  7. data/README.md +5 -1
  8. data/docs/Client.md +176 -10
  9. data/docs/CombinedPdf.md +1 -1
  10. data/docs/CreateCombinedPdfRequest.md +1 -1
  11. data/docs/CreateSubmissionRequest.md +2 -2
  12. data/docs/CreateTemplatePreviewRequest.md +18 -0
  13. data/docs/CreateTemplateRequest.md +3 -1
  14. data/docs/ErrorDetail.md +1 -1
  15. data/docs/ErrorInfo.md +4 -4
  16. data/docs/Submission.md +15 -15
  17. data/docs/SubmissionInput.md +2 -2
  18. data/docs/SubmissionList.md +1 -1
  19. data/docs/SubmissionSummary.md +54 -0
  20. data/docs/Template.md +12 -10
  21. data/docs/TemplateActor.md +1 -1
  22. data/docs/TemplateDocument.md +5 -5
  23. data/docs/TemplateDocumentSummary.md +24 -0
  24. data/docs/TemplatePreview.md +32 -0
  25. data/docs/TemplatePreviewState.md +15 -0
  26. data/docs/TemplateSummary.md +2 -48
  27. data/docs/UpdateTemplateRequest.md +4 -2
  28. data/docs/ValidateSubmissionRequest.md +2 -2
  29. data/lib/docspring/api/client.rb +178 -8
  30. data/lib/docspring/api_client.rb +4 -2
  31. data/lib/docspring/date_time_values.rb +33 -0
  32. data/lib/docspring/models/combined_pdf.rb +1 -1
  33. data/lib/docspring/models/create_combined_pdf_request.rb +1 -1
  34. data/lib/docspring/models/create_submission_request.rb +2 -2
  35. data/lib/docspring/models/create_template_preview_request.rb +187 -0
  36. data/lib/docspring/models/create_template_request.rb +12 -2
  37. data/lib/docspring/models/error_code.rb +3 -1
  38. data/lib/docspring/models/error_detail.rb +1 -1
  39. data/lib/docspring/models/error_info.rb +4 -4
  40. data/lib/docspring/models/submission.rb +140 -140
  41. data/lib/docspring/models/submission_input.rb +2 -2
  42. data/lib/docspring/models/submission_list.rb +1 -1
  43. data/lib/docspring/models/submission_summary.rb +601 -0
  44. data/lib/docspring/models/template.rb +96 -83
  45. data/lib/docspring/models/template_actor.rb +1 -1
  46. data/lib/docspring/models/template_document.rb +42 -42
  47. data/lib/docspring/models/template_document_summary.rb +260 -0
  48. data/lib/docspring/models/template_preview.rb +356 -0
  49. data/lib/docspring/models/template_preview_state.rb +42 -0
  50. data/lib/docspring/models/template_summary.rb +5 -572
  51. data/lib/docspring/models/update_template_request.rb +16 -6
  52. data/lib/docspring/models/validate_submission_request.rb +2 -2
  53. data/lib/docspring/request_schemas.json +105 -8
  54. data/lib/docspring/version.rb +1 -1
  55. data/lib/docspring/webhook_signature.rb +45 -0
  56. data/lib/docspring.rb +6 -0
  57. data/spec/api/client_spec.rb +39 -4
  58. data/spec/models/create_template_preview_request_spec.rb +36 -0
  59. data/spec/models/create_template_request_spec.rb +6 -0
  60. data/spec/models/submission_spec.rb +12 -12
  61. data/spec/models/submission_summary_spec.rb +144 -0
  62. data/spec/models/template_document_spec.rb +5 -5
  63. data/spec/models/template_document_summary_spec.rb +54 -0
  64. data/spec/models/template_preview_spec.rb +78 -0
  65. data/spec/models/template_preview_state_spec.rb +30 -0
  66. data/spec/models/template_spec.rb +28 -22
  67. data/spec/models/template_summary_spec.rb +0 -138
  68. data/spec/models/update_template_request_spec.rb +6 -0
  69. metadata +23 -1
@@ -0,0 +1,187 @@
1
+ =begin
2
+ #DocSpring API
3
+
4
+ #Use DocSpring's API to programmatically fill out PDF forms, convert HTML to PDFs, merge PDFs, or request legally binding e-signatures.
5
+
6
+ The version of the OpenAPI document: v2
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.26.0-DOCSPRING
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module DocSpring
17
+ # The data to render the template with.
18
+ class CreateTemplatePreviewRequest < ApiModelBase
19
+ # The values of the template's fields, by field name, as you'd send them to create a submission. They're rendered as they are: they aren't checked against the template's fields. A value that a field can't print, such as an image URL that doesn't download, makes the preview's `state` `error`, with an `error_message`.
20
+ attr_accessor :data
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'data' => :'data'
26
+ }
27
+ end
28
+
29
+ # Returns attribute mapping this model knows about
30
+ def self.acceptable_attribute_map
31
+ attribute_map
32
+ end
33
+
34
+ # Returns all the JSON keys this model knows about
35
+ def self.acceptable_attributes
36
+ acceptable_attribute_map.values
37
+ end
38
+
39
+ # Attribute type mapping.
40
+ def self.openapi_types
41
+ {
42
+ :'data' => :'Hash<String, Object>'
43
+ }
44
+ end
45
+
46
+ # List of attributes with nullable: true
47
+ def self.openapi_nullable
48
+ Set.new([
49
+ ])
50
+ end
51
+
52
+ # Returns attribute type mapping
53
+ def self.acceptable_openapi_types
54
+ openapi_types
55
+ end
56
+
57
+ # Returns the nullable attributes
58
+ def self.acceptable_openapi_nullable
59
+ openapi_nullable
60
+ end
61
+
62
+ # Initializes the object
63
+ # @param [Hash] attributes Model attributes in the form of hash
64
+ def initialize(attributes = {})
65
+ if (!attributes.is_a?(Hash))
66
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DocSpring::CreateTemplatePreviewRequest` initialize method"
67
+ end
68
+
69
+ # check to see if the attribute exists and convert string to symbol for hash key
70
+ acceptable_attribute_map = self.class.acceptable_attribute_map
71
+ attributes = attributes.each_with_object({}) { |(k, v), h|
72
+ if (!acceptable_attribute_map.key?(k.to_sym))
73
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DocSpring::CreateTemplatePreviewRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
74
+ end
75
+ h[k.to_sym] = v
76
+ }
77
+
78
+ if attributes.key?(:'data')
79
+ if (value = attributes[:'data']).is_a?(Hash)
80
+ self.data = value
81
+ end
82
+ else
83
+ self.data = nil
84
+ end
85
+ end
86
+
87
+ # Show invalid properties with the reasons. Usually used together with valid?
88
+ # @return Array for valid properties with the reasons
89
+ def list_invalid_properties
90
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
91
+ invalid_properties = Array.new
92
+ if @data.nil?
93
+ invalid_properties.push('invalid value for "data", data cannot be nil.')
94
+ end
95
+
96
+ invalid_properties
97
+ end
98
+
99
+ # Check to see if the all the properties in the model are valid
100
+ # @return true if the model is valid
101
+ def valid?
102
+ warn '[DEPRECATED] the `valid?` method is obsolete'
103
+ return false if @data.nil?
104
+ true
105
+ end
106
+
107
+ # Custom attribute writer method with validation
108
+ # @param [Object] data Value to be assigned
109
+ def data=(data)
110
+ if data.nil?
111
+ fail ArgumentError, 'data cannot be nil'
112
+ end
113
+
114
+ @data = data
115
+ end
116
+
117
+ # Checks equality by comparing each attribute.
118
+ # @param [Object] Object to be compared
119
+ def ==(o)
120
+ return true if self.equal?(o)
121
+ self.class == o.class &&
122
+ data == o.data
123
+ end
124
+
125
+ # @see the `==` method
126
+ # @param [Object] Object to be compared
127
+ def eql?(o)
128
+ self == o
129
+ end
130
+
131
+ # Calculates hash code according to all attributes.
132
+ # @return [Integer] Hash code
133
+ def hash
134
+ [data].hash
135
+ end
136
+
137
+ # Builds the object from hash
138
+ # @param [Hash] attributes Model attributes in the form of hash
139
+ # @return [Object] Returns the model itself
140
+ def self.build_from_hash(attributes)
141
+ return nil unless attributes.is_a?(Hash)
142
+ attributes = attributes.transform_keys(&:to_sym)
143
+ # include attributes inherited from allOf parents (the nearest declaration wins)
144
+ map = acceptable_attribute_map
145
+ transformed_hash = {}
146
+ acceptable_openapi_types.each_pair do |key, type|
147
+ if attributes.key?(map[key]) && attributes[map[key]].nil?
148
+ transformed_hash["#{key}"] = nil
149
+ elsif type =~ /\AArray<(.*)>/i
150
+ # check to ensure the input is an array given that the attribute
151
+ # is documented as an array but the input is not
152
+ if attributes[map[key]].is_a?(Array)
153
+ transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
154
+ end
155
+ elsif !attributes[map[key]].nil?
156
+ transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
157
+ end
158
+ end
159
+ # Responses can include enum values added after this client was released, so the enum setters
160
+ # accept any value while the model is built from a response
161
+ allocate.tap do |model|
162
+ model.instance_variable_set(:@_skip_enum_validation, true)
163
+ model.send(:initialize, transformed_hash)
164
+ model.remove_instance_variable(:@_skip_enum_validation)
165
+ end
166
+ end
167
+
168
+ # Returns the object in the form of hash
169
+ # @return [Hash] Returns the object in the form of hash
170
+ def to_hash
171
+ hash = {}
172
+ # include attributes inherited from allOf parents (the nearest declaration wins)
173
+ self.class.acceptable_attribute_map.each_pair do |attr, param|
174
+ value = self.send(attr)
175
+ if value.nil?
176
+ is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
177
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
178
+ end
179
+
180
+ hash[param] = _to_hash(value)
181
+ end
182
+ hash
183
+ end
184
+
185
+ end
186
+
187
+ end
@@ -49,7 +49,7 @@ module DocSpring
49
49
  # Generate PDFs whose text and check fields stay fillable ("Generate Editable PDFs"). A submission's `editable` overrides it.
50
50
  attr_accessor :editable_submissions
51
51
 
52
- # 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.
52
+ # 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.
53
53
  attr_accessor :embed_domains
54
54
 
55
55
  # 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
  # A PDF template's document: the `fields.key` of a file you uploaded with the presigned upload (GET /uploads/presign). A PDF template needs one of `cache_id`, `document_url` and `document_base64`. To upload the PDF with the request, use POST /templates/upload.
125
128
  attr_accessor :cache_id
126
129
 
@@ -205,6 +208,7 @@ module DocSpring
205
208
  :'header_html' => :'header_html',
206
209
  :'footer_html' => :'footer_html',
207
210
  :'html_engine_options' => :'html_engine_options',
211
+ :'html_escape_data' => :'html_escape_data',
208
212
  :'cache_id' => :'cache_id',
209
213
  :'document_url' => :'document_url',
210
214
  :'document_base64' => :'document_base64',
@@ -264,6 +268,7 @@ module DocSpring
264
268
  :'header_html' => :'String',
265
269
  :'footer_html' => :'String',
266
270
  :'html_engine_options' => :'HtmlEngineOptionsInput',
271
+ :'html_escape_data' => :'Boolean',
267
272
  :'cache_id' => :'String',
268
273
  :'document_url' => :'String',
269
274
  :'document_base64' => :'String',
@@ -468,6 +473,10 @@ module DocSpring
468
473
  self.html_engine_options = attributes[:'html_engine_options']
469
474
  end
470
475
 
476
+ if attributes.key?(:'html_escape_data')
477
+ self.html_escape_data = attributes[:'html_escape_data']
478
+ end
479
+
471
480
  if attributes.key?(:'cache_id')
472
481
  self.cache_id = attributes[:'cache_id']
473
482
  end
@@ -571,6 +580,7 @@ module DocSpring
571
580
  header_html == o.header_html &&
572
581
  footer_html == o.footer_html &&
573
582
  html_engine_options == o.html_engine_options &&
583
+ html_escape_data == o.html_escape_data &&
574
584
  cache_id == o.cache_id &&
575
585
  document_url == o.document_url &&
576
586
  document_base64 == o.document_base64 &&
@@ -590,7 +600,7 @@ module DocSpring
590
600
  # Calculates hash code according to all attributes.
591
601
  # @return [Integer] Hash code
592
602
  def hash
593
- [name, description, template_type, 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, predefined_fields, predefined_fields_sample_data, html, scss, header_html, footer_html, html_engine_options, cache_id, document_url, document_base64, filename, detect_fields, field_source, field_naming, field_logic].hash
603
+ [name, description, template_type, 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, predefined_fields, predefined_fields_sample_data, html, scss, header_html, footer_html, html_engine_options, html_escape_data, cache_id, document_url, document_base64, filename, detect_fields, field_source, field_naming, field_logic].hash
594
604
  end
595
605
 
596
606
  # Builds the object from hash
@@ -36,9 +36,11 @@ module DocSpring
36
36
  SERVICE_UNAVAILABLE = "service_unavailable".freeze
37
37
  UPSTREAM_TIMEOUT = "upstream_timeout".freeze
38
38
  POLLING_TIMEOUT = "polling_timeout".freeze
39
+ IDEMPOTENCY_KEY_IN_USE = "idempotency_key_in_use".freeze
40
+ IDEMPOTENCY_KEY_REUSED = "idempotency_key_reused".freeze
39
41
 
40
42
  def self.all_vars
41
- @all_vars ||= [INVALID_REQUEST, UNAUTHORIZED, PAYMENT_REQUIRED, INSUFFICIENT_CREDITS, FORBIDDEN, UPGRADE_REQUIRED, ACCOUNT_SUSPENDED, NOT_FOUND, METHOD_NOT_ALLOWED, CONFLICT, GONE, REQUEST_TOO_LARGE, UNSUPPORTED_MEDIA_TYPE, VALIDATION_FAILED, INVALID_DATA, RATE_LIMITED, INTERNAL_ERROR, BAD_GATEWAY, SERVICE_UNAVAILABLE, UPSTREAM_TIMEOUT, POLLING_TIMEOUT].freeze
43
+ @all_vars ||= [INVALID_REQUEST, UNAUTHORIZED, PAYMENT_REQUIRED, INSUFFICIENT_CREDITS, FORBIDDEN, UPGRADE_REQUIRED, ACCOUNT_SUSPENDED, NOT_FOUND, METHOD_NOT_ALLOWED, CONFLICT, GONE, REQUEST_TOO_LARGE, UNSUPPORTED_MEDIA_TYPE, VALIDATION_FAILED, INVALID_DATA, RATE_LIMITED, INTERNAL_ERROR, BAD_GATEWAY, SERVICE_UNAVAILABLE, UPSTREAM_TIMEOUT, POLLING_TIMEOUT, IDEMPOTENCY_KEY_IN_USE, IDEMPOTENCY_KEY_REUSED].freeze
42
44
  end
43
45
 
44
46
  # Builds the enum from string
@@ -25,7 +25,7 @@ module DocSpring
25
25
  # A JSON pointer to the value in the request body (RFC 6901). An empty string means the whole body. In a submission's `data_errors`, it points into the request that created the submission.
26
26
  attr_accessor :pointer
27
27
 
28
- # The query parameter the detail is about.
28
+ # The query parameter or header the detail is about.
29
29
  attr_accessor :parameter
30
30
 
31
31
  # For a batch item that failed validation, the ID of the submission recorded for it.
@@ -16,7 +16,7 @@ require 'time'
16
16
  module DocSpring
17
17
  # What went wrong.
18
18
  class ErrorInfo < ApiModelBase
19
- # A machine-readable error code. Clients should handle codes they don't know: new codes can be added. `invalid_data`: a submission's data doesn't match its template's fields. The submission is still recorded. `insufficient_credits` (402): your credit balance can't cover a live PDF. The record was saved and waits for credits in the `insufficient_credits` state: its ID is in `submission_id`, `submission_batch_id` or `combined_pdf_id`. `upgrade_required` (403): your plan doesn't include this, such as more templates or the embedded template editor. `account_suspended` (403): the account is suspended, so it can't create submissions. `polling_timeout`: on a sync.api host, the PDF wasn't ready in time. The record was created and is still being processed: its ID is in `submission_id`, `submission_batch_id`, `combined_pdf_id` or `template_id`. Without one of these IDs, the request itself got no answer in time, and the record may or may not have been created.
19
+ # A machine-readable error code. Clients should handle codes they don't know: new codes can be added. `invalid_data`: a submission's data doesn't match its template's fields. The submission is still recorded. `insufficient_credits` (402): your credit balance can't cover a live PDF. The record was saved and waits for credits in the `insufficient_credits` state: its ID is in `submission_id`, `submission_batch_id` or `combined_pdf_id`. `upgrade_required` (403): your plan doesn't include this, such as more templates or the embedded template editor. `account_suspended` (403): the account is suspended, so it can't create submissions. `polling_timeout`: on a sync.api host, the PDF wasn't ready in time. The record was created and is still being processed: its ID is in `submission_id`, `submission_batch_id`, `combined_pdf_id` or `template_id`. Without one of these IDs, the request itself got no answer in time, and the record may or may not have been created. `idempotency_key_in_use` (409): a request with the same Idempotency-Key is still being processed. Send the request again in a few seconds; when the first request has already created its record, its ID is in `submission_id`, `submission_batch_id` or `combined_pdf_id`. `idempotency_key_reused` (422): the Idempotency-Key was already used for a different request.
20
20
  attr_accessor :code
21
21
 
22
22
  # A human-readable explanation, safe to show to developers.
@@ -28,13 +28,13 @@ module DocSpring
28
28
  # The ID of the request. Include it when you contact support.
29
29
  attr_accessor :request_id
30
30
 
31
- # When a submission's data fails validation, the submission is still recorded (state `invalid_data`) so you can see it in the dashboard. This is its ID. With `insufficient_credits`, the submission that waits for credits. With `polling_timeout`, the submission that's still being processed.
31
+ # When a submission's data fails validation, the submission is still recorded (state `invalid_data`) so you can see it in the dashboard. This is its ID. With `insufficient_credits`, the submission that waits for credits. With `polling_timeout` or `idempotency_key_in_use`, the submission that's still being processed.
32
32
  attr_accessor :submission_id
33
33
 
34
- # The ID of the recorded batch, when items in a batch fail validation. With `insufficient_credits`, the batch whose submissions wait for credits. With `polling_timeout`, the batch that's still being processed.
34
+ # The ID of the recorded batch, when items in a batch fail validation. With `insufficient_credits`, the batch whose submissions wait for credits. With `polling_timeout` or `idempotency_key_in_use`, the batch that's still being processed.
35
35
  attr_accessor :submission_batch_id
36
36
 
37
- # With `insufficient_credits`, the combined PDF that waits for credits. With `polling_timeout`, the combined PDF that's still being processed.
37
+ # With `insufficient_credits`, the combined PDF that waits for credits. With `polling_timeout` or `idempotency_key_in_use`, the combined PDF that's still being processed.
38
38
  attr_accessor :combined_pdf_id
39
39
 
40
40
  # With `polling_timeout`, the template whose PDF is still being processed.