docspring 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (150) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +39 -0
  3. data/.openapi-generator-ignore +23 -0
  4. data/.openapi-generator/VERSION +1 -0
  5. data/.rspec +2 -0
  6. data/.rubocop.yml +154 -0
  7. data/.swagger-codegen-ignore +31 -0
  8. data/.swagger-codegen/VERSION +1 -0
  9. data/.swagger-revision +1 -0
  10. data/.travis.yml +8 -0
  11. data/CHANGELOG.md +48 -0
  12. data/Gemfile +8 -0
  13. data/Gemfile.lock +80 -0
  14. data/LICENSE +7 -0
  15. data/README.md +162 -0
  16. data/Rakefile +10 -0
  17. data/docs/AuthenticationError.md +9 -0
  18. data/docs/AuthenticationSuccessResponse.md +8 -0
  19. data/docs/CombinePdfsData.md +12 -0
  20. data/docs/CombinedSubmission.md +16 -0
  21. data/docs/CombinedSubmissionAction.md +13 -0
  22. data/docs/CombinedSubmissionData.md +11 -0
  23. data/docs/CreateCombinedSubmissionResponse.md +10 -0
  24. data/docs/CreateCustomFileData.md +8 -0
  25. data/docs/CreateCustomFileResponse.md +10 -0
  26. data/docs/CreateFolderData.md +8 -0
  27. data/docs/CreateSubmissionBatchResponse.md +12 -0
  28. data/docs/CreateSubmissionBatchSubmissionsResponse.md +10 -0
  29. data/docs/CreateSubmissionDataRequestData.md +20 -0
  30. data/docs/CreateSubmissionDataRequestTokenResponse.md +10 -0
  31. data/docs/CreateSubmissionDataRequestTokenResponseToken.md +11 -0
  32. data/docs/CreateSubmissionResponse.md +10 -0
  33. data/docs/CreateTemplateData.md +8 -0
  34. data/docs/CustomFile.md +9 -0
  35. data/docs/Error.md +9 -0
  36. data/docs/Folder.md +11 -0
  37. data/docs/FoldersFolder.md +9 -0
  38. data/docs/InvalidRequest.md +9 -0
  39. data/docs/MoveFolderData.md +8 -0
  40. data/docs/MoveTemplateData.md +8 -0
  41. data/docs/PDFApi.md +1385 -0
  42. data/docs/PendingTemplate.md +22 -0
  43. data/docs/RenameFolderData.md +8 -0
  44. data/docs/Submission.md +21 -0
  45. data/docs/SubmissionAction.md +13 -0
  46. data/docs/SubmissionBatch.md +16 -0
  47. data/docs/SubmissionBatchData.md +11 -0
  48. data/docs/SubmissionData.md +13 -0
  49. data/docs/SubmissionDataBatchRequest.md +13 -0
  50. data/docs/SubmissionDataRequest.md +24 -0
  51. data/docs/Template.md +25 -0
  52. data/docs/Templatesv2Template.md +19 -0
  53. data/docs/Templatesv2TemplateDocument.md +10 -0
  54. data/docs/Templatesv2TemplateDocumentMetadata.md +10 -0
  55. data/docs/UpdateDataRequestResponse.md +10 -0
  56. data/docs/UpdateSubmissionDataRequestData.md +20 -0
  57. data/docspring.gemspec +47 -0
  58. data/git_push.sh +55 -0
  59. data/lib/docspring.rb +82 -0
  60. data/lib/docspring/api/client.rb +174 -0
  61. data/lib/docspring/api/pdf_api.rb +1481 -0
  62. data/lib/docspring/api_client.rb +406 -0
  63. data/lib/docspring/api_error.rb +38 -0
  64. data/lib/docspring/configuration.rb +230 -0
  65. data/lib/docspring/models/authentication_error.rb +231 -0
  66. data/lib/docspring/models/authentication_success_response.rb +217 -0
  67. data/lib/docspring/models/combine_pdfs_data.rb +226 -0
  68. data/lib/docspring/models/combined_submission.rb +295 -0
  69. data/lib/docspring/models/combined_submission_action.rb +316 -0
  70. data/lib/docspring/models/combined_submission_data.rb +217 -0
  71. data/lib/docspring/models/create_combined_submission_response.rb +237 -0
  72. data/lib/docspring/models/create_custom_file_data.rb +207 -0
  73. data/lib/docspring/models/create_custom_file_response.rb +237 -0
  74. data/lib/docspring/models/create_folder_data.rb +188 -0
  75. data/lib/docspring/models/create_submission_batch_response.rb +257 -0
  76. data/lib/docspring/models/create_submission_batch_submissions_response.rb +237 -0
  77. data/lib/docspring/models/create_submission_data_request_data.rb +339 -0
  78. data/lib/docspring/models/create_submission_data_request_token_response.rb +237 -0
  79. data/lib/docspring/models/create_submission_data_request_token_response_token.rb +210 -0
  80. data/lib/docspring/models/create_submission_response.rb +237 -0
  81. data/lib/docspring/models/create_template_data.rb +188 -0
  82. data/lib/docspring/models/custom_file.rb +192 -0
  83. data/lib/docspring/models/error.rb +236 -0
  84. data/lib/docspring/models/folder.rb +210 -0
  85. data/lib/docspring/models/folders_folder.rb +192 -0
  86. data/lib/docspring/models/invalid_request.rb +238 -0
  87. data/lib/docspring/models/move_folder_data.rb +183 -0
  88. data/lib/docspring/models/move_template_data.rb +183 -0
  89. data/lib/docspring/models/pending_template.rb +343 -0
  90. data/lib/docspring/models/rename_folder_data.rb +188 -0
  91. data/lib/docspring/models/submission.rb +358 -0
  92. data/lib/docspring/models/submission_action.rb +316 -0
  93. data/lib/docspring/models/submission_batch.rb +291 -0
  94. data/lib/docspring/models/submission_batch_data.rb +217 -0
  95. data/lib/docspring/models/submission_data.rb +235 -0
  96. data/lib/docspring/models/submission_data_batch_request.rb +228 -0
  97. data/lib/docspring/models/submission_data_request.rb +422 -0
  98. data/lib/docspring/models/template.rb +372 -0
  99. data/lib/docspring/models/templatesv2_template.rb +316 -0
  100. data/lib/docspring/models/templatesv2_template_document.rb +235 -0
  101. data/lib/docspring/models/templatesv2_template_document_metadata.rb +235 -0
  102. data/lib/docspring/models/update_data_request_response.rb +237 -0
  103. data/lib/docspring/models/update_submission_data_request_data.rb +339 -0
  104. data/lib/docspring/version.rb +15 -0
  105. data/spec/api/client_integration_spec.rb +259 -0
  106. data/spec/api/pdf_api_integration_spec.rb +377 -0
  107. data/spec/api/pdf_api_spec_original.skipped.rb +397 -0
  108. data/spec/api_client_spec.rb +226 -0
  109. data/spec/configuration_spec.rb +53 -0
  110. data/spec/models/authentication_error_spec.rb +51 -0
  111. data/spec/models/authentication_success_response_spec.rb +45 -0
  112. data/spec/models/combine_pdfs_data_spec.rb +65 -0
  113. data/spec/models/combined_submission_action_spec.rb +83 -0
  114. data/spec/models/combined_submission_data_spec.rb +59 -0
  115. data/spec/models/combined_submission_spec.rb +93 -0
  116. data/spec/models/create_combined_submission_response_spec.rb +57 -0
  117. data/spec/models/create_custom_file_data_spec.rb +41 -0
  118. data/spec/models/create_custom_file_response_spec.rb +57 -0
  119. data/spec/models/create_folder_data_spec.rb +41 -0
  120. data/spec/models/create_submission_batch_response_spec.rb +69 -0
  121. data/spec/models/create_submission_batch_submissions_response_spec.rb +57 -0
  122. data/spec/models/create_submission_data_request_data_spec.rb +121 -0
  123. data/spec/models/create_submission_data_request_token_response_spec.rb +57 -0
  124. data/spec/models/create_submission_data_request_token_response_token_spec.rb +59 -0
  125. data/spec/models/create_submission_response_spec.rb +57 -0
  126. data/spec/models/create_template_data_spec.rb +41 -0
  127. data/spec/models/custom_file_spec.rb +47 -0
  128. data/spec/models/error_spec.rb +51 -0
  129. data/spec/models/folder_spec.rb +59 -0
  130. data/spec/models/folders_folder_spec.rb +47 -0
  131. data/spec/models/invalid_request_spec.rb +51 -0
  132. data/spec/models/move_folder_data_spec.rb +41 -0
  133. data/spec/models/move_template_data_spec.rb +41 -0
  134. data/spec/models/pending_template_spec.rb +129 -0
  135. data/spec/models/rename_folder_data_spec.rb +41 -0
  136. data/spec/models/submission_action_spec.rb +83 -0
  137. data/spec/models/submission_batch_data_spec.rb +59 -0
  138. data/spec/models/submission_batch_spec.rb +93 -0
  139. data/spec/models/submission_data_batch_request_spec.rb +71 -0
  140. data/spec/models/submission_data_request_spec.rb +149 -0
  141. data/spec/models/submission_data_spec.rb +71 -0
  142. data/spec/models/submission_spec.rb +123 -0
  143. data/spec/models/template_spec.rb +147 -0
  144. data/spec/models/templatesv2_template_document_metadata_spec.rb +57 -0
  145. data/spec/models/templatesv2_template_document_spec.rb +57 -0
  146. data/spec/models/templatesv2_template_spec.rb +111 -0
  147. data/spec/models/update_data_request_response_spec.rb +57 -0
  148. data/spec/models/update_submission_data_request_data_spec.rb +121 -0
  149. data/spec/spec_helper.rb +117 -0
  150. metadata +430 -0
