docspring 1.0.0 → 1.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 (59) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -45
  3. data/Gemfile +2 -1
  4. data/Gemfile.lock +37 -32
  5. data/README.md +15 -9
  6. data/docs/CombinedSubmission.md +1 -0
  7. data/docs/CreateTemplateData.md +1 -1
  8. data/docs/CreateTemplateData1.md +8 -0
  9. data/docs/PDFApi.md +114 -12
  10. data/docs/PendingTemplate.md +1 -0
  11. data/docs/Submission.md +1 -0
  12. data/docs/SubmissionData.md +1 -0
  13. data/docs/SubmissionDataRequest.md +2 -0
  14. data/docs/Template.md +1 -0
  15. data/docs/TemplatesdesccachedUploadTemplate.md +25 -0
  16. data/docs/TemplatesdesccachedUploadTemplateDocument.md +10 -0
  17. data/docs/{Templatesv2TemplateDocumentMetadata.md → TemplatesdesccachedUploadTemplateDocumentMetadata.md} +1 -1
  18. data/docs/{Templatesv2Template.md → TemplatestemplateIdTemplate.md} +10 -6
  19. data/docs/UpdateTemplateData.md +8 -0
  20. data/docs/UpdateTemplateResponse.md +9 -0
  21. data/docspring.gemspec +1 -1
  22. data/lib/docspring.rb +7 -3
  23. data/lib/docspring/api/pdf_api.rb +128 -16
  24. data/lib/docspring/models/combined_submission.rb +10 -1
  25. data/lib/docspring/models/create_template_data.rb +1 -1
  26. data/lib/docspring/models/create_template_data1.rb +188 -0
  27. data/lib/docspring/models/pending_template.rb +10 -1
  28. data/lib/docspring/models/submission.rb +12 -3
  29. data/lib/docspring/models/submission_data.rb +10 -1
  30. data/lib/docspring/models/submission_data_request.rb +22 -4
  31. data/lib/docspring/models/template.rb +10 -1
  32. data/lib/docspring/models/templatesdesccached_upload_template.rb +382 -0
  33. data/lib/docspring/models/{templatesv2_template_document.rb → templatesdesccached_upload_template_document.rb} +2 -2
  34. data/lib/docspring/models/{templatesv2_template_document_metadata.rb → templatesdesccached_upload_template_document_metadata.rb} +1 -1
  35. data/lib/docspring/models/{templatesv2_template.rb → templatestemplate_id_template.rb} +77 -41
  36. data/lib/docspring/models/update_template_data.rb +188 -0
  37. data/lib/docspring/models/update_template_response.rb +228 -0
  38. data/lib/docspring/version.rb +1 -1
  39. data/spec/api/client_integration_spec.rb +14 -2
  40. data/spec/api/pdf_api_spec_original.skipped.rb +33 -7
  41. data/spec/models/combined_submission_spec.rb +6 -0
  42. data/spec/models/create_template_data1_spec.rb +41 -0
  43. data/spec/models/pending_template_spec.rb +6 -0
  44. data/spec/models/submission_data_request_spec.rb +12 -0
  45. data/spec/models/submission_data_spec.rb +6 -0
  46. data/spec/models/submission_spec.rb +7 -1
  47. data/spec/models/template_spec.rb +6 -0
  48. data/spec/models/{templatesv2_template_document_metadata_spec.rb → templatesdesccached_upload_template_document_metadata_spec.rb} +6 -6
  49. data/spec/models/{templatesv2_template_document_spec.rb → templatesdesccached_upload_template_document_spec.rb} +6 -6
  50. data/spec/models/templatesdesccached_upload_template_spec.rb +151 -0
  51. data/spec/models/{templatesv2_template_spec.rb → templatestemplate_id_template_spec.rb} +39 -15
  52. data/spec/models/update_template_data_spec.rb +41 -0
  53. data/spec/models/update_template_response_spec.rb +51 -0
  54. metadata +39 -27
  55. data/.swagger-codegen-ignore +0 -31
  56. data/.swagger-codegen/VERSION +0 -1
  57. data/.swagger-revision +0 -1
  58. data/.travis.yml +0 -8
  59. data/docs/Templatesv2TemplateDocument.md +0 -10
