groupdocs_assembly_cloud 20.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +7 -0
  2. data/lib/groupdocs_assembly_cloud.rb +68 -0
  3. data/lib/groupdocs_assembly_cloud/api/assembly_api.rb +1074 -0
  4. data/lib/groupdocs_assembly_cloud/api_client.rb +405 -0
  5. data/lib/groupdocs_assembly_cloud/api_error.rb +54 -0
  6. data/lib/groupdocs_assembly_cloud/configuration.rb +182 -0
  7. data/lib/groupdocs_assembly_cloud/models/assemble_options.rb +237 -0
  8. data/lib/groupdocs_assembly_cloud/models/assembly_api_error_response.rb +217 -0
  9. data/lib/groupdocs_assembly_cloud/models/assembly_response.rb +207 -0
  10. data/lib/groupdocs_assembly_cloud/models/error.rb +237 -0
  11. data/lib/groupdocs_assembly_cloud/models/error_details.rb +222 -0
  12. data/lib/groupdocs_assembly_cloud/models/file_formats_response.rb +237 -0
  13. data/lib/groupdocs_assembly_cloud/models/file_response.rb +197 -0
  14. data/lib/groupdocs_assembly_cloud/models/files_list.rb +209 -0
  15. data/lib/groupdocs_assembly_cloud/models/files_upload_result.rb +221 -0
  16. data/lib/groupdocs_assembly_cloud/models/format.rb +217 -0
  17. data/lib/groupdocs_assembly_cloud/models/format_collection.rb +209 -0
  18. data/lib/groupdocs_assembly_cloud/models/requests/AssembleDocumentRequest.rb +45 -0
  19. data/lib/groupdocs_assembly_cloud/models/requests/CopyFileRequest.rb +61 -0
  20. data/lib/groupdocs_assembly_cloud/models/requests/CopyFolderRequest.rb +57 -0
  21. data/lib/groupdocs_assembly_cloud/models/requests/CreateFolderRequest.rb +49 -0
  22. data/lib/groupdocs_assembly_cloud/models/requests/DeleteFileRequest.rb +53 -0
  23. data/lib/groupdocs_assembly_cloud/models/requests/DeleteFolderRequest.rb +53 -0
  24. data/lib/groupdocs_assembly_cloud/models/requests/DownloadFileRequest.rb +53 -0
  25. data/lib/groupdocs_assembly_cloud/models/requests/GetFilesListRequest.rb +49 -0
  26. data/lib/groupdocs_assembly_cloud/models/requests/GetSupportedFileFormatsRequest.rb +36 -0
  27. data/lib/groupdocs_assembly_cloud/models/requests/MoveFileRequest.rb +61 -0
  28. data/lib/groupdocs_assembly_cloud/models/requests/MoveFolderRequest.rb +57 -0
  29. data/lib/groupdocs_assembly_cloud/models/requests/UploadFileRequest.rb +53 -0
  30. data/lib/groupdocs_assembly_cloud/models/response_error.rb +247 -0
  31. data/lib/groupdocs_assembly_cloud/models/storage_file.rb +257 -0
  32. data/lib/groupdocs_assembly_cloud/models/template_file_info.rb +237 -0
  33. data/lib/groupdocs_assembly_cloud/version.rb +29 -0
  34. metadata +124 -0