@@ -0,0 +1,228 @@
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 SubmissionDataBatchRequest
17
+ attr_accessor :css
18
+
19
+ attr_accessor :metadata
20
+
21
+ attr_accessor :test
22
+
23
+ attr_accessor :data
24
+
25
+ attr_accessor :template_id
26
+
27
+ attr_accessor :html
28
+
29
+ # Attribute mapping from ruby-style variable name to JSON key.
30
+ def self.attribute_map
31
+ {
32
+ :'css' => :'css',
33
+ :'metadata' => :'metadata',
34
+ :'test' => :'test',
35
+ :'data' => :'data',
36
+ :'template_id' => :'template_id',
37
+ :'html' => :'html'
38
+ }
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.openapi_types
43
+ {
44
+ :'css' => :'String',
45
+ :'metadata' => :'Object',
46
+ :'test' => :'BOOLEAN',
47
+ :'data' => :'Object',
48
+ :'template_id' => :'String',
49
+ :'html' => :'String'
50
+ }
51
+ end
52
+
53
+ # Initializes the object
54
+ # @param [Hash] attributes Model attributes in the form of hash
55
+ def initialize(attributes = {})
56
+ return unless attributes.is_a?(Hash)
57
+
58
+ # convert string to symbol for hash key
59
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
60
+
61
+ if attributes.has_key?(:'css')
62
+ self.css = attributes[:'css']
63
+ end
64
+
65
+ if attributes.has_key?(:'metadata')
66
+ self.metadata = attributes[:'metadata']
67
+ end
68
+
69
+ if attributes.has_key?(:'test')
70
+ self.test = attributes[:'test']
71
+ end
72
+
73
+ if attributes.has_key?(:'data')
74
+ self.data = attributes[:'data']
75
+ end
76
+
77
+ if attributes.has_key?(:'template_id')
78
+ self.template_id = attributes[:'template_id']
79
+ end
80
+
81
+ if attributes.has_key?(:'html')
82
+ self.html = attributes[:'html']
83
+ end
84
+ end
85
+
86
+ # Show invalid properties with the reasons. Usually used together with valid?
87
+ # @return Array for valid properties with the reasons
88
+ def list_invalid_properties
89
+ invalid_properties = Array.new
90
+ invalid_properties
91
+ end
92
+
93
+ # Check to see if the all the properties in the model are valid
94
+ # @return true if the model is valid
95
+ def valid?
96
+ true
97
+ end
98
+
99
+ # Checks equality by comparing each attribute.
100
+ # @param [Object] Object to be compared
101
+ def ==(o)
102
+ return true if self.equal?(o)
103
+ self.class == o.class &&
104
+ css == o.css &&
105
+ metadata == o.metadata &&
106
+ test == o.test &&
107
+ data == o.data &&
108
+ template_id == o.template_id &&
109
+ html == o.html
110
+ end
111
+
112
+ # @see the `==` method
113
+ # @param [Object] Object to be compared
114
+ def eql?(o)
115
+ self == o
116
+ end
117
+
118
+ # Calculates hash code according to all attributes.
119
+ # @return [Fixnum] Hash code
120
+ def hash
121
+ [css, metadata, test, data, template_id, html].hash
122
+ end
123
+
124
+ # Builds the object from hash
125
+ # @param [Hash] attributes Model attributes in the form of hash
126
+ # @return [Object] Returns the model itself
127
+ def build_from_hash(attributes)
128
+ return nil unless attributes.is_a?(Hash)
129
+ self.class.openapi_types.each_pair do |key, type|
130
+ if type =~ /\AArray<(.*)>/i
131
+ # check to ensure the input is an array given that the the attribute
132
+ # is documented as an array but the input is not
133
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
134
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
135
+ end
136
+ elsif !attributes[self.class.attribute_map[key]].nil?
137
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
138
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
139
+ end
140
+
141
+ self
142
+ end
143
+
144
+ # Deserializes the data based on type
145
+ # @param string type Data type
146
+ # @param string value Value to be deserialized
147
+ # @return [Object] Deserialized data
148
+ def _deserialize(type, value)
149
+ case type.to_sym
150
+ when :DateTime
151
+ DateTime.parse(value)
152
+ when :Date
153
+ Date.parse(value)
154
+ when :String
155
+ value.to_s
156
+ when :Integer
157
+ value.to_i
158
+ when :Float
159
+ value.to_f
160
+ when :BOOLEAN
161
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
162
+ true
163
+ else
164
+ false
165
+ end
166
+ when :Object
167
+ # generic object (usually a Hash), return directly
168
+ value
169
+ when /\AArray<(?<inner_type>.+)>\z/
170
+ inner_type = Regexp.last_match[:inner_type]
171
+ value.map { |v| _deserialize(inner_type, v) }
172
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
173
+ k_type = Regexp.last_match[:k_type]
174
+ v_type = Regexp.last_match[:v_type]
175
+ {}.tap do |hash|
176
+ value.each do |k, v|
177
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
178
+ end
179
+ end
180
+ else # model
181
+ temp_model = DocSpring.const_get(type).new
182
+ temp_model.build_from_hash(value)
183
+ end
184
+ end
185
+
186
+ # Returns the string representation of the object
187
+ # @return [String] String presentation of the object
188
+ def to_s
189
+ to_hash.to_s
190
+ end
191
+
192
+ # to_body is an alias to to_hash (backward compatibility)
193
+ # @return [Hash] Returns the object in the form of hash
194
+ def to_body
195
+ to_hash
196
+ end
197
+
198
+ # Returns the object in the form of hash
199
+ # @return [Hash] Returns the object in the form of hash
200
+ def to_hash
201
+ hash = {}
202
+ self.class.attribute_map.each_pair do |attr, param|
203
+ value = self.send(attr)
204
+ next if value.nil?
205
+ hash[param] = _to_hash(value)
206
+ end
207
+ hash
208
+ end
209
+
210
+ # Outputs non-array value in the form of hash
211
+ # For object, use to_hash. Otherwise, just return the value
212
+ # @param [Object] value Any valid value
213
+ # @return [Hash] Returns the value in the form of hash
214
+ def _to_hash(value)
215
+ if value.is_a?(Array)
216
+ value.compact.map { |v| _to_hash(v) }
217
+ elsif value.is_a?(Hash)
218
+ {}.tap do |hash|
219
+ value.each { |k, v| hash[k] = _to_hash(v) }
220
+ end
221
+ elsif value.respond_to? :to_hash
222
+ value.to_hash
223
+ else
224
+ value
225
+ end
226
+ end
227
+ end
228
+ end
@@ -0,0 +1,422 @@
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 SubmissionDataRequest
17
+ attr_accessor :id
18
+
19
+ attr_accessor :name
20
+
21
+ attr_accessor :email
22
+
23
+ attr_accessor :order
24
+
25
+ attr_accessor :fields
26
+
27
+ attr_accessor :metadata
28
+
29
+ attr_accessor :state
30
+
31
+ attr_accessor :viewed_at
32
+
33
+ attr_accessor :completed_at
34
+
35
+ attr_accessor :auth_type
36
+
37
+ attr_accessor :auth_second_factor_type
38
+
39
+ attr_accessor :auth_provider
40
+
41
+ attr_accessor :auth_session_started_at
42
+
43
+ attr_accessor :auth_session_id_hash
44
+
45
+ attr_accessor :auth_user_id_hash
46
+
47
+ attr_accessor :auth_username_hash
48
+
49
+ attr_accessor :auth_phone_number_hash
50
+
51
+ class EnumAttributeValidator
52
+ attr_reader :datatype
53
+ attr_reader :allowable_values
54
+
55
+ def initialize(datatype, allowable_values)
56
+ @allowable_values = allowable_values.map do |value|
57
+ case datatype.to_s
58
+ when /Integer/i
59
+ value.to_i
60
+ when /Float/i
61
+ value.to_f
62
+ else
63
+ value
64
+ end
65
+ end
66
+ end
67
+
68
+ def valid?(value)
69
+ !value || allowable_values.include?(value)
70
+ end
71
+ end
72
+
73
+ # Attribute mapping from ruby-style variable name to JSON key.
74
+ def self.attribute_map
75
+ {
76
+ :'id' => :'id',
77
+ :'name' => :'name',
78
+ :'email' => :'email',
79
+ :'order' => :'order',
80
+ :'fields' => :'fields',
81
+ :'metadata' => :'metadata',
82
+ :'state' => :'state',
83
+ :'viewed_at' => :'viewed_at',
84
+ :'completed_at' => :'completed_at',
85
+ :'auth_type' => :'auth_type',
86
+ :'auth_second_factor_type' => :'auth_second_factor_type',
87
+ :'auth_provider' => :'auth_provider',
88
+ :'auth_session_started_at' => :'auth_session_started_at',
89
+ :'auth_session_id_hash' => :'auth_session_id_hash',
90
+ :'auth_user_id_hash' => :'auth_user_id_hash',
91
+ :'auth_username_hash' => :'auth_username_hash',
92
+ :'auth_phone_number_hash' => :'auth_phone_number_hash'
93
+ }
94
+ end
95
+
96
+ # Attribute type mapping.
97
+ def self.openapi_types
98
+ {
99
+ :'id' => :'String',
100
+ :'name' => :'String',
101
+ :'email' => :'String',
102
+ :'order' => :'Integer',
103
+ :'fields' => :'Array<String>',
104
+ :'metadata' => :'Object',
105
+ :'state' => :'String',
106
+ :'viewed_at' => :'String',
107
+ :'completed_at' => :'String',
108
+ :'auth_type' => :'String',
109
+ :'auth_second_factor_type' => :'String',
110
+ :'auth_provider' => :'String',
111
+ :'auth_session_started_at' => :'String',
112
+ :'auth_session_id_hash' => :'String',
113
+ :'auth_user_id_hash' => :'String',
114
+ :'auth_username_hash' => :'String',
115
+ :'auth_phone_number_hash' => :'String'
116
+ }
117
+ end
118
+
119
+ # Initializes the object
120
+ # @param [Hash] attributes Model attributes in the form of hash
121
+ def initialize(attributes = {})
122
+ return unless attributes.is_a?(Hash)
123
+
124
+ # convert string to symbol for hash key
125
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
126
+
127
+ if attributes.has_key?(:'id')
128
+ self.id = attributes[:'id']
129
+ end
130
+
131
+ if attributes.has_key?(:'name')
132
+ self.name = attributes[:'name']
133
+ end
134
+
135
+ if attributes.has_key?(:'email')
136
+ self.email = attributes[:'email']
137
+ end
138
+
139
+ if attributes.has_key?(:'order')
140
+ self.order = attributes[:'order']
141
+ end
142
+
143
+ if attributes.has_key?(:'fields')
144
+ if (value = attributes[:'fields']).is_a?(Array)
145
+ self.fields = value
146
+ end
147
+ end
148
+
149
+ if attributes.has_key?(:'metadata')
150
+ self.metadata = attributes[:'metadata']
151
+ end
152
+
153
+ if attributes.has_key?(:'state')
154
+ self.state = attributes[:'state']
155
+ end
156
+
157
+ if attributes.has_key?(:'viewed_at')
158
+ self.viewed_at = attributes[:'viewed_at']
159
+ end
160
+
161
+ if attributes.has_key?(:'completed_at')
162
+ self.completed_at = attributes[:'completed_at']
163
+ end
164
+
165
+ if attributes.has_key?(:'auth_type')
166
+ self.auth_type = attributes[:'auth_type']
167
+ end
168
+
169
+ if attributes.has_key?(:'auth_second_factor_type')
170
+ self.auth_second_factor_type = attributes[:'auth_second_factor_type']
171
+ end
172
+
173
+ if attributes.has_key?(:'auth_provider')
174
+ self.auth_provider = attributes[:'auth_provider']
175
+ end
176
+
177
+ if attributes.has_key?(:'auth_session_started_at')
178
+ self.auth_session_started_at = attributes[:'auth_session_started_at']
179
+ end
180
+
181
+ if attributes.has_key?(:'auth_session_id_hash')
182
+ self.auth_session_id_hash = attributes[:'auth_session_id_hash']
183
+ end
184
+
185
+ if attributes.has_key?(:'auth_user_id_hash')
186
+ self.auth_user_id_hash = attributes[:'auth_user_id_hash']
187
+ end
188
+
189
+ if attributes.has_key?(:'auth_username_hash')
190
+ self.auth_username_hash = attributes[:'auth_username_hash']
191
+ end
192
+
193
+ if attributes.has_key?(:'auth_phone_number_hash')
194
+ self.auth_phone_number_hash = attributes[:'auth_phone_number_hash']
195
+ end
196
+ end
197
+
198
+ # Show invalid properties with the reasons. Usually used together with valid?
199
+ # @return Array for valid properties with the reasons
200
+ def list_invalid_properties
201
+ invalid_properties = Array.new
202
+ if @id.nil?
203
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
204
+ end
205
+
206
+ if @name.nil?
207
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
208
+ end
209
+
210
+ if @email.nil?
211
+ invalid_properties.push('invalid value for "email", email cannot be nil.')
212
+ end
213
+
214
+ if @order.nil?
215
+ invalid_properties.push('invalid value for "order", order cannot be nil.')
216
+ end
217
+
218
+ if @fields.nil?
219
+ invalid_properties.push('invalid value for "fields", fields cannot be nil.')
220
+ end
221
+
222
+ if @metadata.nil?
223
+ invalid_properties.push('invalid value for "metadata", metadata cannot be nil.')
224
+ end
225
+
226
+ if @state.nil?
227
+ invalid_properties.push('invalid value for "state", state cannot be nil.')
228
+ end
229
+
230
+ invalid_properties
231
+ end
232
+
233
+ # Check to see if the all the properties in the model are valid
234
+ # @return true if the model is valid
235
+ def valid?
236
+ return false if @id.nil?
237
+ return false if @name.nil?
238
+ return false if @email.nil?
239
+ return false if @order.nil?
240
+ return false if @fields.nil?
241
+ return false if @metadata.nil?
242
+ return false if @state.nil?
243
+ state_validator = EnumAttributeValidator.new('String', ['pending', 'completed'])
244
+ return false unless state_validator.valid?(@state)
245
+ auth_type_validator = EnumAttributeValidator.new('String', ['none', 'password', 'oauth', 'email_link', 'phone_number', 'ldap', 'saml'])
246
+ return false unless auth_type_validator.valid?(@auth_type)
247
+ auth_second_factor_type_validator = EnumAttributeValidator.new('String', ['none', 'phone_number', 'totp', 'mobile_push', 'security_key', 'fingerprint'])
248
+ return false unless auth_second_factor_type_validator.valid?(@auth_second_factor_type)
249
+ true
250
+ end
251
+
252
+ # Custom attribute writer method checking allowed values (enum).
253
+ # @param [Object] state Object to be assigned
254
+ def state=(state)
255
+ validator = EnumAttributeValidator.new('String', ['pending', 'completed'])
256
+ unless validator.valid?(state)
257
+ fail ArgumentError, 'invalid value for "state", must be one of #{validator.allowable_values}.'
258
+ end
259
+ @state = state
260
+ end
261
+
262
+ # Custom attribute writer method checking allowed values (enum).
263
+ # @param [Object] auth_type Object to be assigned
264
+ def auth_type=(auth_type)
265
+ validator = EnumAttributeValidator.new('String', ['none', 'password', 'oauth', 'email_link', 'phone_number', 'ldap', 'saml'])
266
+ unless validator.valid?(auth_type)
267
+ fail ArgumentError, 'invalid value for "auth_type", must be one of #{validator.allowable_values}.'
268
+ end
269
+ @auth_type = auth_type
270
+ end
271
+
272
+ # Custom attribute writer method checking allowed values (enum).
273
+ # @param [Object] auth_second_factor_type Object to be assigned
274
+ def auth_second_factor_type=(auth_second_factor_type)
275
+ validator = EnumAttributeValidator.new('String', ['none', 'phone_number', 'totp', 'mobile_push', 'security_key', 'fingerprint'])
276
+ unless validator.valid?(auth_second_factor_type)
277
+ fail ArgumentError, 'invalid value for "auth_second_factor_type", must be one of #{validator.allowable_values}.'
278
+ end
279
+ @auth_second_factor_type = auth_second_factor_type
280
+ end
281
+
282
+ # Checks equality by comparing each attribute.
283
+ # @param [Object] Object to be compared
284
+ def ==(o)
285
+ return true if self.equal?(o)
286
+ self.class == o.class &&
287
+ id == o.id &&
288
+ name == o.name &&
289
+ email == o.email &&
290
+ order == o.order &&
291
+ fields == o.fields &&
292
+ metadata == o.metadata &&
293
+ state == o.state &&
294
+ viewed_at == o.viewed_at &&
295
+ completed_at == o.completed_at &&
296
+ auth_type == o.auth_type &&
297
+ auth_second_factor_type == o.auth_second_factor_type &&
298
+ auth_provider == o.auth_provider &&
299
+ auth_session_started_at == o.auth_session_started_at &&
300
+ auth_session_id_hash == o.auth_session_id_hash &&
301
+ auth_user_id_hash == o.auth_user_id_hash &&
302
+ auth_username_hash == o.auth_username_hash &&
303
+ auth_phone_number_hash == o.auth_phone_number_hash
304
+ end
305
+
306
+ # @see the `==` method
307
+ # @param [Object] Object to be compared
308
+ def eql?(o)
309
+ self == o
310
+ end
311
+
312
+ # Calculates hash code according to all attributes.
313
+ # @return [Fixnum] Hash code
314
+ 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
316
+ end
317
+
318
+ # Builds the object from hash
319
+ # @param [Hash] attributes Model attributes in the form of hash
320
+ # @return [Object] Returns the model itself
321
+ def build_from_hash(attributes)
322
+ return nil unless attributes.is_a?(Hash)
323
+ self.class.openapi_types.each_pair do |key, type|
324
+ if type =~ /\AArray<(.*)>/i
325
+ # check to ensure the input is an array given that the the attribute
326
+ # is documented as an array but the input is not
327
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
328
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
329
+ end
330
+ elsif !attributes[self.class.attribute_map[key]].nil?
331
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
332
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
333
+ end
334
+
335
+ self
336
+ end
337
+
338
+ # Deserializes the data based on type
339
+ # @param string type Data type
340
+ # @param string value Value to be deserialized
341
+ # @return [Object] Deserialized data
342
+ def _deserialize(type, value)
343
+ case type.to_sym
344
+ when :DateTime
345
+ DateTime.parse(value)
346
+ when :Date
347
+ Date.parse(value)
348
+ when :String
349
+ value.to_s
350
+ when :Integer
351
+ value.to_i
352
+ when :Float
353
+ value.to_f
354
+ when :BOOLEAN
355
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
356
+ true
357
+ else
358
+ false
359
+ end
360
+ when :Object
361
+ # generic object (usually a Hash), return directly
362
+ value
363
+ when /\AArray<(?<inner_type>.+)>\z/
364
+ inner_type = Regexp.last_match[:inner_type]
365
+ value.map { |v| _deserialize(inner_type, v) }
366
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
367
+ k_type = Regexp.last_match[:k_type]
368
+ v_type = Regexp.last_match[:v_type]
369
+ {}.tap do |hash|
370
+ value.each do |k, v|
371
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
372
+ end
373
+ end
374
+ else # model
375
+ temp_model = DocSpring.const_get(type).new
376
+ temp_model.build_from_hash(value)
377
+ end
378
+ end
379
+
380
+ # Returns the string representation of the object
381
+ # @return [String] String presentation of the object
382
+ def to_s
383
+ to_hash.to_s
384
+ end
385
+
386
+ # to_body is an alias to to_hash (backward compatibility)
387
+ # @return [Hash] Returns the object in the form of hash
388
+ def to_body
389
+ to_hash
390
+ end
391
+
392
+ # Returns the object in the form of hash
393
+ # @return [Hash] Returns the object in the form of hash
394
+ def to_hash
395
+ hash = {}
396
+ self.class.attribute_map.each_pair do |attr, param|
397
+ value = self.send(attr)
398
+ next if value.nil?
399
+ hash[param] = _to_hash(value)
400
+ end
401
+ hash
402
+ end
403
+
404
+ # Outputs non-array value in the form of hash
405
+ # For object, use to_hash. Otherwise, just return the value
406
+ # @param [Object] value Any valid value
407
+ # @return [Hash] Returns the value in the form of hash
408
+ def _to_hash(value)
409
+ if value.is_a?(Array)
410
+ value.compact.map { |v| _to_hash(v) }
411
+ elsif value.is_a?(Hash)
412
+ {}.tap do |hash|
413
+ value.each { |k, v| hash[k] = _to_hash(v) }
414
+ end
415
+ elsif value.respond_to? :to_hash
416
+ value.to_hash
417
+ else
418
+ value
419
+ end
420
+ end
421
+ end
422
+ end