@@ -24,6 +24,8 @@ module DocSpring
24
24
 
25
25
  attr_accessor :allow_additional_properties
26
26
 
27
+ attr_accessor :description
28
+
27
29
  attr_accessor :public_submissions
28
30
 
29
31
  attr_accessor :slack_webhook_url
@@ -74,6 +76,7 @@ module DocSpring
74
76
  :'parent_folder_id' => :'parent_folder_id',
75
77
  :'expire_after' => :'expire_after',
76
78
  :'allow_additional_properties' => :'allow_additional_properties',
79
+ :'description' => :'description',
77
80
  :'public_submissions' => :'public_submissions',
78
81
  :'slack_webhook_url' => :'slack_webhook_url',
79
82
  :'path' => :'path',
@@ -95,6 +98,7 @@ module DocSpring
95
98
  :'parent_folder_id' => :'String',
96
99
  :'expire_after' => :'Float',
97
100
  :'allow_additional_properties' => :'BOOLEAN',
101
+ :'description' => :'String',
98
102
  :'public_submissions' => :'BOOLEAN',
99
103
  :'slack_webhook_url' => :'String',
100
104
  :'path' => :'String',
@@ -136,6 +140,10 @@ module DocSpring
136
140
  self.allow_additional_properties = attributes[:'allow_additional_properties']
137
141
  end
138
142
 
143
+ if attributes.has_key?(:'description')
144
+ self.description = attributes[:'description']
145
+ end
146
+
139
147
  if attributes.has_key?(:'public_submissions')
140
148
  self.public_submissions = attributes[:'public_submissions']
141
149
  end
@@ -212,6 +220,7 @@ module DocSpring
212
220
  parent_folder_id == o.parent_folder_id &&
213
221
  expire_after == o.expire_after &&
214
222
  allow_additional_properties == o.allow_additional_properties &&
223
+ description == o.description &&
215
224
  public_submissions == o.public_submissions &&
216
225
  slack_webhook_url == o.slack_webhook_url &&
217
226
  path == o.path &&
@@ -233,7 +242,7 @@ module DocSpring
233
242
  # Calculates hash code according to all attributes.
234
243
  # @return [Fixnum] Hash code
235
244
  def hash
236
- [expiration_interval, webhook_url, parent_folder_id, expire_after, allow_additional_properties, public_submissions, slack_webhook_url, path, public_web_form, editable_submissions, expire_submissions, name, template_type, id, redirect_url].hash
245
+ [expiration_interval, webhook_url, parent_folder_id, expire_after, allow_additional_properties, description, public_submissions, slack_webhook_url, path, public_web_form, editable_submissions, expire_submissions, name, template_type, id, redirect_url].hash
237
246
  end
238
247
 
239
248
  # Builds the object from hash
@@ -32,6 +32,8 @@ module DocSpring
32
32
 
33
33
  attr_accessor :metadata
34
34
 
35
+ attr_accessor :pdf_hash
36
+
35
37
  attr_accessor :download_url
36
38
 
37
39
  attr_accessor :permanent_download_url
@@ -76,6 +78,7 @@ module DocSpring
76
78
  :'processed_at' => :'processed_at',
77
79
  :'state' => :'state',
78
80
  :'metadata' => :'metadata',
81
+ :'pdf_hash' => :'pdf_hash',
79
82
  :'download_url' => :'download_url',
80
83
  :'permanent_download_url' => :'permanent_download_url',
81
84
  :'batch_id' => :'batch_id',
@@ -96,6 +99,7 @@ module DocSpring
96
99
  :'processed_at' => :'String',
97
100
  :'state' => :'String',
98
101
  :'metadata' => :'Object',
102
+ :'pdf_hash' => :'String',
99
103
  :'download_url' => :'String',
100
104
  :'permanent_download_url' => :'String',
101
105
  :'batch_id' => :'String',
@@ -148,6 +152,10 @@ module DocSpring
148
152
  self.metadata = attributes[:'metadata']
149
153
  end
150
154
 
