docspring 4.0.0 → 4.1.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 (132) hide show
  1. checksums.yaml +4 -4
  2. data/.openapi-generator/FILES +84 -0
  3. data/.travis.yml +1 -1
  4. data/CHANGELOG.md +24 -0
  5. data/Gemfile.lock +2 -2
  6. data/README.md +10 -1
  7. data/docs/AddTemplateFieldsRequest.md +18 -0
  8. data/docs/Client.md +704 -33
  9. data/docs/CreateSubmissionBatchRequest.md +2 -0
  10. data/docs/CreateSubmissionRequest.md +2 -0
  11. data/docs/CreateTemplateRequest.md +10 -2
  12. data/docs/Field.md +198 -0
  13. data/docs/FieldDependency.md +22 -0
  14. data/docs/FieldDependencyInput.md +22 -0
  15. data/docs/FieldGroup.md +32 -0
  16. data/docs/FieldGroupInput.md +30 -0
  17. data/docs/FieldGroupType.md +15 -0
  18. data/docs/FieldInput.md +196 -0
  19. data/docs/FieldType.md +15 -0
  20. data/docs/GenerateFilesFormat.md +15 -0
  21. data/docs/GenerateSubmissionFilesRequest.md +18 -0
  22. data/docs/OutputFormat.md +15 -0
  23. data/docs/PageImage.md +34 -0
  24. data/docs/PageImages.md +24 -0
  25. data/docs/PredefinedField.md +30 -0
  26. data/docs/PredefinedFieldInput.md +30 -0
  27. data/docs/RemoveTemplateFieldsRequest.md +18 -0
  28. data/docs/ReorderTemplateFieldsRequest.md +18 -0
  29. data/docs/Submission.md +3 -1
  30. data/docs/SubmissionFiles.md +3 -1
  31. data/docs/SubmissionInput.md +2 -0
  32. data/docs/SubmissionValidation.md +24 -0
  33. data/docs/Template.md +6 -0
  34. data/docs/TemplateDiff.md +30 -0
  35. data/docs/TemplateDiffSummary.md +28 -0
  36. data/docs/TemplateDocument.md +3 -3
  37. data/docs/TemplateFieldChange.md +24 -0
  38. data/docs/TemplateFieldChanges.md +24 -0
  39. data/docs/TemplateFieldDependency.md +1 -1
  40. data/docs/TemplateFieldDependencyInput.md +1 -1
  41. data/docs/TemplateFieldMove.md +22 -0
  42. data/docs/TemplateFields.md +22 -0
  43. data/docs/TemplatePageImages.md +24 -0
  44. data/docs/UpdateTemplateDocumentRequest.md +6 -2
  45. data/docs/UpdateTemplateFieldsRequest.md +18 -0
  46. data/docs/UpdateTemplateRequest.md +6 -0
  47. data/docs/ValidateSubmissionRequest.md +38 -0
  48. data/lib/docspring/api/client.rb +666 -18
  49. data/lib/docspring/api_client.rb +1 -1
  50. data/lib/docspring/models/add_template_fields_request.rb +187 -0
  51. data/lib/docspring/models/create_submission_batch_request.rb +23 -1
  52. data/lib/docspring/models/create_submission_request.rb +23 -1
  53. data/lib/docspring/models/create_template_request.rb +48 -3
  54. data/lib/docspring/models/field.rb +2217 -0
  55. data/lib/docspring/models/field_dependency.rb +246 -0
  56. data/lib/docspring/models/field_dependency_input.rb +246 -0
  57. data/lib/docspring/models/field_group.rb +368 -0
  58. data/lib/docspring/models/field_group_input.rb +247 -0
  59. data/lib/docspring/models/field_group_type.rb +41 -0
  60. data/lib/docspring/models/field_input.rb +1109 -0
  61. data/lib/docspring/models/field_type.rb +54 -0
  62. data/lib/docspring/models/generate_files_format.rb +40 -0
  63. data/lib/docspring/models/generate_submission_files_request.rb +187 -0
  64. data/lib/docspring/models/output_format.rb +41 -0
  65. data/lib/docspring/models/page_image.rb +359 -0
  66. data/lib/docspring/models/page_images.rb +248 -0
  67. data/lib/docspring/models/predefined_field.rb +287 -0
  68. data/lib/docspring/models/predefined_field_input.rb +287 -0
  69. data/lib/docspring/models/remove_template_fields_request.rb +187 -0
  70. data/lib/docspring/models/reorder_template_fields_request.rb +187 -0
  71. data/lib/docspring/models/submission.rb +31 -2
  72. data/lib/docspring/models/submission_files.rb +13 -4
  73. data/lib/docspring/models/submission_input.rb +23 -1
  74. data/lib/docspring/models/submission_validation.rb +234 -0
  75. data/lib/docspring/models/template.rb +74 -1
  76. data/lib/docspring/models/template_diff.rb +321 -0
  77. data/lib/docspring/models/template_diff_summary.rb +320 -0
  78. data/lib/docspring/models/template_document.rb +3 -3
  79. data/lib/docspring/models/template_document_state.rb +3 -1
  80. data/lib/docspring/models/template_field_change.rb +266 -0
  81. data/lib/docspring/models/template_field_changes.rb +274 -0
  82. data/lib/docspring/models/template_field_dependency.rb +1 -1
  83. data/lib/docspring/models/template_field_dependency_input.rb +1 -1
  84. data/lib/docspring/models/template_field_move.rb +239 -0
  85. data/lib/docspring/models/template_fields.rb +227 -0
  86. data/lib/docspring/models/template_page_images.rb +254 -0
  87. data/lib/docspring/models/update_template_document_request.rb +23 -20
  88. data/lib/docspring/models/update_template_fields_request.rb +187 -0
  89. data/lib/docspring/models/update_template_request.rb +38 -1
  90. data/lib/docspring/models/validate_submission_request.rb +288 -0
  91. data/lib/docspring/request_schemas.json +3364 -1584
  92. data/lib/docspring/version.rb +1 -1
  93. data/lib/docspring.rb +28 -0
  94. data/spec/api/client_spec.rb +128 -9
  95. data/spec/models/add_template_fields_request_spec.rb +36 -0
  96. data/spec/models/create_submission_batch_request_spec.rb +6 -0
  97. data/spec/models/create_submission_request_spec.rb +6 -0
  98. data/spec/models/create_template_request_spec.rb +24 -0
  99. data/spec/models/field_dependency_input_spec.rb +48 -0
  100. data/spec/models/field_dependency_spec.rb +48 -0
  101. data/spec/models/field_group_input_spec.rb +72 -0
  102. data/spec/models/field_group_spec.rb +78 -0
  103. data/spec/models/field_group_type_spec.rb +30 -0
  104. data/spec/models/field_input_spec.rb +570 -0
  105. data/spec/models/field_spec.rb +576 -0
  106. data/spec/models/field_type_spec.rb +30 -0
  107. data/spec/models/generate_files_format_spec.rb +30 -0
  108. data/spec/models/generate_submission_files_request_spec.rb +36 -0
  109. data/spec/models/output_format_spec.rb +30 -0
  110. data/spec/models/page_image_spec.rb +84 -0
  111. data/spec/models/page_images_spec.rb +54 -0
  112. data/spec/models/predefined_field_input_spec.rb +72 -0
  113. data/spec/models/predefined_field_spec.rb +72 -0
  114. data/spec/models/remove_template_fields_request_spec.rb +36 -0
  115. data/spec/models/reorder_template_fields_request_spec.rb +36 -0
  116. data/spec/models/submission_files_spec.rb +6 -0
  117. data/spec/models/submission_input_spec.rb +6 -0
  118. data/spec/models/submission_spec.rb +6 -0
  119. data/spec/models/submission_validation_spec.rb +54 -0
  120. data/spec/models/template_diff_spec.rb +72 -0
  121. data/spec/models/template_diff_summary_spec.rb +66 -0
  122. data/spec/models/template_field_change_spec.rb +54 -0
  123. data/spec/models/template_field_changes_spec.rb +54 -0
  124. data/spec/models/template_field_move_spec.rb +48 -0
  125. data/spec/models/template_fields_spec.rb +48 -0
  126. data/spec/models/template_page_images_spec.rb +54 -0
  127. data/spec/models/template_spec.rb +18 -0
  128. data/spec/models/update_template_document_request_spec.rb +12 -0
  129. data/spec/models/update_template_fields_request_spec.rb +36 -0
  130. data/spec/models/update_template_request_spec.rb +18 -0
  131. data/spec/models/validate_submission_request_spec.rb +96 -0
  132. metadata +113 -1
