docspring 1.0.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.openapi-generator/VERSION +1 -1
- data/CHANGELOG.md +14 -37
- data/Gemfile +2 -1
- data/Gemfile.lock +37 -32
- data/LICENSE +1 -1
- data/README.md +26 -15
- data/docs/AddFieldsData.md +8 -0
- data/docs/AddFieldsTemplateResponse.md +10 -0
- data/docs/CombinePdfsData.md +4 -4
- data/docs/CombinedSubmission.md +1 -0
- data/docs/CombinedSubmissionData.md +3 -3
- data/docs/{CreateTemplateData.md → CreateHtmlTemplateData.md} +2 -2
- data/docs/CreateSubmissionDataRequestData.md +2 -2
- data/docs/CreateTemplateFromUploadData.md +8 -0
- data/docs/HtmlTemplateData.md +24 -0
- data/docs/PDFApi.md +169 -15
- data/docs/PendingTemplate.md +2 -0
- data/docs/Submission.md +5 -0
- data/docs/SubmissionBatchData.md +2 -2
- data/docs/SubmissionData.md +4 -3
- data/docs/SubmissionDataBatchRequest.md +2 -2
- data/docs/SubmissionDataRequest.md +2 -0
- data/docs/Template.md +2 -0
- data/docs/{Templatesv2Template.md → TemplateData.md} +11 -7
- data/docs/TemplatestemplateIdaddFieldsFields.md +92 -0
- data/docs/UpdateSubmissionDataRequestData.md +9 -9
- data/docs/UpdateTemplateData.md +8 -0
- data/docs/UpdateTemplateResponse.md +9 -0
- data/docs/UploadTemplateData.md +25 -0
- data/docs/{Templatesv2TemplateDocument.md → UploadTemplateDataDocument.md} +2 -2
- data/docs/{Templatesv2TemplateDocumentMetadata.md → UploadTemplateDataDocumentMetadata.md} +1 -1
- data/docspring.gemspec +3 -3
- data/lib/docspring.rb +13 -5
- data/lib/docspring/api/pdf_api.rb +193 -22
- data/lib/docspring/api_client.rb +1 -1
- data/lib/docspring/api_error.rb +1 -1
- data/lib/docspring/configuration.rb +1 -1
- data/lib/docspring/models/add_fields_data.rb +190 -0
- data/lib/docspring/models/add_fields_template_response.rb +239 -0
- data/lib/docspring/models/authentication_error.rb +1 -1
- data/lib/docspring/models/authentication_success_response.rb +1 -1
- data/lib/docspring/models/combine_pdfs_data.rb +28 -28
- data/lib/docspring/models/combined_submission.rb +11 -2
- data/lib/docspring/models/combined_submission_action.rb +1 -6
- data/lib/docspring/models/combined_submission_data.rb +23 -23
- data/lib/docspring/models/create_combined_submission_response.rb +1 -1
- data/lib/docspring/models/create_custom_file_data.rb +1 -1
- data/lib/docspring/models/create_custom_file_response.rb +1 -1
- data/lib/docspring/models/create_folder_data.rb +1 -1
- data/lib/docspring/models/{create_template_data.rb → create_html_template_data.rb} +3 -3
- data/lib/docspring/models/create_submission_batch_response.rb +1 -1
- data/lib/docspring/models/create_submission_batch_submissions_response.rb +1 -1
- data/lib/docspring/models/create_submission_data_request_data.rb +20 -20
- data/lib/docspring/models/create_submission_data_request_token_response.rb +1 -1
- data/lib/docspring/models/create_submission_data_request_token_response_token.rb +1 -1
- data/lib/docspring/models/create_submission_response.rb +1 -1
- data/lib/docspring/models/create_template_from_upload_data.rb +188 -0
- data/lib/docspring/models/custom_file.rb +1 -1
- data/lib/docspring/models/error.rb +1 -1
- data/lib/docspring/models/folder.rb +1 -1
- data/lib/docspring/models/folders_folder.rb +1 -1
- data/lib/docspring/models/html_template_data.rb +373 -0
- data/lib/docspring/models/invalid_request.rb +1 -1
- data/lib/docspring/models/move_folder_data.rb +1 -1
- data/lib/docspring/models/move_template_data.rb +1 -1
- data/lib/docspring/models/pending_template.rb +20 -2
- data/lib/docspring/models/rename_folder_data.rb +1 -1
- data/lib/docspring/models/submission.rb +52 -7
- data/lib/docspring/models/submission_action.rb +1 -6
- data/lib/docspring/models/submission_batch.rb +1 -1
- data/lib/docspring/models/submission_batch_data.rb +16 -16
- data/lib/docspring/models/submission_data.rb +34 -25
- data/lib/docspring/models/submission_data_batch_request.rb +20 -20
- data/lib/docspring/models/submission_data_request.rb +23 -20
- data/lib/docspring/models/template.rb +20 -2
- data/lib/docspring/models/{templatesv2_template.rb → template_data.rb} +81 -45
- data/lib/docspring/models/templatestemplate_idadd_fields_fields.rb +1306 -0
- data/lib/docspring/models/update_data_request_response.rb +1 -1
- data/lib/docspring/models/update_submission_data_request_data.rb +79 -79
- data/lib/docspring/models/update_template_data.rb +188 -0
- data/lib/docspring/models/update_template_response.rb +228 -0
- data/lib/docspring/models/upload_template_data.rb +382 -0
- data/lib/docspring/models/{templatesv2_template_document.rb → upload_template_data_document.rb} +3 -3
- data/lib/docspring/models/{templatesv2_template_document_metadata.rb → upload_template_data_document_metadata.rb} +2 -2
- data/lib/docspring/version.rb +2 -2
- data/spec/api/client_integration_spec.rb +14 -2
- data/spec/api/pdf_api_integration_spec.rb +49 -18
- data/spec/api/pdf_api_spec_original.skipped.rb +51 -11
- data/spec/api_client_spec.rb +1 -1
- data/spec/configuration_spec.rb +1 -1
- data/spec/models/add_fields_data_spec.rb +41 -0
- data/spec/models/add_fields_template_response_spec.rb +57 -0
- data/spec/models/authentication_error_spec.rb +1 -1
- data/spec/models/authentication_success_response_spec.rb +1 -1
- data/spec/models/combine_pdfs_data_spec.rb +5 -5
- data/spec/models/combined_submission_action_spec.rb +1 -1
- data/spec/models/combined_submission_data_spec.rb +5 -5
- data/spec/models/combined_submission_spec.rb +7 -1
- data/spec/models/create_combined_submission_response_spec.rb +1 -1
- data/spec/models/create_custom_file_data_spec.rb +1 -1
- data/spec/models/create_custom_file_response_spec.rb +1 -1
- data/spec/models/create_folder_data_spec.rb +1 -1
- data/spec/models/create_html_template_data_spec.rb +41 -0
- data/spec/models/create_submission_batch_response_spec.rb +1 -1
- data/spec/models/create_submission_batch_submissions_response_spec.rb +1 -1
- data/spec/models/create_submission_data_request_data_spec.rb +9 -9
- data/spec/models/create_submission_data_request_token_response_spec.rb +1 -1
- data/spec/models/create_submission_data_request_token_response_token_spec.rb +1 -1
- data/spec/models/create_submission_response_spec.rb +1 -1
- data/spec/models/{create_template_data_spec.rb → create_template_from_upload_data_spec.rb} +7 -7
- data/spec/models/custom_file_spec.rb +1 -1
- data/spec/models/error_spec.rb +1 -1
- data/spec/models/folder_spec.rb +1 -1
- data/spec/models/folders_folder_spec.rb +1 -1
- data/spec/models/html_template_data_spec.rb +145 -0
- data/spec/models/invalid_request_spec.rb +1 -1
- data/spec/models/move_folder_data_spec.rb +1 -1
- data/spec/models/move_template_data_spec.rb +1 -1
- data/spec/models/pending_template_spec.rb +13 -1
- data/spec/models/rename_folder_data_spec.rb +1 -1
- data/spec/models/submission_action_spec.rb +1 -1
- data/spec/models/submission_batch_data_spec.rb +3 -3
- data/spec/models/submission_batch_spec.rb +1 -1
- data/spec/models/submission_data_batch_request_spec.rb +5 -5
- data/spec/models/submission_data_request_spec.rb +13 -1
- data/spec/models/submission_data_spec.rb +11 -5
- data/spec/models/submission_spec.rb +32 -2
- data/spec/models/{templatesv2_template_spec.rb → template_data_spec.rb} +40 -16
- data/spec/models/template_spec.rb +13 -1
- data/spec/models/templatestemplate_idadd_fields_fields_spec.rb +589 -0
- data/spec/models/update_data_request_response_spec.rb +1 -1
- data/spec/models/update_submission_data_request_data_spec.rb +17 -17
- data/spec/models/update_template_data_spec.rb +41 -0
- data/spec/models/update_template_response_spec.rb +51 -0
- data/spec/models/{templatesv2_template_document_metadata_spec.rb → upload_template_data_document_metadata_spec.rb} +7 -7
- data/spec/models/{templatesv2_template_document_spec.rb → upload_template_data_document_spec.rb} +7 -7
- data/spec/models/upload_template_data_spec.rb +151 -0
- data/spec/spec_helper.rb +1 -1
- metadata +60 -32
- data/.swagger-codegen-ignore +0 -31
- data/.swagger-codegen/VERSION +0 -1
- data/.swagger-revision +0 -1
- data/.travis.yml +0 -8
@@ -6,7 +6,7 @@
|
|
6
6
|
OpenAPI spec version: v1
|
7
7
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version: 3.3.0
|
9
|
+
OpenAPI Generator version: 3.3.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -14,31 +14,31 @@ require 'date'
|
|
14
14
|
|
15
15
|
module DocSpring
|
16
16
|
class UpdateSubmissionDataRequestData
|
17
|
-
attr_accessor :
|
17
|
+
attr_accessor :auth_phone_number_hash
|
18
18
|
|
19
|
-
attr_accessor :
|
19
|
+
attr_accessor :auth_provider
|
20
20
|
|
21
|
-
attr_accessor :
|
21
|
+
attr_accessor :auth_second_factor_type
|
22
22
|
|
23
|
-
attr_accessor :
|
23
|
+
attr_accessor :auth_session_id_hash
|
24
24
|
|
25
|
-
attr_accessor :
|
25
|
+
attr_accessor :auth_session_started_at
|
26
26
|
|
27
27
|
attr_accessor :auth_type
|
28
28
|
|
29
|
-
attr_accessor :
|
29
|
+
attr_accessor :auth_user_id_hash
|
30
30
|
|
31
|
-
attr_accessor :
|
31
|
+
attr_accessor :auth_username_hash
|
32
32
|
|
33
|
-
attr_accessor :
|
33
|
+
attr_accessor :email
|
34
34
|
|
35
|
-
attr_accessor :
|
35
|
+
attr_accessor :fields
|
36
36
|
|
37
|
-
attr_accessor :
|
37
|
+
attr_accessor :metadata
|
38
38
|
|
39
|
-
attr_accessor :
|
39
|
+
attr_accessor :name
|
40
40
|
|
41
|
-
attr_accessor :
|
41
|
+
attr_accessor :order
|
42
42
|
|
43
43
|
class EnumAttributeValidator
|
44
44
|
attr_reader :datatype
|
@@ -65,38 +65,38 @@ module DocSpring
|
|
65
65
|
# Attribute mapping from ruby-style variable name to JSON key.
|
66
66
|
def self.attribute_map
|
67
67
|
{
|
68
|
-
:'
|
69
|
-
:'email' => :'email',
|
70
|
-
:'order' => :'order',
|
71
|
-
:'fields' => :'fields',
|
72
|
-
:'metadata' => :'metadata',
|
73
|
-
:'auth_type' => :'auth_type',
|
74
|
-
:'auth_second_factor_type' => :'auth_second_factor_type',
|
68
|
+
:'auth_phone_number_hash' => :'auth_phone_number_hash',
|
75
69
|
:'auth_provider' => :'auth_provider',
|
76
|
-
:'
|
70
|
+
:'auth_second_factor_type' => :'auth_second_factor_type',
|
77
71
|
:'auth_session_id_hash' => :'auth_session_id_hash',
|
72
|
+
:'auth_session_started_at' => :'auth_session_started_at',
|
73
|
+
:'auth_type' => :'auth_type',
|
78
74
|
:'auth_user_id_hash' => :'auth_user_id_hash',
|
79
75
|
:'auth_username_hash' => :'auth_username_hash',
|
80
|
-
:'
|
76
|
+
:'email' => :'email',
|
77
|
+
:'fields' => :'fields',
|
78
|
+
:'metadata' => :'metadata',
|
79
|
+
:'name' => :'name',
|
80
|
+
:'order' => :'order'
|
81
81
|
}
|
82
82
|
end
|
83
83
|
|
84
84
|
# Attribute type mapping.
|
85
85
|
def self.openapi_types
|
86
86
|
{
|
87
|
-
:'
|
88
|
-
:'email' => :'String',
|
89
|
-
:'order' => :'Integer',
|
90
|
-
:'fields' => :'Array<String>',
|
91
|
-
:'metadata' => :'Object',
|
92
|
-
:'auth_type' => :'String',
|
93
|
-
:'auth_second_factor_type' => :'String',
|
87
|
+
:'auth_phone_number_hash' => :'String',
|
94
88
|
:'auth_provider' => :'String',
|
95
|
-
:'
|
89
|
+
:'auth_second_factor_type' => :'String',
|
96
90
|
:'auth_session_id_hash' => :'String',
|
91
|
+
:'auth_session_started_at' => :'String',
|
92
|
+
:'auth_type' => :'String',
|
97
93
|
:'auth_user_id_hash' => :'String',
|
98
94
|
:'auth_username_hash' => :'String',
|
99
|
-
:'
|
95
|
+
:'email' => :'String',
|
96
|
+
:'fields' => :'Array<String>',
|
97
|
+
:'metadata' => :'Object',
|
98
|
+
:'name' => :'String',
|
99
|
+
:'order' => :'Integer'
|
100
100
|
}
|
101
101
|
end
|
102
102
|
|
@@ -108,58 +108,58 @@ module DocSpring
|
|
108
108
|
# convert string to symbol for hash key
|
109
109
|
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
110
110
|
|
111
|
-
if attributes.has_key?(:'
|
112
|
-
self.
|
111
|
+
if attributes.has_key?(:'auth_phone_number_hash')
|
112
|
+
self.auth_phone_number_hash = attributes[:'auth_phone_number_hash']
|
113
113
|
end
|
114
114
|
|
115
|
-
if attributes.has_key?(:'
|
116
|
-
self.
|
115
|
+
if attributes.has_key?(:'auth_provider')
|
116
|
+
self.auth_provider = attributes[:'auth_provider']
|
117
117
|
end
|
118
118
|
|
119
|
-
if attributes.has_key?(:'
|
120
|
-
self.
|
119
|
+
if attributes.has_key?(:'auth_second_factor_type')
|
120
|
+
self.auth_second_factor_type = attributes[:'auth_second_factor_type']
|
121
121
|
end
|
122
122
|
|
123
|
-
if attributes.has_key?(:'
|
124
|
-
|
125
|
-
self.fields = value
|
126
|
-
end
|
123
|
+
if attributes.has_key?(:'auth_session_id_hash')
|
124
|
+
self.auth_session_id_hash = attributes[:'auth_session_id_hash']
|
127
125
|
end
|
128
126
|
|
129
|
-
if attributes.has_key?(:'
|
130
|
-
self.
|
127
|
+
if attributes.has_key?(:'auth_session_started_at')
|
128
|
+
self.auth_session_started_at = attributes[:'auth_session_started_at']
|
131
129
|
end
|
132
130
|
|
133
131
|
if attributes.has_key?(:'auth_type')
|
134
132
|
self.auth_type = attributes[:'auth_type']
|
135
133
|
end
|
136
134
|
|
137
|
-
if attributes.has_key?(:'
|
138
|
-
self.
|
135
|
+
if attributes.has_key?(:'auth_user_id_hash')
|
136
|
+
self.auth_user_id_hash = attributes[:'auth_user_id_hash']
|
139
137
|
end
|
140
138
|
|
141
|
-
if attributes.has_key?(:'
|
142
|
-
self.
|
139
|
+
if attributes.has_key?(:'auth_username_hash')
|
140
|
+
self.auth_username_hash = attributes[:'auth_username_hash']
|
143
141
|
end
|
144
142
|
|
145
|
-
if attributes.has_key?(:'
|
146
|
-
self.
|
143
|
+
if attributes.has_key?(:'email')
|
144
|
+
self.email = attributes[:'email']
|
147
145
|
end
|
148
146
|
|
149
|
-
if attributes.has_key?(:'
|
150
|
-
|
147
|
+
if attributes.has_key?(:'fields')
|
148
|
+
if (value = attributes[:'fields']).is_a?(Array)
|
149
|
+
self.fields = value
|
150
|
+
end
|
151
151
|
end
|
152
152
|
|
153
|
-
if attributes.has_key?(:'
|
154
|
-
self.
|
153
|
+
if attributes.has_key?(:'metadata')
|
154
|
+
self.metadata = attributes[:'metadata']
|
155
155
|
end
|
156
156
|
|
157
|
-
if attributes.has_key?(:'
|
158
|
-
self.
|
157
|
+
if attributes.has_key?(:'name')
|
158
|
+
self.name = attributes[:'name']
|
159
159
|
end
|
160
160
|
|
161
|
-
if attributes.has_key?(:'
|
162
|
-
self.
|
161
|
+
if attributes.has_key?(:'order')
|
162
|
+
self.order = attributes[:'order']
|
163
163
|
end
|
164
164
|
end
|
165
165
|
|
@@ -173,23 +173,13 @@ module DocSpring
|
|
173
173
|
# Check to see if the all the properties in the model are valid
|
174
174
|
# @return true if the model is valid
|
175
175
|
def valid?
|
176
|
-
auth_type_validator = EnumAttributeValidator.new('String', ['none', 'password', 'oauth', 'email_link', 'phone_number', 'ldap', 'saml'])
|
177
|
-
return false unless auth_type_validator.valid?(@auth_type)
|
178
176
|
auth_second_factor_type_validator = EnumAttributeValidator.new('String', ['none', 'phone_number', 'totp', 'mobile_push', 'security_key', 'fingerprint'])
|
179
177
|
return false unless auth_second_factor_type_validator.valid?(@auth_second_factor_type)
|
178
|
+
auth_type_validator = EnumAttributeValidator.new('String', ['none', 'password', 'oauth', 'email_link', 'phone_number', 'ldap', 'saml'])
|
179
|
+
return false unless auth_type_validator.valid?(@auth_type)
|
180
180
|
true
|
181
181
|
end
|
182
182
|
|
183
|
-
# Custom attribute writer method checking allowed values (enum).
|
184
|
-
# @param [Object] auth_type Object to be assigned
|
185
|
-
def auth_type=(auth_type)
|
186
|
-
validator = EnumAttributeValidator.new('String', ['none', 'password', 'oauth', 'email_link', 'phone_number', 'ldap', 'saml'])
|
187
|
-
unless validator.valid?(auth_type)
|
188
|
-
fail ArgumentError, 'invalid value for "auth_type", must be one of #{validator.allowable_values}.'
|
189
|
-
end
|
190
|
-
@auth_type = auth_type
|
191
|
-
end
|
192
|
-
|
193
183
|
# Custom attribute writer method checking allowed values (enum).
|
194
184
|
# @param [Object] auth_second_factor_type Object to be assigned
|
195
185
|
def auth_second_factor_type=(auth_second_factor_type)
|
@@ -200,24 +190,34 @@ module DocSpring
|
|
200
190
|
@auth_second_factor_type = auth_second_factor_type
|
201
191
|
end
|
202
192
|
|
193
|
+
# Custom attribute writer method checking allowed values (enum).
|
194
|
+
# @param [Object] auth_type Object to be assigned
|
195
|
+
def auth_type=(auth_type)
|
196
|
+
validator = EnumAttributeValidator.new('String', ['none', 'password', 'oauth', 'email_link', 'phone_number', 'ldap', 'saml'])
|
197
|
+
unless validator.valid?(auth_type)
|
198
|
+
fail ArgumentError, 'invalid value for "auth_type", must be one of #{validator.allowable_values}.'
|
199
|
+
end
|
200
|
+
@auth_type = auth_type
|
201
|
+
end
|
202
|
+
|
203
203
|
# Checks equality by comparing each attribute.
|
204
204
|
# @param [Object] Object to be compared
|
205
205
|
def ==(o)
|
206
206
|
return true if self.equal?(o)
|
207
207
|
self.class == o.class &&
|
208
|
-
|
209
|
-
email == o.email &&
|
210
|
-
order == o.order &&
|
211
|
-
fields == o.fields &&
|
212
|
-
metadata == o.metadata &&
|
213
|
-
auth_type == o.auth_type &&
|
214
|
-
auth_second_factor_type == o.auth_second_factor_type &&
|
208
|
+
auth_phone_number_hash == o.auth_phone_number_hash &&
|
215
209
|
auth_provider == o.auth_provider &&
|
216
|
-
|
210
|
+
auth_second_factor_type == o.auth_second_factor_type &&
|
217
211
|
auth_session_id_hash == o.auth_session_id_hash &&
|
212
|
+
auth_session_started_at == o.auth_session_started_at &&
|
213
|
+
auth_type == o.auth_type &&
|
218
214
|
auth_user_id_hash == o.auth_user_id_hash &&
|
219
215
|
auth_username_hash == o.auth_username_hash &&
|
220
|
-
|
216
|
+
email == o.email &&
|
217
|
+
fields == o.fields &&
|
218
|
+
metadata == o.metadata &&
|
219
|
+
name == o.name &&
|
220
|
+
order == o.order
|
221
221
|
end
|
222
222
|
|
223
223
|
# @see the `==` method
|
@@ -229,7 +229,7 @@ module DocSpring
|
|
229
229
|
# Calculates hash code according to all attributes.
|
230
230
|
# @return [Fixnum] Hash code
|
231
231
|
def hash
|
232
|
-
[
|
232
|
+
[auth_phone_number_hash, auth_provider, auth_second_factor_type, auth_session_id_hash, auth_session_started_at, auth_type, auth_user_id_hash, auth_username_hash, email, fields, metadata, name, order].hash
|
233
233
|
end
|
234
234
|
|
235
235
|
# Builds the object from hash
|
@@ -0,0 +1,188 @@
|
|
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
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module DocSpring
|
16
|
+
class UpdateTemplateData
|
17
|
+
attr_accessor :template
|
18
|
+
|
19
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
20
|
+
def self.attribute_map
|
21
|
+
{
|
22
|
+
:'template' => :'template'
|
23
|
+
}
|
24
|
+
end
|
25
|
+
|
26
|
+
# Attribute type mapping.
|
27
|
+
def self.openapi_types
|
28
|
+
{
|
29
|
+
:'template' => :'TemplateData'
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
# Initializes the object
|
34
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
35
|
+
def initialize(attributes = {})
|
36
|
+
return unless attributes.is_a?(Hash)
|
37
|
+
|
38
|
+
# convert string to symbol for hash key
|
39
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
40
|
+
|
41
|
+
if attributes.has_key?(:'template')
|
42
|
+
self.template = attributes[:'template']
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
47
|
+
# @return Array for valid properties with the reasons
|
48
|
+
def list_invalid_properties
|
49
|
+
invalid_properties = Array.new
|
50
|
+
if @template.nil?
|
51
|
+
invalid_properties.push('invalid value for "template", template cannot be nil.')
|
52
|
+
end
|
53
|
+
|
54
|
+
invalid_properties
|
55
|
+
end
|
56
|
+
|
57
|
+
# Check to see if the all the properties in the model are valid
|
58
|
+
# @return true if the model is valid
|
59
|
+
def valid?
|
60
|
+
return false if @template.nil?
|
61
|
+
true
|
62
|
+
end
|
63
|
+
|
64
|
+
# Checks equality by comparing each attribute.
|
65
|
+
# @param [Object] Object to be compared
|
66
|
+
def ==(o)
|
67
|
+
return true if self.equal?(o)
|
68
|
+
self.class == o.class &&
|
69
|
+
template == o.template
|
70
|
+
end
|
71
|
+
|
72
|
+
# @see the `==` method
|
73
|
+
# @param [Object] Object to be compared
|
74
|
+
def eql?(o)
|
75
|
+
self == o
|
76
|
+
end
|
77
|
+
|
78
|
+
# Calculates hash code according to all attributes.
|
79
|
+
# @return [Fixnum] Hash code
|
80
|
+
def hash
|
81
|
+
[template].hash
|
82
|
+
end
|
83
|
+
|
84
|
+
# Builds the object from hash
|
85
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
86
|
+
# @return [Object] Returns the model itself
|
87
|
+
def build_from_hash(attributes)
|
88
|
+
return nil unless attributes.is_a?(Hash)
|
89
|
+
self.class.openapi_types.each_pair do |key, type|
|
90
|
+
if type =~ /\AArray<(.*)>/i
|
91
|
+
# check to ensure the input is an array given that the the attribute
|
92
|
+
# is documented as an array but the input is not
|
93
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
94
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
95
|
+
end
|
96
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
97
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
98
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
99
|
+
end
|
100
|
+
|
101
|
+
self
|
102
|
+
end
|
103
|
+
|
104
|
+
# Deserializes the data based on type
|
105
|
+
# @param string type Data type
|
106
|
+
# @param string value Value to be deserialized
|
107
|
+
# @return [Object] Deserialized data
|
108
|
+
def _deserialize(type, value)
|
109
|
+
case type.to_sym
|
110
|
+
when :DateTime
|
111
|
+
DateTime.parse(value)
|
112
|
+
when :Date
|
113
|
+
Date.parse(value)
|
114
|
+
when :String
|
115
|
+
value.to_s
|
116
|
+
when :Integer
|
117
|
+
value.to_i
|
118
|
+
when :Float
|
119
|
+
value.to_f
|
120
|
+
when :BOOLEAN
|
121
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
122
|
+
true
|
123
|
+
else
|
124
|
+
false
|
125
|
+
end
|
126
|
+
when :Object
|
127
|
+
# generic object (usually a Hash), return directly
|
128
|
+
value
|
129
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
130
|
+
inner_type = Regexp.last_match[:inner_type]
|
131
|
+
value.map { |v| _deserialize(inner_type, v) }
|
132
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
133
|
+
k_type = Regexp.last_match[:k_type]
|
134
|
+
v_type = Regexp.last_match[:v_type]
|
135
|
+
{}.tap do |hash|
|
136
|
+
value.each do |k, v|
|
137
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
138
|
+
end
|
139
|
+
end
|
140
|
+
else # model
|
141
|
+
temp_model = DocSpring.const_get(type).new
|
142
|
+
temp_model.build_from_hash(value)
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
# Returns the string representation of the object
|
147
|
+
# @return [String] String presentation of the object
|
148
|
+
def to_s
|
149
|
+
to_hash.to_s
|
150
|
+
end
|
151
|
+
|
152
|
+
# to_body is an alias to to_hash (backward compatibility)
|
153
|
+
# @return [Hash] Returns the object in the form of hash
|
154
|
+
def to_body
|
155
|
+
to_hash
|
156
|
+
end
|
157
|
+
|
158
|
+
# Returns the object in the form of hash
|
159
|
+
# @return [Hash] Returns the object in the form of hash
|
160
|
+
def to_hash
|
161
|
+
hash = {}
|
162
|
+
self.class.attribute_map.each_pair do |attr, param|
|
163
|
+
value = self.send(attr)
|
164
|
+
next if value.nil?
|
165
|
+
hash[param] = _to_hash(value)
|
166
|
+
end
|
167
|
+
hash
|
168
|
+
end
|
169
|
+
|
170
|
+
# Outputs non-array value in the form of hash
|
171
|
+
# For object, use to_hash. Otherwise, just return the value
|
172
|
+
# @param [Object] value Any valid value
|
173
|
+
# @return [Hash] Returns the value in the form of hash
|
174
|
+
def _to_hash(value)
|
175
|
+
if value.is_a?(Array)
|
176
|
+
value.compact.map { |v| _to_hash(v) }
|
177
|
+
elsif value.is_a?(Hash)
|
178
|
+
{}.tap do |hash|
|
179
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
180
|
+
end
|
181
|
+
elsif value.respond_to? :to_hash
|
182
|
+
value.to_hash
|
183
|
+
else
|
184
|
+
value
|
185
|
+
end
|
186
|
+
end
|
187
|
+
end
|
188
|
+
end
|