155
+ if attributes.has_key?(:'pdf_hash')
156
+ self.pdf_hash = attributes[:'pdf_hash']
157
+ end
158
+
151
159
  if attributes.has_key?(:'download_url')
152
160
  self.download_url = attributes[:'download_url']
153
161
  end
@@ -203,7 +211,7 @@ module DocSpring
203
211
  return false if @test.nil?
204
212
  return false if @expired.nil?
205
213
  return false if @state.nil?
206
- state_validator = EnumAttributeValidator.new('String', ['pending', 'processed', 'invalid_data', 'error', 'image_download_failed', 'image_processing_failed', 'waiting_for_data_requests', 'syntax_error', 'account_suspended', 'license_revoked'])
214
+ state_validator = EnumAttributeValidator.new('String', ['pending', 'processed', 'invalid_data', 'error', 'image_download_failed', 'image_processing_failed', 'waiting_for_data_requests', 'syntax_error', 'account_suspended', 'license_revoked', 'accidental'])
207
215
  return false unless state_validator.valid?(@state)
208
216
  true
209
217
  end
@@ -211,7 +219,7 @@ module DocSpring
211
219
  # Custom attribute writer method checking allowed values (enum).
212
220
  # @param [Object] state Object to be assigned
213
221
  def state=(state)
214
- validator = EnumAttributeValidator.new('String', ['pending', 'processed', 'invalid_data', 'error', 'image_download_failed', 'image_processing_failed', 'waiting_for_data_requests', 'syntax_error', 'account_suspended', 'license_revoked'])
222
+ validator = EnumAttributeValidator.new('String', ['pending', 'processed', 'invalid_data', 'error', 'image_download_failed', 'image_processing_failed', 'waiting_for_data_requests', 'syntax_error', 'account_suspended', 'license_revoked', 'accidental'])
215
223
  unless validator.valid?(state)
216
224
  fail ArgumentError, 'invalid value for "state", must be one of #{validator.allowable_values}.'
217
225
  end
@@ -232,6 +240,7 @@ module DocSpring
232
240
  processed_at == o.processed_at &&
233
241
  state == o.state &&
234
242
  metadata == o.metadata &&
243
+ pdf_hash == o.pdf_hash &&
235
244
  download_url == o.download_url &&
236
245
  permanent_download_url == o.permanent_download_url &&
237
246
  batch_id == o.batch_id &&
@@ -248,7 +257,7 @@ module DocSpring
248
257
  # Calculates hash code according to all attributes.
249
258
  # @return [Fixnum] Hash code
250
259
  def hash
251
- [id, template_id, test, editable, expired, expires_at, processed_at, state, metadata, download_url, permanent_download_url, batch_id, data_requests, actions].hash
260
+ [id, template_id, test, editable, expired, expires_at, processed_at, state, metadata, pdf_hash, download_url, permanent_download_url, batch_id, data_requests, actions].hash
252
261
  end
253
262
 
254
263
  # Builds the object from hash
@@ -24,6 +24,8 @@ module DocSpring
24
24
 
25
25
  attr_accessor :metadata
26
26
 
27
+ attr_accessor :field_overrides
28
+
27
29
  attr_accessor :data_requests
28
30
 
29
31
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -34,6 +36,7 @@ module DocSpring
34
36
  :'html' => :'html',
35
37
  :'css' => :'css',
36
38
  :'metadata' => :'metadata',
39
+ :'field_overrides' => :'field_overrides',
37
40
  :'data_requests' => :'data_requests'
38
41
  }
39
42
  end
@@ -46,6 +49,7 @@ module DocSpring
46
49
  :'html' => :'String',
47
50
  :'css' => :'String',
48
51
  :'metadata' => :'Object',
52
+ :'field_overrides' => :'Object',
49
53
  :'data_requests' => :'Array<CreateSubmissionDataRequestData>'
50
54
  }
51
55
  end
@@ -78,6 +82,10 @@ module DocSpring
78
82
  self.metadata = attributes[:'metadata']
79
83
  end
80
84
 
85
+ if attributes.has_key?(:'field_overrides')
86
+ self.field_overrides = attributes[:'field_overrides']
87
+ end
88
+
81
89
  if attributes.has_key?(:'data_requests')