@@ -0,0 +1,321 @@
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
+ # What changed in a version of a template since the version before it: the draft since the latest published version, or a published version since the one before it. Fields are compared with all their settings, so `y` is measured from the top of each field's page.
18
+ class TemplateDiff < ApiModelBase
19
+ # The template's ID.
20
+ attr_accessor :template_id
21
+
22
+ # The earlier version, such as `1.1.0`. Null when no version was published before `to_version`: it's compared with a new template, so all of its fields are added.
23
+ attr_accessor :from_version
24
+
25
+ # The later version, such as `1.2.0`. Null for the draft.
26
+ attr_accessor :to_version
27
+
28
+ # How many changes of each kind there are.
29
+ attr_accessor :summary
30
+
31
+ # The fields that changed.
32
+ attr_accessor :fields
33
+
34
+ # The names of the template's settings that changed, as they're named on the Template (`name`, `html`, `defaults`, `expire_after`, ...). Values aren't included, and secrets like `encrypt_pdfs_password` are named when they change.
35
+ attr_accessor :changed_settings
36
+
37
+ # The template's PDF was replaced (or added, when there's no `from_version`).
38
+ attr_accessor :document_changed
39
+
40
+ # Attribute mapping from ruby-style variable name to JSON key.
41
+ def self.attribute_map
42
+ {
43
+ :'template_id' => :'template_id',
44
+ :'from_version' => :'from_version',
45
+ :'to_version' => :'to_version',
46
+ :'summary' => :'summary',
47
+ :'fields' => :'fields',
48
+ :'changed_settings' => :'changed_settings',
49
+ :'document_changed' => :'document_changed'
50
+ }
51
+ end
52
+
53
+ # Returns attribute mapping this model knows about
54
+ def self.acceptable_attribute_map
55
+ attribute_map
56
+ end
57
+
58
+ # Returns all the JSON keys this model knows about
59
+ def self.acceptable_attributes
60
+ acceptable_attribute_map.values
61
+ end
62
+
63
+ # Attribute type mapping.
64
+ def self.openapi_types
65
+ {
66
+ :'template_id' => :'String',
67
+ :'from_version' => :'String',
68
+ :'to_version' => :'String',
69
+ :'summary' => :'TemplateDiffSummary',
70
+ :'fields' => :'TemplateFieldChanges',
71
+ :'changed_settings' => :'Array<String>',
72
+ :'document_changed' => :'Boolean'
73
+ }
74
+ end
75
+
76
+ # List of attributes with nullable: true
77
+ def self.openapi_nullable
78
+ Set.new([
79
+ :'from_version',
80
+ :'to_version',
81
+ ])
82
+ end
83
+
84
+ # Returns attribute type mapping
85
+ def self.acceptable_openapi_types
86
+ openapi_types
87
+ end
88
+
89
+ # Returns the nullable attributes
90
+ def self.acceptable_openapi_nullable
91
+ openapi_nullable
92
+ end
93
+
94
+ # Initializes the object
95
+ # @param [Hash] attributes Model attributes in the form of hash
96
+ def initialize(attributes = {})
97
+ if (!attributes.is_a?(Hash))
98
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DocSpring::TemplateDiff` initialize method"
99
+ end
100
+
101
+ # check to see if the attribute exists and convert string to symbol for hash key
102
+ acceptable_attribute_map = self.class.acceptable_attribute_map
103
+ attributes = attributes.each_with_object({}) { |(k, v), h|
104
+ if (!acceptable_attribute_map.key?(k.to_sym))
105
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DocSpring::TemplateDiff`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
106
+ end
107
+ h[k.to_sym] = v
108
+ }
109
+
110
+ if attributes.key?(:'template_id')
111
+ self.template_id = attributes[:'template_id']
112
+ else
113
+ self.template_id = nil
114
+ end
115
+
116
+ if attributes.key?(:'from_version')
117
+ self.from_version = attributes[:'from_version']
118
+ else
119
+ self.from_version = nil
120
+ end
121
+
122
+ if attributes.key?(:'to_version')
123
+ self.to_version = attributes[:'to_version']
124
+ else
125
+ self.to_version = nil
126
+ end
127
+
128
+ if attributes.key?(:'summary')
129
+ self.summary = attributes[:'summary']
130
+ else
131
+ self.summary = nil
132
+ end
133
+
134
+ if attributes.key?(:'fields')
135
+ self.fields = attributes[:'fields']
136
+ else
137
+ self.fields = nil
138
+ end
139
+
140
+ if attributes.key?(:'changed_settings')
141
+ if (value = attributes[:'changed_settings']).is_a?(Array)
142
+ self.changed_settings = value
143
+ end
144
+ else
145
+ self.changed_settings = nil
146
+ end
147
+
148
+ if attributes.key?(:'document_changed')
149
+ self.document_changed = attributes[:'document_changed']
150
+ else
151
+ self.document_changed = nil
152
+ end
153
+ end
154
+
155
+ # Show invalid properties with the reasons. Usually used together with valid?
156
+ # @return Array for valid properties with the reasons
157
+ def list_invalid_properties
158
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
159
+ invalid_properties = Array.new
160
+ if @template_id.nil?
161
+ invalid_properties.push('invalid value for "template_id", template_id cannot be nil.')
162
+ end
163
+
164
+ if @summary.nil?
165
+ invalid_properties.push('invalid value for "summary", summary cannot be nil.')
166
+ end
167
+
168
+ if @fields.nil?
169
+ invalid_properties.push('invalid value for "fields", fields cannot be nil.')
170
+ end
171
+
172
+ if @changed_settings.nil?
173
+ invalid_properties.push('invalid value for "changed_settings", changed_settings cannot be nil.')
174
+ end
175
+
176
+ if @document_changed.nil?
177
+ invalid_properties.push('invalid value for "document_changed", document_changed cannot be nil.')
178
+ end
179
+
180
+ invalid_properties
181
+ end
182
+
183
+ # Check to see if the all the properties in the model are valid
184
+ # @return true if the model is valid
185
+ def valid?
186
+ warn '[DEPRECATED] the `valid?` method is obsolete'
187
+ return false if @template_id.nil?
188
+ return false if @summary.nil?
189
+ return false if @fields.nil?
190
+ return false if @changed_settings.nil?
191
+ return false if @document_changed.nil?
192
+ true
193
+ end
194
+
195
+ # Custom attribute writer method with validation
196
+ # @param [Object] template_id Value to be assigned
197
+ def template_id=(template_id)
198
+ if template_id.nil?
199
+ fail ArgumentError, 'template_id cannot be nil'
200
+ end
201
+
202
+ @template_id = template_id
203
+ end
204
+
205
+ # Custom attribute writer method with validation
206
+ # @param [Object] summary Value to be assigned
207
+ def summary=(summary)
208
+ if summary.nil?
209
+ fail ArgumentError, 'summary cannot be nil'
210
+ end
211
+
212
+ @summary = summary
213
+ end
214
+
215
+ # Custom attribute writer method with validation
216
+ # @param [Object] fields Value to be assigned
217
+ def fields=(fields)
218
+ if fields.nil?
219
+ fail ArgumentError, 'fields cannot be nil'
220
+ end
221
+
222
+ @fields = fields
223
+ end
224
+
225
+ # Custom attribute writer method with validation
226
+ # @param [Object] changed_settings Value to be assigned
227
+ def changed_settings=(changed_settings)
228
+ if changed_settings.nil?
229
+ fail ArgumentError, 'changed_settings cannot be nil'
230
+ end
231
+
232
+ @changed_settings = changed_settings
233
+ end
234
+
235
+ # Custom attribute writer method with validation
236
+ # @param [Object] document_changed Value to be assigned
237
+ def document_changed=(document_changed)
238
+ if document_changed.nil?
239
+ fail ArgumentError, 'document_changed cannot be nil'
240
+ end
241
+
242
+ @document_changed = document_changed
243
+ end
244
+
245
+ # Checks equality by comparing each attribute.
246
+ # @param [Object] Object to be compared
247
+ def ==(o)
248
+ return true if self.equal?(o)
249
+ self.class == o.class &&
250
+ template_id == o.template_id &&
251
+ from_version == o.from_version &&
252
+ to_version == o.to_version &&
253
+ summary == o.summary &&
254
+ fields == o.fields &&
255
+ changed_settings == o.changed_settings &&
256
+ document_changed == o.document_changed
257
+ end
258
+
259
+ # @see the `==` method
260
+ # @param [Object] Object to be compared
261
+ def eql?(o)
262
+ self == o
263
+ end
264
+
265
+ # Calculates hash code according to all attributes.
266
+ # @return [Integer] Hash code
267
+ def hash
268
+ [template_id, from_version, to_version, summary, fields, changed_settings, document_changed].hash
269
+ end
270
+
271
+ # Builds the object from hash
272
+ # @param [Hash] attributes Model attributes in the form of hash
273
+ # @return [Object] Returns the model itself
274
+ def self.build_from_hash(attributes)
275
+ return nil unless attributes.is_a?(Hash)
276
+ attributes = attributes.transform_keys(&:to_sym)
277
+ # include attributes inherited from allOf parents (the nearest declaration wins)
278
+ map = acceptable_attribute_map
279
+ transformed_hash = {}
280
+ acceptable_openapi_types.each_pair do |key, type|
281
+ if attributes.key?(map[key]) && attributes[map[key]].nil?
282
+ transformed_hash["#{key}"] = nil
283
+ elsif type =~ /\AArray<(.*)>/i
284
+ # check to ensure the input is an array given that the attribute
285
+ # is documented as an array but the input is not
286
+ if attributes[map[key]].is_a?(Array)
287
+ transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
288
+ end
289
+ elsif !attributes[map[key]].nil?
290
+ transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
291
+ end
292
+ end
293
+ # Responses can include enum values added after this client was released, so the enum setters
294
+ # accept any value while the model is built from a response
295
+ allocate.tap do |model|
296
+ model.instance_variable_set(:@_skip_enum_validation, true)
297
+ model.send(:initialize, transformed_hash)
298
+ model.remove_instance_variable(:@_skip_enum_validation)
299
+ end
300
+ end
301
+
302
+ # Returns the object in the form of hash
303
+ # @return [Hash] Returns the object in the form of hash
304
+ def to_hash
305
+ hash = {}
306
+ # include attributes inherited from allOf parents (the nearest declaration wins)
307
+ self.class.acceptable_attribute_map.each_pair do |attr, param|
308
+ value = self.send(attr)
309
+ if value.nil?
310
+ is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
311
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
312
+ end
313
+
314
+ hash[param] = _to_hash(value)
315
+ end
316
+ hash
317
+ end
318
+
319
+ end
320
+
321
+ end
@@ -0,0 +1,320 @@
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
+ # How many changes of each kind a template diff has.
18
+ class TemplateDiffSummary < ApiModelBase
19
+ # How many fields were added.
20
+ attr_accessor :fields_added
21
+
22
+ # How many fields were removed.
23
+ attr_accessor :fields_removed
24
+
25
+ # How many fields have changed settings.
26
+ attr_accessor :fields_changed
27
+
28
+ # How many fields moved in the template's field order.
29
+ attr_accessor :fields_reordered
30
+
31
+ # How many of the template's settings changed.
32
+ attr_accessor :settings_changed
33
+
34
+ # All the changes, counting a new document as one. Zero when the versions are the same.
35
+ attr_accessor :total_changes
36
+
37
+ # Attribute mapping from ruby-style variable name to JSON key.
38
+ def self.attribute_map
39
+ {
40
+ :'fields_added' => :'fields_added',
41
+ :'fields_removed' => :'fields_removed',
42
+ :'fields_changed' => :'fields_changed',
43
+ :'fields_reordered' => :'fields_reordered',
44
+ :'settings_changed' => :'settings_changed',
45
+ :'total_changes' => :'total_changes'
46
+ }
47
+ end
48
+
49
+ # Returns attribute mapping this model knows about
50
+ def self.acceptable_attribute_map
51
+ attribute_map
52
+ end
53
+
54
+ # Returns all the JSON keys this model knows about
55
+ def self.acceptable_attributes
56
+ acceptable_attribute_map.values
57
+ end
58
+
59
+ # Attribute type mapping.
60
+ def self.openapi_types
61
+ {
62
+ :'fields_added' => :'Integer',
63
+ :'fields_removed' => :'Integer',
64
+ :'fields_changed' => :'Integer',
65
+ :'fields_reordered' => :'Integer',
66
+ :'settings_changed' => :'Integer',
67
+ :'total_changes' => :'Integer'
68
+ }
69
+ end
70
+
71
+ # List of attributes with nullable: true
72
+ def self.openapi_nullable
73
+ Set.new([
74
+ ])
75
+ end
76
+
77
+ # Returns attribute type mapping
78
+ def self.acceptable_openapi_types
79
+ openapi_types
80
+ end
81
+
82
+ # Returns the nullable attributes
83
+ def self.acceptable_openapi_nullable
84
+ openapi_nullable
85
+ end
86
+
87
+ # Initializes the object
88
+ # @param [Hash] attributes Model attributes in the form of hash
89
+ def initialize(attributes = {})
90
+ if (!attributes.is_a?(Hash))
91
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DocSpring::TemplateDiffSummary` initialize method"
92
+ end
93
+
94
+ # check to see if the attribute exists and convert string to symbol for hash key
95
+ acceptable_attribute_map = self.class.acceptable_attribute_map
96
+ attributes = attributes.each_with_object({}) { |(k, v), h|
97
+ if (!acceptable_attribute_map.key?(k.to_sym))
98
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DocSpring::TemplateDiffSummary`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
99
+ end
100
+ h[k.to_sym] = v
101
+ }
102
+
103
+ if attributes.key?(:'fields_added')
104
+ self.fields_added = attributes[:'fields_added']
105
+ else
106
+ self.fields_added = nil
107
+ end
108
+
109
+ if attributes.key?(:'fields_removed')
110
+ self.fields_removed = attributes[:'fields_removed']
111
+ else
112
+ self.fields_removed = nil
113
+ end
114
+
115
+ if attributes.key?(:'fields_changed')
116
+ self.fields_changed = attributes[:'fields_changed']
117
+ else
118
+ self.fields_changed = nil
119
+ end
120
+
121
+ if attributes.key?(:'fields_reordered')
122
+ self.fields_reordered = attributes[:'fields_reordered']
123
+ else
124
+ self.fields_reordered = nil
125
+ end
126
+
127
+ if attributes.key?(:'settings_changed')
128
+ self.settings_changed = attributes[:'settings_changed']
129
+ else
130
+ self.settings_changed = nil
131
+ end
132
+
133
+ if attributes.key?(:'total_changes')
134
+ self.total_changes = attributes[:'total_changes']
135
+ else
136
+ self.total_changes = nil
137
+ end
138
+ end
139
+
140
+ # Show invalid properties with the reasons. Usually used together with valid?
141
+ # @return Array for valid properties with the reasons
142
+ def list_invalid_properties
143
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
144
+ invalid_properties = Array.new
145
+ if @fields_added.nil?
146
+ invalid_properties.push('invalid value for "fields_added", fields_added cannot be nil.')
147
+ end
148
+
149
+ if @fields_removed.nil?
150
+ invalid_properties.push('invalid value for "fields_removed", fields_removed cannot be nil.')
151
+ end
152
+
153
+ if @fields_changed.nil?
154
+ invalid_properties.push('invalid value for "fields_changed", fields_changed cannot be nil.')
155
+ end
156
+
157
+ if @fields_reordered.nil?
158
+ invalid_properties.push('invalid value for "fields_reordered", fields_reordered cannot be nil.')
159
+ end
160
+
161
+ if @settings_changed.nil?
162
+ invalid_properties.push('invalid value for "settings_changed", settings_changed cannot be nil.')
163
+ end
164
+
165
+ if @total_changes.nil?
166
+ invalid_properties.push('invalid value for "total_changes", total_changes cannot be nil.')
167
+ end
168
+
169
+ invalid_properties
170
+ end
171
+
172
+ # Check to see if the all the properties in the model are valid
173
+ # @return true if the model is valid
174
+ def valid?
175
+ warn '[DEPRECATED] the `valid?` method is obsolete'
176
+ return false if @fields_added.nil?
177
+ return false if @fields_removed.nil?
178
+ return false if @fields_changed.nil?
179
+ return false if @fields_reordered.nil?
180
+ return false if @settings_changed.nil?
181
+ return false if @total_changes.nil?
182
+ true
183
+ end
184
+
185
+ # Custom attribute writer method with validation
186
+ # @param [Object] fields_added Value to be assigned
187
+ def fields_added=(fields_added)
188
+ if fields_added.nil?
189
+ fail ArgumentError, 'fields_added cannot be nil'
190
+ end
191
+
192
+ @fields_added = fields_added
193
+ end
194
+
195
+ # Custom attribute writer method with validation
196
+ # @param [Object] fields_removed Value to be assigned
197
+ def fields_removed=(fields_removed)
198
+ if fields_removed.nil?
199
+ fail ArgumentError, 'fields_removed cannot be nil'
200
+ end
201
+
202
+ @fields_removed = fields_removed
203
+ end
204
+
205
+ # Custom attribute writer method with validation
206
+ # @param [Object] fields_changed Value to be assigned
207
+ def fields_changed=(fields_changed)
208
+ if fields_changed.nil?
209
+ fail ArgumentError, 'fields_changed cannot be nil'
210
+ end
211
+
212
+ @fields_changed = fields_changed
213
+ end
214
+
215
+ # Custom attribute writer method with validation
216
+ # @param [Object] fields_reordered Value to be assigned
217
+ def fields_reordered=(fields_reordered)
218
+ if fields_reordered.nil?
219
+ fail ArgumentError, 'fields_reordered cannot be nil'
220
+ end
221
+
222
+ @fields_reordered = fields_reordered
223
+ end
224
+
225
+ # Custom attribute writer method with validation
226
+ # @param [Object] settings_changed Value to be assigned
227
+ def settings_changed=(settings_changed)
228
+ if settings_changed.nil?
229
+ fail ArgumentError, 'settings_changed cannot be nil'
230
+ end
231
+
232
+ @settings_changed = settings_changed
233
+ end
234
+
235
+ # Custom attribute writer method with validation
236
+ # @param [Object] total_changes Value to be assigned
237
+ def total_changes=(total_changes)
238
+ if total_changes.nil?
239
+ fail ArgumentError, 'total_changes cannot be nil'
240
+ end
241
+
242
+ @total_changes = total_changes
243
+ end
244
+
245
+ # Checks equality by comparing each attribute.
246
+ # @param [Object] Object to be compared
247
+ def ==(o)
248
+ return true if self.equal?(o)
249
+ self.class == o.class &&
250
+ fields_added == o.fields_added &&
251
+ fields_removed == o.fields_removed &&
252
+ fields_changed == o.fields_changed &&
253
+ fields_reordered == o.fields_reordered &&
254
+ settings_changed == o.settings_changed &&
255
+ total_changes == o.total_changes
256
+ end
257
+
258
+ # @see the `==` method
259
+ # @param [Object] Object to be compared
260
+ def eql?(o)
261
+ self == o
262
+ end
263
+
264
+ # Calculates hash code according to all attributes.
265
+ # @return [Integer] Hash code
266
+ def hash
267
+ [fields_added, fields_removed, fields_changed, fields_reordered, settings_changed, total_changes].hash
268
+ end
269
+
270
+ # Builds the object from hash
271
+ # @param [Hash] attributes Model attributes in the form of hash
272
+ # @return [Object] Returns the model itself
273
+ def self.build_from_hash(attributes)
274
+ return nil unless attributes.is_a?(Hash)
275
+ attributes = attributes.transform_keys(&:to_sym)
276
+ # include attributes inherited from allOf parents (the nearest declaration wins)
277
+ map = acceptable_attribute_map
278
+ transformed_hash = {}
279
+ acceptable_openapi_types.each_pair do |key, type|
280
+ if attributes.key?(map[key]) && attributes[map[key]].nil?
281
+ transformed_hash["#{key}"] = nil
282
+ elsif type =~ /\AArray<(.*)>/i
283
+ # check to ensure the input is an array given that the attribute
284
+ # is documented as an array but the input is not
285
+ if attributes[map[key]].is_a?(Array)
286
+ transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
287
+ end
288
+ elsif !attributes[map[key]].nil?
289
+ transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
290
+ end
291
+ end
292
+ # Responses can include enum values added after this client was released, so the enum setters
293
+ # accept any value while the model is built from a response
294
+ allocate.tap do |model|
295
+ model.instance_variable_set(:@_skip_enum_validation, true)
296
+ model.send(:initialize, transformed_hash)
297
+ model.remove_instance_variable(:@_skip_enum_validation)
298
+ end
299
+ end
300
+
301
+ # Returns the object in the form of hash
302
+ # @return [Hash] Returns the object in the form of hash
303
+ def to_hash
304
+ hash = {}
305
+ # include attributes inherited from allOf parents (the nearest declaration wins)
306
+ self.class.acceptable_attribute_map.each_pair do |attr, param|
307
+ value = self.send(attr)
308
+ if value.nil?
309
+ is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
310
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
311
+ end
312
+
313
+ hash[param] = _to_hash(value)
314
+ end
315
+ hash
316
+ end
317
+
318
+ end
319
+
320
+ end
@@ -16,16 +16,16 @@ require 'time'
16
16
  module DocSpring