@@ -0,0 +1,207 @@
1
+
2
+ require 'date'
3
+
4
+ module GroupDocsAssemblyCloud
5
+ #
6
+ # --------------------------------------------------------------------------------------------------------------------
7
+ # <copyright company="GroupDocs" file="AssemblyResponse.rb">
8
+ # Copyright (c) 2019 GroupDocs.Assembly for Cloud
9
+ # </copyright>
10
+ # <summary>
11
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ # of this software and associated documentation files (the "Software"), to deal
13
+ # in the Software without restriction, including without limitation the rights
14
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ # copies of the Software, and to permit persons to whom the Software is
16
+ # furnished to do so, subject to the following conditions:
17
+ #
18
+ # The above copyright notice and this permission notice shall be included in all
19
+ # copies or substantial portions of the Software.
20
+ #
21
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
+ # SOFTWARE.
28
+ # </summary>
29
+ # --------------------------------------------------------------------------------------------------------------------
30
+ #
31
+
32
+ # Base class for all responses.
33
+ class AssemblyResponse
34
+ # Gets or sets request Id.
35
+ attr_accessor :request_id
36
+
37
+
38
+ # Attribute mapping from ruby-style variable name to JSON key.
39
+ def self.attribute_map
40
+ {
41
+ :'request_id' => :'RequestId'
42
+ }
43
+ end
44
+
45
+ # Attribute type mapping.
46
+ def self.swagger_types
47
+ {
48
+ :'request_id' => :'String'
49
+ }
50
+ end
51
+
52
+ # Initializes the object
53
+ # @param [Hash] attributes Model attributes in the form of hash
54
+ def initialize(attributes = {})
55
+ return unless attributes.is_a?(Hash)
56
+
57
+ # convert string to symbol for hash key
58
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
59
+
60
+ if attributes.key?(:'RequestId')
61
+ self.request_id = attributes[:'RequestId']
62
+ end
63
+
64
+ end
65
+
66
+ # Show invalid properties with the reasons. Usually used together with valid?
67
+ # @return Array for valid properies with the reasons
68
+ def list_invalid_properties
69
+ invalid_properties = []
70
+ return invalid_properties
71
+ end
72
+
73
+ # Check to see if the all the properties in the model are valid
74
+ # @return true if the model is valid
75
+ def valid?
76
+ return true
77
+ end
78
+
79
+ # Checks equality by comparing each attribute.
80
+ # @param [Object] Object to be compared
81
+ def ==(other)
82
+ return true if self.equal?(other)
83
+ self.class == other.class &&
84
+ request_id == other.request_id
85
+ end
86
+
87
+ # @see the `==` method
88
+ # @param [Object] Object to be compared
89
+ def eql?(other)
90
+ self == other
91
+ end
92
+
93
+ # Calculates hash code according to all attributes.
94
+ # @return [Fixnum] Hash code
95
+ def hash
96
+ [request_id].hash
97
+ end
98
+
99
+ # Builds the object from hash
100
+ # @param [Hash] attributes Model attributes in the form of hash
101
+ # @return [Object] Returns the model itself
102
+ def build_from_hash(attributes)
103
+ return nil unless attributes.is_a?(Hash)
104
+ self.class.swagger_types.each_pair do |key, type|
105
+ if type =~ /\AArray<(.*)>/i
106
+ # check to ensure the input is an array given that the the attribute
107
+ # is documented as an array but the input is not
108
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
109
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
110
+ end
111
+ elsif !attributes[self.class.attribute_map[key]].nil?
112
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
113
+ end
114
+ # or else data not found in attributes(hash), not an issue as the data can be optional
115
+ end
116
+
117
+ self
118
+ end
119
+
120
+ # Deserializes the data based on type
121
+ # @param string type Data type
122
+ # @param string value Value to be deserialized
123
+ # @return [Object] Deserialized data
124
+ def _deserialize(type, value)
125
+ case type.to_sym
126
+ when :DateTime
127
+ Time.at(/\d/.match(value)[0].to_f).to_datetime
128
+ when :Date
129
+ Time.at(/\d/.match(value)[0].to_f).to_date
130
+ when :String
131
+ value.to_s
132
+ when :Integer
133
+ value.to_i
134
+ when :Float
135
+ value.to_f
136
+ when :BOOLEAN
137
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
138
+ true
139
+ else
140
+ false
141
+ end
142
+ when :Object
143
+ # generic object (usually a Hash), return directly
144
+ value
145
+ when /\AArray<(?<inner_type>.+)>\z/
146
+ inner_type = Regexp.last_match[:inner_type]
147
+ value.map { |v| _deserialize(inner_type, v) }
148
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
149
+ k_type = Regexp.last_match[:k_type]
150
+ v_type = Regexp.last_match[:v_type]
151
+ {}.tap do |hash|
152
+ value.each do |k, v|
153
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
154
+ end
155
+ end
156
+ else
157
+ # model
158
+ temp_model = GroupDocsAssemblyCloud.const_get(type).new
159
+ temp_model.build_from_hash(value)
160
+ end
161
+ end
162
+
163
+ # Returns the string representation of the object
164
+ # @return [String] String presentation of the object
165
+ def to_s
166
+ to_hash.to_s
167
+ end
168
+
169
+ # to_body is an alias to to_hash (backward compatibility)
170
+ # @return [Hash] Returns the object in the form of hash
171
+ def to_body
172
+ to_hash
173
+ end
174
+
175
+ # Returns the object in the form of hash
176
+ # @return [Hash] Returns the object in the form of hash
177
+ def to_hash
178
+ hash = {}
179
+ self.class.attribute_map.each_pair do |attr, param|
180
+ value = self.send(attr)
181
+ next if value.nil?
182
+ hash[param] = _to_hash(value)
183
+ end
184
+ hash
185
+ end
186
+
187
+ # Outputs non-array value in the form of hash
188
+ # For object, use to_hash. Otherwise, just return the value
189
+ # @param [Object] value Any valid value
190
+ # @return [Hash] Returns the value in the form of hash
191
+ def _to_hash(value)
192
+ if value.is_a?(Array)
193
+ value.compact.map { |v| _to_hash(v) }
194
+ elsif value.is_a?(Hash)
195
+ {}.tap do |hash|
196
+ value.each { |k, v| hash[k] = _to_hash(v) }
197
+ end
198
+ elsif value.respond_to? :to_hash
199
+ value.to_hash
200
+ else
201
+ value
202
+ end
203
+ end
204
+
205
+ end
206
+
207
+ end
@@ -0,0 +1,237 @@
1
+
2
+ require 'date'
3
+
4
+ module GroupDocsAssemblyCloud
5
+ #
6
+ # --------------------------------------------------------------------------------------------------------------------
7
+ # <copyright company="GroupDocs" file="Error.rb">
8
+ # Copyright (c) 2019 GroupDocs.Assembly for Cloud
9
+ # </copyright>
10
+ # <summary>
11
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ # of this software and associated documentation files (the "Software"), to deal
13
+ # in the Software without restriction, including without limitation the rights
14
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ # copies of the Software, and to permit persons to whom the Software is
16
+ # furnished to do so, subject to the following conditions:
17
+ #
18
+ # The above copyright notice and this permission notice shall be included in all
19
+ # copies or substantial portions of the Software.
20
+ #
21
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
+ # SOFTWARE.
28
+ # </summary>
29
+ # --------------------------------------------------------------------------------------------------------------------
30
+ #
31
+
32
+ # Error
33
+ class Error
34
+ # Code
35
+ attr_accessor :code
36
+
37
+ # Message
38
+ attr_accessor :message
39
+
40
+ # Description
41
+ attr_accessor :description
42
+
43
+ # Inner Error
44
+ attr_accessor :inner_error
45
+
46
+
47
+ # Attribute mapping from ruby-style variable name to JSON key.
48
+ def self.attribute_map
49
+ {
50
+ :'code' => :'Code',
51
+ :'message' => :'Message',
52
+ :'description' => :'Description',
53
+ :'inner_error' => :'InnerError'
54
+ }
55
+ end
56
+
57
+ # Attribute type mapping.
58
+ def self.swagger_types
59
+ {
60
+ :'code' => :'String',
61
+ :'message' => :'String',
62
+ :'description' => :'String',
63
+ :'inner_error' => :'ErrorDetails'
64
+ }
65
+ end
66
+
67
+ # Initializes the object
68
+ # @param [Hash] attributes Model attributes in the form of hash
69
+ def initialize(attributes = {})
70
+ return unless attributes.is_a?(Hash)
71
+
72
+ # convert string to symbol for hash key
73
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
74
+
75
+ if attributes.key?(:'Code')
76
+ self.code = attributes[:'Code']
77
+ end
78
+
79
+ if attributes.key?(:'Message')
80
+ self.message = attributes[:'Message']
81
+ end
82
+
83
+ if attributes.key?(:'Description')
84
+ self.description = attributes[:'Description']
85
+ end
86
+
87
+ if attributes.key?(:'InnerError')
88
+ self.inner_error = attributes[:'InnerError']
89
+ end
90
+
91
+ end
92
+
93
+ # Show invalid properties with the reasons. Usually used together with valid?
94
+ # @return Array for valid properies with the reasons
95
+ def list_invalid_properties
96
+ invalid_properties = []
97
+ return invalid_properties
98
+ end
99
+
100
+ # Check to see if the all the properties in the model are valid
101
+ # @return true if the model is valid
102
+ def valid?
103
+ return true
104
+ end
105
+
106
+ # Checks equality by comparing each attribute.
107
+ # @param [Object] Object to be compared
108
+ def ==(other)
109
+ return true if self.equal?(other)
110
+ self.class == other.class &&
111
+ code == other.code &&
112
+ message == other.message &&
113
+ description == other.description &&
114
+ inner_error == other.inner_error
115
+ end
116
+
117
+ # @see the `==` method
118
+ # @param [Object] Object to be compared
119
+ def eql?(other)
120
+ self == other
121
+ end
122
+
123
+ # Calculates hash code according to all attributes.
124
+ # @return [Fixnum] Hash code
125
+ def hash
126
+ [code, message, description, inner_error].hash
127
+ end
128
+
129
+ # Builds the object from hash
130
+ # @param [Hash] attributes Model attributes in the form of hash
131
+ # @return [Object] Returns the model itself
132
+ def build_from_hash(attributes)
133
+ return nil unless attributes.is_a?(Hash)
134
+ self.class.swagger_types.each_pair do |key, type|
135
+ if type =~ /\AArray<(.*)>/i
136
+ # check to ensure the input is an array given that the the attribute
137
+ # is documented as an array but the input is not
138
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
139
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
140
+ end
141
+ elsif !attributes[self.class.attribute_map[key]].nil?
142
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
143
+ end
144
+ # or else data not found in attributes(hash), not an issue as the data can be optional
145
+ end
146
+
147
+ self
148
+ end
149
+
150
+ # Deserializes the data based on type
151
+ # @param string type Data type
152
+ # @param string value Value to be deserialized
153
+ # @return [Object] Deserialized data
154
+ def _deserialize(type, value)
155
+ case type.to_sym
156
+ when :DateTime
157
+ Time.at(/\d/.match(value)[0].to_f).to_datetime
158
+ when :Date
159
+ Time.at(/\d/.match(value)[0].to_f).to_date
160
+ when :String
161
+ value.to_s
162
+ when :Integer
163
+ value.to_i
164
+ when :Float
165
+ value.to_f
166
+ when :BOOLEAN
167
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
168
+ true
169
+ else
170
+ false
171
+ end
172
+ when :Object
173
+ # generic object (usually a Hash), return directly
174
+ value
175
+ when /\AArray<(?<inner_type>.+)>\z/
176
+ inner_type = Regexp.last_match[:inner_type]
177
+ value.map { |v| _deserialize(inner_type, v) }
178
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
179
+ k_type = Regexp.last_match[:k_type]
180
+ v_type = Regexp.last_match[:v_type]
181
+ {}.tap do |hash|
182
+ value.each do |k, v|
183
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
184
+ end
185
+ end
186
+ else
187
+ # model
188
+ temp_model = GroupDocsAssemblyCloud.const_get(type).new
189
+ temp_model.build_from_hash(value)
190
+ end
191
+ end
192
+
193
+ # Returns the string representation of the object
194
+ # @return [String] String presentation of the object
195
+ def to_s
196
+ to_hash.to_s
197
+ end
198
+
199
+ # to_body is an alias to to_hash (backward compatibility)
200
+ # @return [Hash] Returns the object in the form of hash
201
+ def to_body
202
+ to_hash
203
+ end
204
+
205
+ # Returns the object in the form of hash
206
+ # @return [Hash] Returns the object in the form of hash
207
+ def to_hash
208
+ hash = {}
209
+ self.class.attribute_map.each_pair do |attr, param|
210
+ value = self.send(attr)
211
+ next if value.nil?
212
+ hash[param] = _to_hash(value)
213
+ end
214
+ hash
215
+ end
216
+
217
+ # Outputs non-array value in the form of hash
218
+ # For object, use to_hash. Otherwise, just return the value
219
+ # @param [Object] value Any valid value
220
+ # @return [Hash] Returns the value in the form of hash
221
+ def _to_hash(value)
222
+ if value.is_a?(Array)
223
+ value.compact.map { |v| _to_hash(v) }
224
+ elsif value.is_a?(Hash)
225
+ {}.tap do |hash|
226
+ value.each { |k, v| hash[k] = _to_hash(v) }
227
+ end
228
+ elsif value.respond_to? :to_hash
229
+ value.to_hash
230
+ else
231
+ value
232
+ end
233
+ end
234
+
235
+ end
236
+
237
+ end
@@ -0,0 +1,222 @@
1
+
2
+ require 'date'
3
+
4
+ module GroupDocsAssemblyCloud
5
+ #
6
+ # --------------------------------------------------------------------------------------------------------------------
7
+ # <copyright company="GroupDocs" file="ErrorDetails.rb">
8
+ # Copyright (c) 2019 GroupDocs.Assembly for Cloud
9
+ # </copyright>
10
+ # <summary>
11
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ # of this software and associated documentation files (the "Software"), to deal
13
+ # in the Software without restriction, including without limitation the rights
14
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ # copies of the Software, and to permit persons to whom the Software is
16
+ # furnished to do so, subject to the following conditions:
17
+ #
18
+ # The above copyright notice and this permission notice shall be included in all
19
+ # copies or substantial portions of the Software.
20
+ #
21
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
+ # SOFTWARE.
28
+ # </summary>
29
+ # --------------------------------------------------------------------------------------------------------------------
30
+ #
31
+
32
+ # The error details
33
+ class ErrorDetails
34
+ # The request id
35
+ attr_accessor :request_id
36
+
37
+ # Date
38
+ attr_accessor :date
39
+
40
+
41
+ # Attribute mapping from ruby-style variable name to JSON key.
42
+ def self.attribute_map
43
+ {
44
+ :'request_id' => :'RequestId',
45
+ :'date' => :'Date'
46
+ }
47
+ end
48
+
49
+ # Attribute type mapping.
50
+ def self.swagger_types
51
+ {
52
+ :'request_id' => :'String',
53
+ :'date' => :'DateTime'
54
+ }
55
+ end
56
+
57
+ # Initializes the object
58
+ # @param [Hash] attributes Model attributes in the form of hash
59
+ def initialize(attributes = {})
60
+ return unless attributes.is_a?(Hash)
61
+
62
+ # convert string to symbol for hash key
63
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
64
+
65
+ if attributes.key?(:'RequestId')
66
+ self.request_id = attributes[:'RequestId']
67
+ end
68
+
69
+ if attributes.key?(:'Date')
70
+ self.date = attributes[:'Date']
71
+ end
72
+
73
+ end
74
+
75
+ # Show invalid properties with the reasons. Usually used together with valid?
76
+ # @return Array for valid properies with the reasons
77
+ def list_invalid_properties
78
+ invalid_properties = []
79
+ if @date.nil?
80
+ invalid_properties.push("invalid value for 'date', date cannot be nil.")
81
+ end
82
+
83
+ return invalid_properties
84
+ end
85
+
86
+ # Check to see if the all the properties in the model are valid
87
+ # @return true if the model is valid
88
+ def valid?
89
+ return false if @date.nil?
90
+ return true
91
+ end
92
+
93
+ # Checks equality by comparing each attribute.
94
+ # @param [Object] Object to be compared
95
+ def ==(other)
96
+ return true if self.equal?(other)
97
+ self.class == other.class &&
98
+ request_id == other.request_id &&
99
+ date == other.date
100
+ end
101
+
102
+ # @see the `==` method
103
+ # @param [Object] Object to be compared
104
+ def eql?(other)
105
+ self == other
106
+ end
107
+
108
+ # Calculates hash code according to all attributes.
109
+ # @return [Fixnum] Hash code
110
+ def hash
111
+ [request_id, date].hash
112
+ end
113
+
114
+ # Builds the object from hash
115
+ # @param [Hash] attributes Model attributes in the form of hash
116
+ # @return [Object] Returns the model itself
117
+ def build_from_hash(attributes)
118
+ return nil unless attributes.is_a?(Hash)
119
+ self.class.swagger_types.each_pair do |key, type|
120
+ if type =~ /\AArray<(.*)>/i
121
+ # check to ensure the input is an array given that the the attribute
122
+ # is documented as an array but the input is not
123
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
124
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
125
+ end
126
+ elsif !attributes[self.class.attribute_map[key]].nil?
127
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
128
+ end
129
+ # or else data not found in attributes(hash), not an issue as the data can be optional
130
+ end
131
+
132
+ self
133
+ end
134
+
135
+ # Deserializes the data based on type
136
+ # @param string type Data type
137
+ # @param string value Value to be deserialized
138
+ # @return [Object] Deserialized data
139
+ def _deserialize(type, value)
140
+ case type.to_sym
141
+ when :DateTime
142
+ Time.at(/\d/.match(value)[0].to_f).to_datetime
143
+ when :Date
144
+ Time.at(/\d/.match(value)[0].to_f).to_date
145
+ when :String
146
+ value.to_s
147
+ when :Integer
148
+ value.to_i
149
+ when :Float
150
+ value.to_f
151
+ when :BOOLEAN
152
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
153
+ true
154
+ else
155
+ false
156
+ end
157
+ when :Object
158
+ # generic object (usually a Hash), return directly
159
+ value
160
+ when /\AArray<(?<inner_type>.+)>\z/
161
+ inner_type = Regexp.last_match[:inner_type]
162
+ value.map { |v| _deserialize(inner_type, v) }
163
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
164
+ k_type = Regexp.last_match[:k_type]
165
+ v_type = Regexp.last_match[:v_type]
166
+ {}.tap do |hash|
167
+ value.each do |k, v|
168
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
169
+ end
170
+ end
171
+ else
172
+ # model
173
+ temp_model = GroupDocsAssemblyCloud.const_get(type).new
174
+ temp_model.build_from_hash(value)
175
+ end
176
+ end
177
+
178
+ # Returns the string representation of the object
179
+ # @return [String] String presentation of the object
180
+ def to_s
181
+ to_hash.to_s
182
+ end
183
+
184
+ # to_body is an alias to to_hash (backward compatibility)
185
+ # @return [Hash] Returns the object in the form of hash
186
+ def to_body
187
+ to_hash
188
+ end
189
+
190
+ # Returns the object in the form of hash
191
+ # @return [Hash] Returns the object in the form of hash
192
+ def to_hash
193
+ hash = {}
194
+ self.class.attribute_map.each_pair do |attr, param|
195
+ value = self.send(attr)
196
+ next if value.nil?
197
+ hash[param] = _to_hash(value)
198
+ end
199
+ hash
200
+ end
201
+
202
+ # Outputs non-array value in the form of hash
203
+ # For object, use to_hash. Otherwise, just return the value
204
+ # @param [Object] value Any valid value
205
+ # @return [Hash] Returns the value in the form of hash
206
+ def _to_hash(value)
207
+ if value.is_a?(Array)
208
+ value.compact.map { |v| _to_hash(v) }
209
+ elsif value.is_a?(Hash)
210
+ {}.tap do |hash|
211
+ value.each { |k, v| hash[k] = _to_hash(v) }
212
+ end
213
+ elsif value.respond_to? :to_hash
214
+ value.to_hash
215
+ else
216
+ value
217
+ end
218
+ end
219
+
220
+ end
221
+
222
+ end