82
90
  if (value = attributes[:'data_requests']).is_a?(Array)
83
91
  self.data_requests = value
@@ -113,6 +121,7 @@ module DocSpring
113
121
  html == o.html &&
114
122
  css == o.css &&
115
123
  metadata == o.metadata &&
124
+ field_overrides == o.field_overrides &&
116
125
  data_requests == o.data_requests
117
126
  end
118
127
 
@@ -125,7 +134,7 @@ module DocSpring
125
134
  # Calculates hash code according to all attributes.
126
135
  # @return [Fixnum] Hash code
127
136
  def hash
128
- [test, data, html, css, metadata, data_requests].hash
137
+ [test, data, html, css, metadata, field_overrides, data_requests].hash
129
138
  end
130
139
 
131
140
  # Builds the object from hash
@@ -48,6 +48,10 @@ module DocSpring
48
48
 
49
49
  attr_accessor :auth_phone_number_hash
50
50
 
51
+ attr_accessor :ip_address
52
+
53
+ attr_accessor :user_agent
54
+
51
55
  class EnumAttributeValidator
52
56
  attr_reader :datatype
53
57
  attr_reader :allowable_values
@@ -89,7 +93,9 @@ module DocSpring
89
93
  :'auth_session_id_hash' => :'auth_session_id_hash',
90
94
  :'auth_user_id_hash' => :'auth_user_id_hash',
91
95
  :'auth_username_hash' => :'auth_username_hash',
92
- :'auth_phone_number_hash' => :'auth_phone_number_hash'
96
+ :'auth_phone_number_hash' => :'auth_phone_number_hash',
97
+ :'ip_address' => :'ip_address',
98
+ :'user_agent' => :'user_agent'
93
99
  }
94
100
  end
95
101
 
@@ -112,7 +118,9 @@ module DocSpring
112
118
  :'auth_session_id_hash' => :'String',
113
119
  :'auth_user_id_hash' => :'String',
114
120
  :'auth_username_hash' => :'String',
115
- :'auth_phone_number_hash' => :'String'
121
+ :'auth_phone_number_hash' => :'String',
122
+ :'ip_address' => :'String',
123
+ :'user_agent' => :'String'
116
124
  }
117
125
  end
118
126
 
@@ -193,6 +201,14 @@ module DocSpring
193
201
  if attributes.has_key?(:'auth_phone_number_hash')
194
202
  self.auth_phone_number_hash = attributes[:'auth_phone_number_hash']
195
203
  end
204
+
205
+ if attributes.has_key?(:'ip_address')
206
+ self.ip_address = attributes[:'ip_address']
207
+ end
208
+
209
+ if attributes.has_key?(:'user_agent')
210
+ self.user_agent = attributes[:'user_agent']
211
+ end
196
212
  end
197
213
 
198
214
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -300,7 +316,9 @@ module DocSpring
300
316
  auth_session_id_hash == o.auth_session_id_hash &&
301
317
  auth_user_id_hash == o.auth_user_id_hash &&
302
318
  auth_username_hash == o.auth_username_hash &&
303
- auth_phone_number_hash == o.auth_phone_number_hash
319
+ auth_phone_number_hash == o.auth_phone_number_hash &&
320
+ ip_address == o.ip_address &&
321
+ user_agent == o.user_agent
304
322
  end
305
323
 
306
324
  # @see the `==` method
@@ -312,7 +330,7 @@ module DocSpring
312
330
  # Calculates hash code according to all attributes.
313
331
  # @return [Fixnum] Hash code
314
332
  def hash
315
- [id, name, email, order, fields, metadata, state, viewed_at, completed_at, auth_type, auth_second_factor_type, auth_provider, auth_session_started_at, auth_session_id_hash, auth_user_id_hash, auth_username_hash, auth_phone_number_hash].hash
333
+ [id, name, email, order, fields, metadata, state, viewed_at, completed_at, auth_type, auth_second_factor_type, auth_provider, auth_session_started_at, auth_session_id_hash, auth_user_id_hash, auth_username_hash, auth_phone_number_hash, ip_address, user_agent].hash
316
334
  end