17
17
  # A PDF template's PDF.
18
18
  class TemplateDocument < ApiModelBase
19
- # The PDF's file name.
19
+ # The PDF's file name. Null until a `document_url` has been downloaded.
20
20
  attr_accessor :filename
21
21
 
22
22
  # The MD5 hash of the PDF.
23
23
  attr_accessor :md5
24
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.
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.
26
26
  attr_accessor :state
27
27
 
28
- # Why the PDF couldn't be processed, and how to fix it. Null unless `state` is an error.
28
+ # Why the PDF couldn't be processed or downloaded, and how to fix it. Null unless `state` is an error.
29
29
  attr_accessor :error_message
30
30
 
31
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).
@@ -20,9 +20,11 @@ module DocSpring
20
20
  PASSWORD_REQUIRED = "password_required".freeze
21
21
  MALFORMED_PDF = "malformed_pdf".freeze
22
22
  UNKNOWN_ERROR = "unknown_error".freeze
23
+ DOWNLOADING = "downloading".freeze
24
+ DOWNLOAD_FAILED = "download_failed".freeze
23
25
 
24
26
  def self.all_vars
25
- @all_vars ||= [PENDING, PROCESSED, PASSWORD_REQUIRED, MALFORMED_PDF, UNKNOWN_ERROR].freeze
27
+ @all_vars ||= [PENDING, PROCESSED, PASSWORD_REQUIRED, MALFORMED_PDF, UNKNOWN_ERROR, DOWNLOADING, DOWNLOAD_FAILED].freeze
26
28
  end
27
29
 
28
30
  # Builds the enum from string