docspring 4.0.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 (167) hide show
  1. checksums.yaml +4 -4
  2. data/.openapi-generator/FILES +99 -0
  3. data/.travis.yml +1 -1
  4. data/AGENTS.md +3 -2
  5. data/CHANGELOG.md +64 -0
  6. data/Gemfile.lock +9 -9
  7. data/README.md +14 -1
  8. data/docs/AddTemplateFieldsRequest.md +18 -0
  9. data/docs/Client.md +917 -80
  10. data/docs/CombinedPdf.md +1 -1
  11. data/docs/CreateCombinedPdfRequest.md +1 -1
  12. data/docs/CreateSubmissionBatchRequest.md +2 -0
  13. data/docs/CreateSubmissionRequest.md +4 -2
  14. data/docs/CreateTemplatePreviewRequest.md +18 -0
  15. data/docs/CreateTemplateRequest.md +13 -3
  16. data/docs/ErrorDetail.md +1 -1
  17. data/docs/ErrorInfo.md +4 -4
  18. data/docs/Field.md +198 -0
  19. data/docs/FieldDependency.md +22 -0
  20. data/docs/FieldDependencyInput.md +22 -0
  21. data/docs/FieldGroup.md +32 -0
  22. data/docs/FieldGroupInput.md +30 -0
  23. data/docs/FieldGroupType.md +15 -0
  24. data/docs/FieldInput.md +196 -0
  25. data/docs/FieldType.md +15 -0
  26. data/docs/GenerateFilesFormat.md +15 -0
  27. data/docs/GenerateSubmissionFilesRequest.md +18 -0
  28. data/docs/OutputFormat.md +15 -0
  29. data/docs/PageImage.md +34 -0
  30. data/docs/PageImages.md +24 -0
  31. data/docs/PredefinedField.md +30 -0
  32. data/docs/PredefinedFieldInput.md +30 -0
  33. data/docs/RemoveTemplateFieldsRequest.md +18 -0
  34. data/docs/ReorderTemplateFieldsRequest.md +18 -0
  35. data/docs/Submission.md +16 -14
  36. data/docs/SubmissionFiles.md +3 -1
  37. data/docs/SubmissionInput.md +4 -2
  38. data/docs/SubmissionList.md +1 -1
  39. data/docs/SubmissionSummary.md +54 -0
  40. data/docs/SubmissionValidation.md +24 -0
  41. data/docs/Template.md +18 -10
  42. data/docs/TemplateActor.md +1 -1
  43. data/docs/TemplateDiff.md +30 -0
  44. data/docs/TemplateDiffSummary.md +28 -0
  45. data/docs/TemplateDocument.md +6 -6
  46. data/docs/TemplateDocumentSummary.md +24 -0
  47. data/docs/TemplateFieldChange.md +24 -0
  48. data/docs/TemplateFieldChanges.md +24 -0
  49. data/docs/TemplateFieldDependency.md +1 -1
  50. data/docs/TemplateFieldDependencyInput.md +1 -1
  51. data/docs/TemplateFieldMove.md +22 -0
  52. data/docs/TemplateFields.md +22 -0
  53. data/docs/TemplatePageImages.md +24 -0
  54. data/docs/TemplatePreview.md +32 -0
  55. data/docs/TemplatePreviewState.md +15 -0
  56. data/docs/TemplateSummary.md +2 -48
  57. data/docs/UpdateTemplateDocumentRequest.md +6 -2
  58. data/docs/UpdateTemplateFieldsRequest.md +18 -0
  59. data/docs/UpdateTemplateRequest.md +10 -2
  60. data/docs/ValidateSubmissionRequest.md +38 -0
  61. data/lib/docspring/api/client.rb +869 -51
  62. data/lib/docspring/api_client.rb +4 -2
  63. data/lib/docspring/date_time_values.rb +33 -0
  64. data/lib/docspring/models/add_template_fields_request.rb +187 -0
  65. data/lib/docspring/models/combined_pdf.rb +1 -1
  66. data/lib/docspring/models/create_combined_pdf_request.rb +1 -1
  67. data/lib/docspring/models/create_submission_batch_request.rb +23 -1
  68. data/lib/docspring/models/create_submission_request.rb +25 -3
  69. data/lib/docspring/models/create_template_preview_request.rb +187 -0
  70. data/lib/docspring/models/create_template_request.rb +59 -4
  71. data/lib/docspring/models/error_code.rb +3 -1
  72. data/lib/docspring/models/error_detail.rb +1 -1
  73. data/lib/docspring/models/error_info.rb +4 -4
  74. data/lib/docspring/models/field.rb +2217 -0
  75. data/lib/docspring/models/field_dependency.rb +246 -0
  76. data/lib/docspring/models/field_dependency_input.rb +246 -0
  77. data/lib/docspring/models/field_group.rb +368 -0
  78. data/lib/docspring/models/field_group_input.rb +247 -0
  79. data/lib/docspring/models/field_group_type.rb +41 -0
  80. data/lib/docspring/models/field_input.rb +1109 -0
  81. data/lib/docspring/models/field_type.rb +54 -0
  82. data/lib/docspring/models/generate_files_format.rb +40 -0
  83. data/lib/docspring/models/generate_submission_files_request.rb +187 -0
  84. data/lib/docspring/models/output_format.rb +41 -0
  85. data/lib/docspring/models/page_image.rb +359 -0
  86. data/lib/docspring/models/page_images.rb +248 -0
  87. data/lib/docspring/models/predefined_field.rb +287 -0
  88. data/lib/docspring/models/predefined_field_input.rb +287 -0
  89. data/lib/docspring/models/remove_template_fields_request.rb +187 -0
  90. data/lib/docspring/models/reorder_template_fields_request.rb +187 -0
  91. data/lib/docspring/models/submission.rb +146 -117
  92. data/lib/docspring/models/submission_files.rb +13 -4
  93. data/lib/docspring/models/submission_input.rb +25 -3
  94. data/lib/docspring/models/submission_list.rb +1 -1
  95. data/lib/docspring/models/submission_summary.rb +601 -0
  96. data/lib/docspring/models/submission_validation.rb +234 -0
  97. data/lib/docspring/models/template.rb +169 -83
  98. data/lib/docspring/models/template_actor.rb +1 -1
  99. data/lib/docspring/models/template_diff.rb +321 -0
  100. data/lib/docspring/models/template_diff_summary.rb +320 -0
  101. data/lib/docspring/models/template_document.rb +44 -44
  102. data/lib/docspring/models/template_document_state.rb +3 -1
  103. data/lib/docspring/models/template_document_summary.rb +260 -0
  104. data/lib/docspring/models/template_field_change.rb +266 -0
  105. data/lib/docspring/models/template_field_changes.rb +274 -0
  106. data/lib/docspring/models/template_field_dependency.rb +1 -1
  107. data/lib/docspring/models/template_field_dependency_input.rb +1 -1
  108. data/lib/docspring/models/template_field_move.rb +239 -0
  109. data/lib/docspring/models/template_fields.rb +227 -0
  110. data/lib/docspring/models/template_page_images.rb +254 -0
  111. data/lib/docspring/models/template_preview.rb +356 -0
  112. data/lib/docspring/models/template_preview_state.rb +42 -0
  113. data/lib/docspring/models/template_summary.rb +5 -572
  114. data/lib/docspring/models/update_template_document_request.rb +23 -20
  115. data/lib/docspring/models/update_template_fields_request.rb +187 -0
  116. data/lib/docspring/models/update_template_request.rb +53 -6
  117. data/lib/docspring/models/validate_submission_request.rb +288 -0
  118. data/lib/docspring/request_schemas.json +3465 -1588
  119. data/lib/docspring/version.rb +1 -1
  120. data/lib/docspring/webhook_signature.rb +45 -0
  121. data/lib/docspring.rb +34 -0
  122. data/spec/api/client_spec.rb +167 -13
  123. data/spec/models/add_template_fields_request_spec.rb +36 -0
  124. data/spec/models/create_submission_batch_request_spec.rb +6 -0
  125. data/spec/models/create_submission_request_spec.rb +6 -0
  126. data/spec/models/create_template_preview_request_spec.rb +36 -0
  127. data/spec/models/create_template_request_spec.rb +30 -0
  128. data/spec/models/field_dependency_input_spec.rb +48 -0
  129. data/spec/models/field_dependency_spec.rb +48 -0
  130. data/spec/models/field_group_input_spec.rb +72 -0
  131. data/spec/models/field_group_spec.rb +78 -0
  132. data/spec/models/field_group_type_spec.rb +30 -0
  133. data/spec/models/field_input_spec.rb +570 -0
  134. data/spec/models/field_spec.rb +576 -0
  135. data/spec/models/field_type_spec.rb +30 -0
  136. data/spec/models/generate_files_format_spec.rb +30 -0
  137. data/spec/models/generate_submission_files_request_spec.rb +36 -0
  138. data/spec/models/output_format_spec.rb +30 -0
  139. data/spec/models/page_image_spec.rb +84 -0
  140. data/spec/models/page_images_spec.rb +54 -0
  141. data/spec/models/predefined_field_input_spec.rb +72 -0
  142. data/spec/models/predefined_field_spec.rb +72 -0
  143. data/spec/models/remove_template_fields_request_spec.rb +36 -0
  144. data/spec/models/reorder_template_fields_request_spec.rb +36 -0
  145. data/spec/models/submission_files_spec.rb +6 -0
  146. data/spec/models/submission_input_spec.rb +6 -0
  147. data/spec/models/submission_spec.rb +17 -11
  148. data/spec/models/submission_summary_spec.rb +144 -0
  149. data/spec/models/submission_validation_spec.rb +54 -0
  150. data/spec/models/template_diff_spec.rb +72 -0
  151. data/spec/models/template_diff_summary_spec.rb +66 -0
  152. data/spec/models/template_document_spec.rb +5 -5
  153. data/spec/models/template_document_summary_spec.rb +54 -0
  154. data/spec/models/template_field_change_spec.rb +54 -0
  155. data/spec/models/template_field_changes_spec.rb +54 -0
  156. data/spec/models/template_field_move_spec.rb +48 -0
  157. data/spec/models/template_fields_spec.rb +48 -0
  158. data/spec/models/template_page_images_spec.rb +54 -0
  159. data/spec/models/template_preview_spec.rb +78 -0
  160. data/spec/models/template_preview_state_spec.rb +30 -0
  161. data/spec/models/template_spec.rb +34 -10
  162. data/spec/models/template_summary_spec.rb +0 -138
  163. data/spec/models/update_template_document_request_spec.rb +12 -0
  164. data/spec/models/update_template_fields_request_spec.rb +36 -0
  165. data/spec/models/update_template_request_spec.rb +24 -0
  166. data/spec/models/validate_submission_request_spec.rb +96 -0
  167. metadata +135 -1