317
335
 
318
336
  # Builds the object from hash
@@ -24,6 +24,8 @@ module DocSpring
24
24
 
25
25
  attr_accessor :allow_additional_properties
26
26
 
27
+ attr_accessor :description
28
+
27
29
  attr_accessor :public_submissions
28
30
 
29
31
  attr_accessor :slack_webhook_url
@@ -80,6 +82,7 @@ module DocSpring
80
82
  :'parent_folder_id' => :'parent_folder_id',
81
83
  :'expire_after' => :'expire_after',
82
84
  :'allow_additional_properties' => :'allow_additional_properties',
85
+ :'description' => :'description',
83
86
  :'public_submissions' => :'public_submissions',
84
87
  :'slack_webhook_url' => :'slack_webhook_url',
85
88
  :'path' => :'path',
@@ -104,6 +107,7 @@ module DocSpring
104
107
  :'parent_folder_id' => :'String',
105
108
  :'expire_after' => :'Float',
106
109
  :'allow_additional_properties' => :'BOOLEAN',
110
+ :'description' => :'String',
107
111
  :'public_submissions' => :'BOOLEAN',
108
112
  :'slack_webhook_url' => :'String',
109
113
  :'path' => :'String',
@@ -148,6 +152,10 @@ module DocSpring
148
152
  self.allow_additional_properties = attributes[:'allow_additional_properties']
149
153
  end
150
154
 
155
+ if attributes.has_key?(:'description')
156
+ self.description = attributes[:'description']
157
+ end
158
+
151
159
  if attributes.has_key?(:'public_submissions')
152
160
  self.public_submissions = attributes[:'public_submissions']
153
161
  end
@@ -238,6 +246,7 @@ module DocSpring
238
246
  parent_folder_id == o.parent_folder_id &&
239
247
  expire_after == o.expire_after &&
240
248
  allow_additional_properties == o.allow_additional_properties &&
249
+ description == o.description &&
241
250
  public_submissions == o.public_submissions &&
242
251
  slack_webhook_url == o.slack_webhook_url &&
243
252
  path == o.path &&
@@ -262,7 +271,7 @@ module DocSpring
262
271
  # Calculates hash code according to all attributes.
263
272
  # @return [Fixnum] Hash code
264
273
  def hash
265
- [expiration_interval, webhook_url, parent_folder_id, expire_after, allow_additional_properties, public_submissions, slack_webhook_url, path, public_web_form, editable_submissions, expire_submissions, name, permanent_document_url, template_type, id, page_dimensions, redirect_url, document_url].hash
274
+ [expiration_interval, webhook_url, parent_folder_id, expire_after, allow_additional_properties, description, public_submissions, slack_webhook_url, path, public_web_form, editable_submissions, expire_submissions, name, permanent_document_url, template_type, id, page_dimensions, redirect_url, document_url].hash
266
275
  end
267
276
 
268
277
  # Builds the object from hash
