docspring 1.1.0 → 1.3.2
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 +20 -0
- data/Gemfile.lock +1 -1
- data/LICENSE +1 -1
- data/README.md +22 -15
- data/docs/AddFieldsData.md +8 -0
- data/docs/AddFieldsTemplateResponse.md +10 -0
- data/docs/CombinePdfsData.md +4 -4
- data/docs/CombinedSubmissionData.md +3 -3
- data/docs/CopyTemplateData.md +9 -0
- data/docs/CreateHtmlTemplateData.md +8 -0
- data/docs/CreateSubmissionDataRequestData.md +2 -2
- data/docs/CreateTemplateFromUploadData.md +8 -0
- data/docs/{TemplatesdesccachedUploadTemplate.md → HtmlTemplateData.md} +3 -4
- data/docs/MoveTemplateData.md +1 -1
- data/docs/PDFApi.md +113 -9
- data/docs/PendingTemplate.md +1 -0
- data/docs/Submission.md +4 -0
- data/docs/SubmissionBatchData.md +2 -2
- data/docs/SubmissionData.md +4 -4
- data/docs/SubmissionDataBatchRequest.md +2 -2
- data/docs/SubmissionDataRequest.md +1 -0
- data/docs/Template.md +1 -0
- data/docs/{TemplatestemplateIdTemplate.md → TemplateData.md} +3 -3
- data/docs/TemplatestemplateIdaddFieldsFields.md +92 -0
- data/docs/UpdateSubmissionDataRequestData.md +9 -9
- data/docs/UpdateTemplateData.md +1 -1
- data/docs/UploadTemplateData.md +25 -0
- data/docs/UploadTemplateDataDocument.md +10 -0
- data/docs/{TemplatesdesccachedUploadTemplateDocumentMetadata.md → UploadTemplateDataDocumentMetadata.md} +1 -1
- data/docspring.gemspec +2 -2
- data/lib/docspring.rb +12 -7
- data/lib/docspring/api/pdf_api.rb +137 -19
- 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 +1 -1
- data/lib/docspring/models/combined_submission_action.rb +1 -6
- data/lib/docspring/models/combined_submission_data.rb +23 -23
- data/lib/docspring/models/copy_template_data.rb +197 -0
- 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_data1.rb → create_template_from_upload_data.rb} +3 -3
- 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 +6 -1
- data/lib/docspring/models/pending_template.rb +11 -2
- data/lib/docspring/models/rename_folder_data.rb +1 -1
- data/lib/docspring/models/submission.rb +41 -5
- 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 -34
- data/lib/docspring/models/submission_data_batch_request.rb +20 -20
- data/lib/docspring/models/submission_data_request.rb +14 -15
- data/lib/docspring/models/template.rb +11 -2
- data/lib/docspring/models/{templatestemplate_id_template.rb → template_data.rb} +21 -21
- 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 +2 -2
- data/lib/docspring/models/update_template_response.rb +1 -1
- data/lib/docspring/models/{templatesdesccached_upload_template.rb → upload_template_data.rb} +22 -22
- data/lib/docspring/models/{templatesdesccached_upload_template_document.rb → upload_template_data_document.rb} +3 -3
- data/lib/docspring/models/{templatesdesccached_upload_template_document_metadata.rb → upload_template_data_document_metadata.rb} +2 -2
- data/lib/docspring/version.rb +2 -2
- data/spec/api/pdf_api_integration_spec.rb +49 -18
- data/spec/api/pdf_api_spec_original.skipped.rb +36 -8
- 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 +1 -1
- data/spec/models/copy_template_data_spec.rb +47 -0
- 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_template_data_spec.rb → create_html_template_data_spec.rb} +7 -7
- 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_data1_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 +7 -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 +7 -1
- data/spec/models/submission_data_spec.rb +7 -7
- data/spec/models/submission_spec.rb +25 -1
- data/spec/models/{templatestemplate_id_template_spec.rb → template_data_spec.rb} +11 -11
- data/spec/models/template_spec.rb +7 -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 +1 -1
- data/spec/models/update_template_response_spec.rb +1 -1
- data/spec/models/{templatesdesccached_upload_template_document_metadata_spec.rb → upload_template_data_document_metadata_spec.rb} +7 -7
- data/spec/models/{templatesdesccached_upload_template_document_spec.rb → upload_template_data_document_spec.rb} +7 -7
- data/spec/models/{templatesdesccached_upload_template_spec.rb → upload_template_data_spec.rb} +12 -12
- data/spec/spec_helper.rb +1 -1
- metadata +50 -30
- data/docs/CreateTemplateData.md +0 -8
- data/docs/CreateTemplateData1.md +0 -8
- data/docs/TemplatesdesccachedUploadTemplateDocument.md +0 -10
@@ -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,35 +14,35 @@ require 'date'
|
|
14
14
|
|
15
15
|
module DocSpring
|
16
16
|
class CombinePdfsData
|
17
|
-
attr_accessor :
|
17
|
+
attr_accessor :delete_custom_files
|
18
18
|
|
19
|
-
attr_accessor :
|
19
|
+
attr_accessor :expires_in
|
20
20
|
|
21
21
|
attr_accessor :metadata
|
22
22
|
|
23
|
-
attr_accessor :
|
23
|
+
attr_accessor :source_pdfs
|
24
24
|
|
25
|
-
attr_accessor :
|
25
|
+
attr_accessor :test
|
26
26
|
|
27
27
|
# Attribute mapping from ruby-style variable name to JSON key.
|
28
28
|
def self.attribute_map
|
29
29
|
{
|
30
|
-
:'
|
31
|
-
:'source_pdfs' => :'source_pdfs',
|
32
|
-
:'metadata' => :'metadata',
|
30
|
+
:'delete_custom_files' => :'delete_custom_files',
|
33
31
|
:'expires_in' => :'expires_in',
|
34
|
-
:'
|
32
|
+
:'metadata' => :'metadata',
|
33
|
+
:'source_pdfs' => :'source_pdfs',
|
34
|
+
:'test' => :'test'
|
35
35
|
}
|
36
36
|
end
|
37
37
|
|
38
38
|
# Attribute type mapping.
|
39
39
|
def self.openapi_types
|
40
40
|
{
|
41
|
-
:'
|
42
|
-
:'source_pdfs' => :'Array<Object>',
|
43
|
-
:'metadata' => :'Object',
|
41
|
+
:'delete_custom_files' => :'BOOLEAN',
|
44
42
|
:'expires_in' => :'Integer',
|
45
|
-
:'
|
43
|
+
:'metadata' => :'Object',
|
44
|
+
:'source_pdfs' => :'Array<Object>',
|
45
|
+
:'test' => :'BOOLEAN'
|
46
46
|
}
|
47
47
|
end
|
48
48
|
|
@@ -54,26 +54,26 @@ module DocSpring
|
|
54
54
|
# convert string to symbol for hash key
|
55
55
|
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
56
56
|
|
57
|
-
if attributes.has_key?(:'
|
58
|
-
self.
|
57
|
+
if attributes.has_key?(:'delete_custom_files')
|
58
|
+
self.delete_custom_files = attributes[:'delete_custom_files']
|
59
59
|
end
|
60
60
|
|
61
|
-
if attributes.has_key?(:'
|
62
|
-
|
63
|
-
self.source_pdfs = value
|
64
|
-
end
|
61
|
+
if attributes.has_key?(:'expires_in')
|
62
|
+
self.expires_in = attributes[:'expires_in']
|
65
63
|
end
|
66
64
|
|
67
65
|
if attributes.has_key?(:'metadata')
|
68
66
|
self.metadata = attributes[:'metadata']
|
69
67
|
end
|
70
68
|
|
71
|
-
if attributes.has_key?(:'
|
72
|
-
|
69
|
+
if attributes.has_key?(:'source_pdfs')
|
70
|
+
if (value = attributes[:'source_pdfs']).is_a?(Array)
|
71
|
+
self.source_pdfs = value
|
72
|
+
end
|
73
73
|
end
|
74
74
|
|
75
|
-
if attributes.has_key?(:'
|
76
|
-
self.
|
75
|
+
if attributes.has_key?(:'test')
|
76
|
+
self.test = attributes[:'test']
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
@@ -100,11 +100,11 @@ module DocSpring
|
|
100
100
|
def ==(o)
|
101
101
|
return true if self.equal?(o)
|
102
102
|
self.class == o.class &&
|
103
|
-
|
104
|
-
source_pdfs == o.source_pdfs &&
|
105
|
-
metadata == o.metadata &&
|
103
|
+
delete_custom_files == o.delete_custom_files &&
|
106
104
|
expires_in == o.expires_in &&
|
107
|
-
|
105
|
+
metadata == o.metadata &&
|
106
|
+
source_pdfs == o.source_pdfs &&
|
107
|
+
test == o.test
|
108
108
|
end
|
109
109
|
|
110
110
|
# @see the `==` method
|
@@ -116,7 +116,7 @@ module DocSpring
|
|
116
116
|
# Calculates hash code according to all attributes.
|
117
117
|
# @return [Fixnum] Hash code
|
118
118
|
def hash
|
119
|
-
[
|
119
|
+
[delete_custom_files, expires_in, metadata, source_pdfs, test].hash
|
120
120
|
end
|
121
121
|
|
122
122
|
# Builds the object from hash
|
@@ -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
|
|
@@ -113,10 +113,6 @@ module DocSpring
|
|
113
113
|
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
114
114
|
end
|
115
115
|
|
116
|
-
if @integration_id.nil?
|
117
|
-
invalid_properties.push('invalid value for "integration_id", integration_id cannot be nil.')
|
118
|
-
end
|
119
|
-
|
120
116
|
if @state.nil?
|
121
117
|
invalid_properties.push('invalid value for "state", state cannot be nil.')
|
122
118
|
end
|
@@ -140,7 +136,6 @@ module DocSpring
|
|
140
136
|
# @return true if the model is valid
|
141
137
|
def valid?
|
142
138
|
return false if @id.nil?
|
143
|
-
return false if @integration_id.nil?
|
144
139
|
return false if @state.nil?
|
145
140
|
state_validator = EnumAttributeValidator.new('String', ['pending', 'processed', 'failed', 'error'])
|
146
141
|
return false unless state_validator.valid?(@state)
|
@@ -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 CombinedSubmissionData
|
17
|
-
attr_accessor :
|
18
|
-
|
19
|
-
attr_accessor :submission_ids
|
17
|
+
attr_accessor :expires_in
|
20
18
|
|
21
19
|
attr_accessor :metadata
|
22
20
|
|
23
|
-
attr_accessor :
|
21
|
+
attr_accessor :submission_ids
|
22
|
+
|
23
|
+
attr_accessor :test
|
24
24
|
|
25
25
|
# Attribute mapping from ruby-style variable name to JSON key.
|
26
26
|
def self.attribute_map
|
27
27
|
{
|
28
|
-
:'
|
29
|
-
:'submission_ids' => :'submission_ids',
|
28
|
+
:'expires_in' => :'expires_in',
|
30
29
|
:'metadata' => :'metadata',
|
31
|
-
:'
|
30
|
+
:'submission_ids' => :'submission_ids',
|
31
|
+
:'test' => :'test'
|
32
32
|
}
|
33
33
|
end
|
34
34
|
|
35
35
|
# Attribute type mapping.
|
36
36
|
def self.openapi_types
|
37
37
|
{
|
38
|
-
:'
|
39
|
-
:'submission_ids' => :'Array<String>',
|
38
|
+
:'expires_in' => :'Integer',
|
40
39
|
:'metadata' => :'Object',
|
41
|
-
:'
|
40
|
+
:'submission_ids' => :'Array<String>',
|
41
|
+
:'test' => :'BOOLEAN'
|
42
42
|
}
|
43
43
|
end
|
44
44
|
|
@@ -50,8 +50,12 @@ module DocSpring
|
|
50
50
|
# convert string to symbol for hash key
|
51
51
|
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
52
52
|
|
53
|
-
if attributes.has_key?(:'
|
54
|
-
self.
|
53
|
+
if attributes.has_key?(:'expires_in')
|
54
|
+
self.expires_in = attributes[:'expires_in']
|
55
|
+
end
|
56
|
+
|
57
|
+
if attributes.has_key?(:'metadata')
|
58
|
+
self.metadata = attributes[:'metadata']
|
55
59
|
end
|
56
60
|
|
57
61
|
if attributes.has_key?(:'submission_ids')
|
@@ -60,12 +64,8 @@ module DocSpring
|
|
60
64
|
end
|
61
65
|
end
|
62
66
|
|
63
|
-
if attributes.has_key?(:'
|
64
|
-
self.
|
65
|
-
end
|
66
|
-
|
67
|
-
if attributes.has_key?(:'expires_in')
|
68
|
-
self.expires_in = attributes[:'expires_in']
|
67
|
+
if attributes.has_key?(:'test')
|
68
|
+
self.test = attributes[:'test']
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
@@ -92,10 +92,10 @@ module DocSpring
|
|
92
92
|
def ==(o)
|
93
93
|
return true if self.equal?(o)
|
94
94
|
self.class == o.class &&
|
95
|
-
|
96
|
-
submission_ids == o.submission_ids &&
|
95
|
+
expires_in == o.expires_in &&
|
97
96
|
metadata == o.metadata &&
|
98
|
-
|
97
|
+
submission_ids == o.submission_ids &&
|
98
|
+
test == o.test
|
99
99
|
end
|
100
100
|
|
101
101
|
# @see the `==` method
|
@@ -107,7 +107,7 @@ module DocSpring
|
|
107
107
|
# Calculates hash code according to all attributes.
|
108
108
|
# @return [Fixnum] Hash code
|
109
109
|
def hash
|
110
|
-
[
|
110
|
+
[expires_in, metadata, submission_ids, test].hash
|
111
111
|
end
|
112
112
|
|
113
113
|
# Builds the object from hash
|
@@ -0,0 +1,197 @@
|
|
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 CopyTemplateData
|
17
|
+
attr_accessor :name
|
18
|
+
|
19
|
+
attr_accessor :parent_folder_id
|
20
|
+
|
21
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
22
|
+
def self.attribute_map
|
23
|
+
{
|
24
|
+
:'name' => :'name',
|
25
|
+
:'parent_folder_id' => :'parent_folder_id'
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
# Attribute type mapping.
|
30
|
+
def self.openapi_types
|
31
|
+
{
|
32
|
+
:'name' => :'String',
|
33
|
+
:'parent_folder_id' => :'String'
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
# Initializes the object
|
38
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
39
|
+
def initialize(attributes = {})
|
40
|
+
return unless attributes.is_a?(Hash)
|
41
|
+
|
42
|
+
# convert string to symbol for hash key
|
43
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
44
|
+
|
45
|
+
if attributes.has_key?(:'name')
|
46
|
+
self.name = attributes[:'name']
|
47
|
+
end
|
48
|
+
|
49
|
+
if attributes.has_key?(:'parent_folder_id')
|
50
|
+
self.parent_folder_id = attributes[:'parent_folder_id']
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
55
|
+
# @return Array for valid properties with the reasons
|
56
|
+
def list_invalid_properties
|
57
|
+
invalid_properties = Array.new
|
58
|
+
if @parent_folder_id.nil?
|
59
|
+
invalid_properties.push('invalid value for "parent_folder_id", parent_folder_id cannot be nil.')
|
60
|
+
end
|
61
|
+
|
62
|
+
invalid_properties
|
63
|
+
end
|
64
|
+
|
65
|
+
# Check to see if the all the properties in the model are valid
|
66
|
+
# @return true if the model is valid
|
67
|
+
def valid?
|
68
|
+
return false if @parent_folder_id.nil?
|
69
|
+
true
|
70
|
+
end
|
71
|
+
|
72
|
+
# Checks equality by comparing each attribute.
|
73
|
+
# @param [Object] Object to be compared
|
74
|
+
def ==(o)
|
75
|
+
return true if self.equal?(o)
|
76
|
+
self.class == o.class &&
|
77
|
+
name == o.name &&
|
78
|
+
parent_folder_id == o.parent_folder_id
|
79
|
+
end
|
80
|
+
|
81
|
+
# @see the `==` method
|
82
|
+
# @param [Object] Object to be compared
|
83
|
+
def eql?(o)
|
84
|
+
self == o
|
85
|
+
end
|
86
|
+
|
87
|
+
# Calculates hash code according to all attributes.
|
88
|
+
# @return [Fixnum] Hash code
|
89
|
+
def hash
|
90
|
+
[name, parent_folder_id].hash
|
91
|
+
end
|
92
|
+
|
93
|
+
# Builds the object from hash
|
94
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
95
|
+
# @return [Object] Returns the model itself
|
96
|
+
def build_from_hash(attributes)
|
97
|
+
return nil unless attributes.is_a?(Hash)
|
98
|
+
self.class.openapi_types.each_pair do |key, type|
|
99
|
+
if type =~ /\AArray<(.*)>/i
|
100
|
+
# check to ensure the input is an array given that the the attribute
|
101
|
+
# is documented as an array but the input is not
|
102
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
103
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
104
|
+
end
|
105
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
106
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
107
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
108
|
+
end
|
109
|
+
|
110
|
+
self
|
111
|
+
end
|
112
|
+
|
113
|
+
# Deserializes the data based on type
|
114
|
+
# @param string type Data type
|
115
|
+
# @param string value Value to be deserialized
|
116
|
+
# @return [Object] Deserialized data
|
117
|
+
def _deserialize(type, value)
|
118
|
+
case type.to_sym
|
119
|
+
when :DateTime
|
120
|
+
DateTime.parse(value)
|
121
|
+
when :Date
|
122
|
+
Date.parse(value)
|
123
|
+
when :String
|
124
|
+
value.to_s
|
125
|
+
when :Integer
|
126
|
+
value.to_i
|
127
|
+
when :Float
|
128
|
+
value.to_f
|
129
|
+
when :BOOLEAN
|
130
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
131
|
+
true
|
132
|
+
else
|
133
|
+
false
|
134
|
+
end
|
135
|
+
when :Object
|
136
|
+
# generic object (usually a Hash), return directly
|
137
|
+
value
|
138
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
139
|
+
inner_type = Regexp.last_match[:inner_type]
|
140
|
+
value.map { |v| _deserialize(inner_type, v) }
|
141
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
142
|
+
k_type = Regexp.last_match[:k_type]
|
143
|
+
v_type = Regexp.last_match[:v_type]
|
144
|
+
{}.tap do |hash|
|
145
|
+
value.each do |k, v|
|
146
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
147
|
+
end
|
148
|
+
end
|
149
|
+
else # model
|
150
|
+
temp_model = DocSpring.const_get(type).new
|
151
|
+
temp_model.build_from_hash(value)
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
# Returns the string representation of the object
|
156
|
+
# @return [String] String presentation of the object
|
157
|
+
def to_s
|
158
|
+
to_hash.to_s
|
159
|
+
end
|
160
|
+
|
161
|
+
# to_body is an alias to to_hash (backward compatibility)
|
162
|
+
# @return [Hash] Returns the object in the form of hash
|
163
|
+
def to_body
|
164
|
+
to_hash
|
165
|
+
end
|
166
|
+
|
167
|
+
# Returns the object in the form of hash
|
168
|
+
# @return [Hash] Returns the object in the form of hash
|
169
|
+
def to_hash
|
170
|
+
hash = {}
|
171
|
+
self.class.attribute_map.each_pair do |attr, param|
|
172
|
+
value = self.send(attr)
|
173
|
+
next if value.nil?
|
174
|
+
hash[param] = _to_hash(value)
|
175
|
+
end
|
176
|
+
hash
|
177
|
+
end
|
178
|
+
|
179
|
+
# Outputs non-array value in the form of hash
|
180
|
+
# For object, use to_hash. Otherwise, just return the value
|
181
|
+
# @param [Object] value Any valid value
|
182
|
+
# @return [Hash] Returns the value in the form of hash
|
183
|
+
def _to_hash(value)
|
184
|
+
if value.is_a?(Array)
|
185
|
+
value.compact.map { |v| _to_hash(v) }
|
186
|
+
elsif value.is_a?(Hash)
|
187
|
+
{}.tap do |hash|
|
188
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
189
|
+
end
|
190
|
+
elsif value.respond_to? :to_hash
|
191
|
+
value.to_hash
|
192
|
+
else
|
193
|
+
value
|
194
|
+
end
|
195
|
+
end
|
196
|
+
end
|
197
|
+
end
|