@@ -16,24 +16,24 @@ 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
- # 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.
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
- # Why the PDF couldn't be processed, and how to fix it. Null unless `state` is an error.
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
@@ -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
@@ -0,0 +1,260 @@
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
+ # A PDF template's PDF, as template lists show it.
18
+ class TemplateDocumentSummary < ApiModelBase
19
+ # The PDF's file name. Null until a `document_url` has been downloaded.
20
+ attr_accessor :filename
21
+
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.
23
+ attr_accessor :state
24
+
25
+ # Why the PDF couldn't be processed or downloaded, and how to fix it. Null unless `state` is an error.
26
+ attr_accessor :error_message
27
+
28
+ # 0 until the PDF has been processed.
29
+ attr_accessor :page_count
30
+
31
+ class EnumAttributeValidator
32
+ attr_reader :datatype
33
+ attr_reader :allowable_values
34
+
35
+ def initialize(datatype, allowable_values)
36
+ @allowable_values = allowable_values.map do |value|
37
+ case datatype.to_s
38
+ when /Integer/i
39
+ value.to_i
40
+ when /Float/i
41
+ value.to_f
42
+ else
43
+ value
44
+ end
45
+ end
46
+ end
47
+
48
+ def valid?(value)
49
+ !value || allowable_values.include?(value)
50
+ end
51
+ end
52
+
53
+ # Attribute mapping from ruby-style variable name to JSON key.
54
+ def self.attribute_map
55
+ {
56
+ :'filename' => :'filename',
57
+ :'state' => :'state',
58
+ :'error_message' => :'error_message',
59
+ :'page_count' => :'page_count'
60
+ }
61
+ end
62
+
63
+ # Returns attribute mapping this model knows about
64
+ def self.acceptable_attribute_map
65
+ attribute_map
66
+ end
67
+
68
+ # Returns all the JSON keys this model knows about
69
+ def self.acceptable_attributes
70
+ acceptable_attribute_map.values
71
+ end
72
+
73
+ # Attribute type mapping.
74
+ def self.openapi_types
75
+ {
76
+ :'filename' => :'String',
77
+ :'state' => :'TemplateDocumentState',
78
+ :'error_message' => :'String',
79
+ :'page_count' => :'Integer'
80
+ }
81
+ end
82
+
83
+ # List of attributes with nullable: true
84
+ def self.openapi_nullable
85
+ Set.new([
86
+ :'filename',
87
+ :'error_message',
88
+ ])
89
+ end
90
+
91
+ # Returns attribute type mapping
92
+ def self.acceptable_openapi_types
93
+ openapi_types
94
+ end
95
+
96
+ # Returns the nullable attributes
97
+ def self.acceptable_openapi_nullable
98
+ openapi_nullable
99
+ end
100
+
101
+ # Initializes the object
102
+ # @param [Hash] attributes Model attributes in the form of hash
103
+ def initialize(attributes = {})
104
+ if (!attributes.is_a?(Hash))
105
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DocSpring::TemplateDocumentSummary` initialize method"
106
+ end
107
+
108
+ # check to see if the attribute exists and convert string to symbol for hash key
109
+ acceptable_attribute_map = self.class.acceptable_attribute_map
110
+ attributes = attributes.each_with_object({}) { |(k, v), h|
111
+ if (!acceptable_attribute_map.key?(k.to_sym))
112
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DocSpring::TemplateDocumentSummary`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
113
+ end
114
+ h[k.to_sym] = v
115
+ }
116
+
117
+ if attributes.key?(:'filename')
118
+ self.filename = attributes[:'filename']
119
+ else
120
+ self.filename = nil
121
+ end
122
+
123
+ if attributes.key?(:'state')
124
+ self.state = attributes[:'state']
125
+ else
126
+ self.state = nil
127
+ end
128
+
129
+ if attributes.key?(:'error_message')
130
+ self.error_message = attributes[:'error_message']
131
+ else
132
+ self.error_message = nil
133
+ end
134
+
135
+ if attributes.key?(:'page_count')
136
+ self.page_count = attributes[:'page_count']
137
+ else
138
+ self.page_count = nil
139
+ end
140
+ end
141
+
142
+ # Show invalid properties with the reasons. Usually used together with valid?
143
+ # @return Array for valid properties with the reasons
144
+ def list_invalid_properties
145
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
146
+ invalid_properties = Array.new
147
+ if @state.nil?
148
+ invalid_properties.push('invalid value for "state", state cannot be nil.')
149
+ end
150
+
151
+ if @page_count.nil?
152
+ invalid_properties.push('invalid value for "page_count", page_count cannot be nil.')
153
+ end
154
+
155
+ invalid_properties
156
+ end
157
+
158
+ # Check to see if the all the properties in the model are valid
159
+ # @return true if the model is valid
160
+ def valid?
161
+ warn '[DEPRECATED] the `valid?` method is obsolete'
162
+ return false if @state.nil?
163
+ return false if @page_count.nil?
164
+ true
165
+ end
166
+
167
+ # Custom attribute writer method with validation
168
+ # @param [Object] state Value to be assigned
169
+ def state=(state)
170
+ if state.nil?
171
+ fail ArgumentError, 'state cannot be nil'
172
+ end
173
+
174
+ @state = state
175
+ end
176
+
177
+ # Custom attribute writer method with validation
178
+ # @param [Object] page_count Value to be assigned
179
+ def page_count=(page_count)
180
+ if page_count.nil?
181
+ fail ArgumentError, 'page_count cannot be nil'
182
+ end
183
+
184
+ @page_count = page_count
185
+ end
186
+
187
+ # Checks equality by comparing each attribute.
188
+ # @param [Object] Object to be compared
189
+ def ==(o)
190
+ return true if self.equal?(o)
191
+ self.class == o.class &&
192
+ filename == o.filename &&
193
+ state == o.state &&
194
+ error_message == o.error_message &&
195
+ page_count == o.page_count
196
+ end
197
+
198
+ # @see the `==` method
199
+ # @param [Object] Object to be compared
200
+ def eql?(o)
201
+ self == o
202
+ end
203
+
204
+ # Calculates hash code according to all attributes.
205
+ # @return [Integer] Hash code
206
+ def hash
207
+ [filename, state, error_message, page_count].hash
208
+ end
209
+
210
+ # Builds the object from hash
211
+ # @param [Hash] attributes Model attributes in the form of hash
212
+ # @return [Object] Returns the model itself
213
+ def self.build_from_hash(attributes)
214
+ return nil unless attributes.is_a?(Hash)
215
+ attributes = attributes.transform_keys(&:to_sym)
216
+ # include attributes inherited from allOf parents (the nearest declaration wins)
217
+ map = acceptable_attribute_map
218
+ transformed_hash = {}
219
+ acceptable_openapi_types.each_pair do |key, type|
220
+ if attributes.key?(map[key]) && attributes[map[key]].nil?
221
+ transformed_hash["#{key}"] = nil
222
+ elsif type =~ /\AArray<(.*)>/i
223
+ # check to ensure the input is an array given that the attribute
224
+ # is documented as an array but the input is not
225
+ if attributes[map[key]].is_a?(Array)
226
+ transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
227
+ end
228
+ elsif !attributes[map[key]].nil?
229
+ transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
230
+ end
231
+ end
232
+ # Responses can include enum values added after this client was released, so the enum setters
233
+ # accept any value while the model is built from a response
234
+ allocate.tap do |model|
235
+ model.instance_variable_set(:@_skip_enum_validation, true)
236
+ model.send(:initialize, transformed_hash)
237
+ model.remove_instance_variable(:@_skip_enum_validation)
238
+ end
239
+ end
240
+
241
+ # Returns the object in the form of hash
242
+ # @return [Hash] Returns the object in the form of hash
243
+ def to_hash
244
+ hash = {}
245
+ # include attributes inherited from allOf parents (the nearest declaration wins)
246
+ self.class.acceptable_attribute_map.each_pair do |attr, param|
247
+ value = self.send(attr)
248
+ if value.nil?
249
+ is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
250
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
251
+ end
252
+
253
+ hash[param] = _to_hash(value)
254
+ end
255
+ hash
256
+ end
257
+
258
+ end
259
+
260
+ end