@@ -0,0 +1,382 @@
1
+ =begin
2
+ #API v1
3
+
4
+ #DocSpring is a service that helps you fill out and sign PDF templates.
5
+
6
+ OpenAPI spec version: v1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 3.3.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module DocSpring
16
+ class TemplatesdesccachedUploadTemplate
17
+ attr_accessor :expiration_interval
18
+
19
+ attr_accessor :webhook_url
20
+
21
+ attr_accessor :scss
22
+
23
+ attr_accessor :expire_after
24
+
25
+ attr_accessor :allow_additional_properties
26
+
27
+ attr_accessor :document
28
+
29
+ attr_accessor :description
30
+
31
+ attr_accessor :public_submissions
32
+
33
+ attr_accessor :slack_webhook_url
34
+
35
+ attr_accessor :header_html
36
+
37
+ attr_accessor :public_web_form
38
+
39
+ attr_accessor :editable_submissions
40
+
41
+ attr_accessor :expire_submissions
42
+
43
+ attr_accessor :name
44
+
45
+ attr_accessor :html
46
+
47
+ attr_accessor :footer_html
48
+
49
+ attr_accessor :template_type
50
+
51
+ attr_accessor :redirect_url
52
+
53
+ class EnumAttributeValidator
54
+ attr_reader :datatype
55
+ attr_reader :allowable_values
56
+
57
+ def initialize(datatype, allowable_values)
58
+ @allowable_values = allowable_values.map do |value|
59
+ case datatype.to_s
60
+ when /Integer/i
61
+ value.to_i
62
+ when /Float/i
63
+ value.to_f
64
+ else
65
+ value
66
+ end
67
+ end
68
+ end
69
+
70
+ def valid?(value)
71
+ !value || allowable_values.include?(value)
72
+ end
73
+ end
74
+
75
+ # Attribute mapping from ruby-style variable name to JSON key.
76
+ def self.attribute_map
77
+ {
78
+ :'expiration_interval' => :'expiration_interval',
79
+ :'webhook_url' => :'webhook_url',
80
+ :'scss' => :'scss',
81
+ :'expire_after' => :'expire_after',
82
+ :'allow_additional_properties' => :'allow_additional_properties',
83
+ :'document' => :'document',
84
+ :'description' => :'description',
85
+ :'public_submissions' => :'public_submissions',
86
+ :'slack_webhook_url' => :'slack_webhook_url',
87
+ :'header_html' => :'header_html',
88
+ :'public_web_form' => :'public_web_form',
89
+ :'editable_submissions' => :'editable_submissions',
90
+ :'expire_submissions' => :'expire_submissions',
91
+ :'name' => :'name',
92
+ :'html' => :'html',
93
+ :'footer_html' => :'footer_html',
94
+ :'template_type' => :'template_type',
95
+ :'redirect_url' => :'redirect_url'
96
+ }
97
+ end
98
+
99
+ # Attribute type mapping.
100
+ def self.openapi_types
101
+ {
102
+ :'expiration_interval' => :'String',
103
+ :'webhook_url' => :'String',
104
+ :'scss' => :'String',
105
+ :'expire_after' => :'Float',
106
+ :'allow_additional_properties' => :'BOOLEAN',
107
+ :'document' => :'TemplatesdesccachedUploadTemplateDocument',
108
+ :'description' => :'String',
109
+ :'public_submissions' => :'BOOLEAN',
110
+ :'slack_webhook_url' => :'String',
111
+ :'header_html' => :'String',
112
+ :'public_web_form' => :'BOOLEAN',
113
+ :'editable_submissions' => :'BOOLEAN',
114
+ :'expire_submissions' => :'BOOLEAN',
115
+ :'name' => :'String',
116
+ :'html' => :'String',
117
+ :'footer_html' => :'String',
118
+ :'template_type' => :'String',
119
+ :'redirect_url' => :'String'
120
+ }
121
+ end
122
+
123
+ # Initializes the object
124
+ # @param [Hash] attributes Model attributes in the form of hash
125
+ def initialize(attributes = {})
126
+ return unless attributes.is_a?(Hash)
127
+
128
+ # convert string to symbol for hash key
129
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
130
+
131
+ if attributes.has_key?(:'expiration_interval')
132
+ self.expiration_interval = attributes[:'expiration_interval']
133
+ end
134
+
135
+ if attributes.has_key?(:'webhook_url')
136
+ self.webhook_url = attributes[:'webhook_url']
137
+ end
138
+
139
+ if attributes.has_key?(:'scss')
140
+ self.scss = attributes[:'scss']
141
+ end
142
+
143
+ if attributes.has_key?(:'expire_after')
144
+ self.expire_after = attributes[:'expire_after']
145
+ end
146
+
147
+ if attributes.has_key?(:'allow_additional_properties')
148
+ self.allow_additional_properties = attributes[:'allow_additional_properties']
149
+ end
150
+
151
+ if attributes.has_key?(:'document')
152
+ self.document = attributes[:'document']
153
+ end
154
+
155
+ if attributes.has_key?(:'description')
156
+ self.description = attributes[:'description']
157
+ end
158
+
159
+ if attributes.has_key?(:'public_submissions')
160
+ self.public_submissions = attributes[:'public_submissions']
161
+ end
162
+
163
+ if attributes.has_key?(:'slack_webhook_url')
164
+ self.slack_webhook_url = attributes[:'slack_webhook_url']
165
+ end
166
+
167
+ if attributes.has_key?(:'header_html')
168
+ self.header_html = attributes[:'header_html']
169
+ end
170
+
171
+ if attributes.has_key?(:'public_web_form')
172
+ self.public_web_form = attributes[:'public_web_form']
173
+ end
174
+
175
+ if attributes.has_key?(:'editable_submissions')
176
+ self.editable_submissions = attributes[:'editable_submissions']
177
+ end
178
+
179
+ if attributes.has_key?(:'expire_submissions')
180
+ self.expire_submissions = attributes[:'expire_submissions']
181
+ end
182
+
183
+ if attributes.has_key?(:'name')
184
+ self.name = attributes[:'name']
185
+ end
186
+
187
+ if attributes.has_key?(:'html')
188
+ self.html = attributes[:'html']
189
+ end
190
+
191
+ if attributes.has_key?(:'footer_html')
192
+ self.footer_html = attributes[:'footer_html']
193
+ end
194
+
195
+ if attributes.has_key?(:'template_type')
196
+ self.template_type = attributes[:'template_type']
197
+ end
198
+
199
+ if attributes.has_key?(:'redirect_url')
200
+ self.redirect_url = attributes[:'redirect_url']
201
+ end
202
+ end
203
+
204
+ # Show invalid properties with the reasons. Usually used together with valid?
205
+ # @return Array for valid properties with the reasons
206
+ def list_invalid_properties
207
+ invalid_properties = Array.new
208
+ invalid_properties
209
+ end
210
+
211
+ # Check to see if the all the properties in the model are valid
212
+ # @return true if the model is valid
213
+ def valid?
214
+ expiration_interval_validator = EnumAttributeValidator.new('String', ['minutes', 'hours', 'days'])
215
+ return false unless expiration_interval_validator.valid?(@expiration_interval)
216
+ template_type_validator = EnumAttributeValidator.new('String', ['pdf', 'html'])
217
+ return false unless template_type_validator.valid?(@template_type)
218
+ true
219
+ end
220
+
221
+ # Custom attribute writer method checking allowed values (enum).
222
+ # @param [Object] expiration_interval Object to be assigned
223
+ def expiration_interval=(expiration_interval)
224
+ validator = EnumAttributeValidator.new('String', ['minutes', 'hours', 'days'])
225
+ unless validator.valid?(expiration_interval)
226
+ fail ArgumentError, 'invalid value for "expiration_interval", must be one of #{validator.allowable_values}.'
227
+ end
228
+ @expiration_interval = expiration_interval
229
+ end
230
+
231
+ # Custom attribute writer method checking allowed values (enum).
232
+ # @param [Object] template_type Object to be assigned
233
+ def template_type=(template_type)
234
+ validator = EnumAttributeValidator.new('String', ['pdf', 'html'])
235
+ unless validator.valid?(template_type)
236
+ fail ArgumentError, 'invalid value for "template_type", must be one of #{validator.allowable_values}.'
237
+ end
238
+ @template_type = template_type
239
+ end
240
+
241
+ # Checks equality by comparing each attribute.
242
+ # @param [Object] Object to be compared
243
+ def ==(o)
244
+ return true if self.equal?(o)
245
+ self.class == o.class &&
246
+ expiration_interval == o.expiration_interval &&
247
+ webhook_url == o.webhook_url &&
248
+ scss == o.scss &&
249
+ expire_after == o.expire_after &&
250
+ allow_additional_properties == o.allow_additional_properties &&
251
+ document == o.document &&
252
+ description == o.description &&
253
+ public_submissions == o.public_submissions &&
254
+ slack_webhook_url == o.slack_webhook_url &&
255
+ header_html == o.header_html &&
256
+ public_web_form == o.public_web_form &&
257
+ editable_submissions == o.editable_submissions &&
258
+ expire_submissions == o.expire_submissions &&
259
+ name == o.name &&
260
+ html == o.html &&
261
+ footer_html == o.footer_html &&
262
+ template_type == o.template_type &&
263
+ redirect_url == o.redirect_url
264
+ end
265
+
266
+ # @see the `==` method
267
+ # @param [Object] Object to be compared
268
+ def eql?(o)
269
+ self == o
270
+ end
271
+
272
+ # Calculates hash code according to all attributes.
273
+ # @return [Fixnum] Hash code
274
+ def hash
275
+ [expiration_interval, webhook_url, scss, expire_after, allow_additional_properties, document, description, public_submissions, slack_webhook_url, header_html, public_web_form, editable_submissions, expire_submissions, name, html, footer_html, template_type, redirect_url].hash
276
+ end
277
+
278
+ # Builds the object from hash
279
+ # @param [Hash] attributes Model attributes in the form of hash
280
+ # @return [Object] Returns the model itself
281
+ def build_from_hash(attributes)
282
+ return nil unless attributes.is_a?(Hash)
283
+ self.class.openapi_types.each_pair do |key, type|
284
+ if type =~ /\AArray<(.*)>/i
285
+ # check to ensure the input is an array given that the the attribute
286
+ # is documented as an array but the input is not
287
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
288
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
289
+ end
290
+ elsif !attributes[self.class.attribute_map[key]].nil?
291
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
292
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
293
+ end
294
+
295
+ self
296
+ end
297
+
298
+ # Deserializes the data based on type
299
+ # @param string type Data type
300
+ # @param string value Value to be deserialized
301
+ # @return [Object] Deserialized data
302
+ def _deserialize(type, value)
303
+ case type.to_sym
304
+ when :DateTime
305
+ DateTime.parse(value)
306
+ when :Date
307
+ Date.parse(value)
308
+ when :String
309
+ value.to_s
310
+ when :Integer
311
+ value.to_i
312
+ when :Float
313
+ value.to_f
314
+ when :BOOLEAN
315
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
316
+ true
317
+ else
318
+ false
319
+ end
320
+ when :Object
321
+ # generic object (usually a Hash), return directly
322
+ value
323
+ when /\AArray<(?<inner_type>.+)>\z/
324
+ inner_type = Regexp.last_match[:inner_type]
325
+ value.map { |v| _deserialize(inner_type, v) }
326
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
327
+ k_type = Regexp.last_match[:k_type]
328
+ v_type = Regexp.last_match[:v_type]
329
+ {}.tap do |hash|
330
+ value.each do |k, v|
331
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
332
+ end
333
+ end
334
+ else # model
335
+ temp_model = DocSpring.const_get(type).new
336
+ temp_model.build_from_hash(value)
337
+ end
338
+ end
339
+
340
+ # Returns the string representation of the object
341
+ # @return [String] String presentation of the object
342
+ def to_s
343
+ to_hash.to_s
344
+ end
345
+
346
+ # to_body is an alias to to_hash (backward compatibility)
347
+ # @return [Hash] Returns the object in the form of hash
348
+ def to_body
349
+ to_hash
350
+ end
351
+
352
+ # Returns the object in the form of hash
353
+ # @return [Hash] Returns the object in the form of hash
354
+ def to_hash
355
+ hash = {}
356
+ self.class.attribute_map.each_pair do |attr, param|
357
+ value = self.send(attr)
358
+ next if value.nil?
359
+ hash[param] = _to_hash(value)
360
+ end
361
+ hash
362
+ end
363
+
364
+ # Outputs non-array value in the form of hash
365
+ # For object, use to_hash. Otherwise, just return the value
366
+ # @param [Object] value Any valid value
367
+ # @return [Hash] Returns the value in the form of hash
368
+ def _to_hash(value)
369
+ if value.is_a?(Array)
370
+ value.compact.map { |v| _to_hash(v) }
371
+ elsif value.is_a?(Hash)
372
+ {}.tap do |hash|
373
+ value.each { |k, v| hash[k] = _to_hash(v) }
374
+ end
375
+ elsif value.respond_to? :to_hash
376
+ value.to_hash
377
+ else
378
+ value
379
+ end
380
+ end
381
+ end
382
+ end