groupdocs_assembly_cloud 20.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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,182 @@
1
+ # ------------------------------------------------------------------------------------
2
+ # <copyright company="Aspose" file="configuration.rb">
3
+ # Copyright (c) 2020 GroupDocs.Assembly for Cloud
4
+ # </copyright>
5
+ # <summary>
6
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ # of this software and associated documentation files (the "Software"), to deal
8
+ # in the Software without restriction, including without limitation the rights
9
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ # copies of the Software, and to permit persons to whom the Software is
11
+ # furnished to do so, subject to the following conditions:
12
+ #
13
+ # The above copyright notice and this permission notice shall be included in all
14
+ # copies or substantial portions of the Software.
15
+ #
16
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ # SOFTWARE.
23
+ # </summary>
24
+ # ------------------------------------------------------------------------------------
25
+
26
+ require 'uri'
27
+
28
+ module GroupDocsAssemblyCloud
29
+ #
30
+ # Class for storing API configuration info
31
+ #
32
+ class Configuration
33
+
34
+ # Defines v1 api version
35
+ V1_API_VERSION = '/v1.0'.freeze
36
+
37
+ # Defines v2 api version
38
+ V2_API_VERSION = '/v2.0'.freeze
39
+
40
+ # Defines v3 api version
41
+ V3_API_VERSION = '/v3.0'.freeze
42
+
43
+ # Defines v1.1 api version
44
+ V1_1_API_VERSION = '/v1.1'.freeze
45
+
46
+ # Defines url scheme
47
+ attr_accessor :scheme
48
+
49
+ # Defines url host
50
+ attr_accessor :host
51
+
52
+ # Defines url api version
53
+ attr_accessor :api_version
54
+
55
+ # Defines API keys used with API Key authentications.
56
+ #
57
+ # @return [Hash] key: parameter name, value: parameter value (API key)
58
+ #
59
+ # @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string)
60
+ # config.api_key['api_key'] = 'xxx'
61
+ attr_accessor :api_key
62
+
63
+ # Defines API key prefixes used with API Key authentications.
64
+ #
65
+ # @return [Hash] key: parameter name, value: API key prefix
66
+ #
67
+ # @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers)
68
+ # config.api_key_prefix['api_key'] = 'Token'
69
+ attr_accessor :api_key_prefix
70
+
71
+ # Defines the username used with HTTP basic authentication.
72
+ #
73
+ # @return [String]
74
+ attr_accessor :username
75
+
76
+ # Defines the password used with HTTP basic authentication.
77
+ #
78
+ # @return [String]
79
+ attr_accessor :password
80
+
81
+ # Defines the access token (Bearer) used with OAuth2.
82
+ attr_accessor :access_token
83
+
84
+ # Defines the refresh token (Bearer) used with OAuth2.
85
+ attr_accessor :refresh_token
86
+
87
+ # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
88
+ # details will be logged with `logger.debug` (see the `logger` attribute).
89
+ # Default to false.
90
+ #
91
+ # @return [true, false]
92
+ attr_accessor :debugging
93
+
94
+ # Defines the logger used for debugging.
95
+ # Default to `Rails.logger` (when in Rails) or logging to STDOUT.
96
+ #
97
+ # @return [#debug]
98
+ attr_accessor :logger
99
+
100
+ # Defines the temporary folder to store downloaded files
101
+ # (for API endpoints that have file response).
102
+ # Default to use `Tempfile`.
103
+ #
104
+ # @return [String]
105
+ attr_accessor :temp_folder_path
106
+
107
+ # Set this to false to skip client side validation in the operation.
108
+ # Default to true.
109
+ # @return [true, false]
110
+ attr_accessor :client_side_validation
111
+
112
+
113
+ def initialize
114
+ @scheme = 'https'
115
+ @host = "api.groupdocs.cloud"
116
+ @api_version = V1_API_VERSION
117
+ @api_key = {}
118
+ @api_key_prefix = {}
119
+ @client_side_validation = true
120
+ @debugging = false
121
+ @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
122
+
123
+ yield(self) if block_given?
124
+ end
125
+
126
+ # The default Configuration object.
127
+ def self.default
128
+ @@default ||= Configuration.new
129
+ end
130
+
131
+ # yield self
132
+ def configure
133
+ yield(self) if block_given?
134
+ end
135
+
136
+ # sets the scheme
137
+ def scheme=(scheme)
138
+ # remove :// from scheme
139
+ @scheme = scheme.sub(/:\/\//, '')
140
+ end
141
+
142
+ # sets the host
143
+ def host=(host)
144
+ # remove http(s):// and anything after a slash
145
+ @host = host.sub(/https?:\/\//, '').split('/').first
146
+ end
147
+
148
+ # returns base url
149
+ def base_url
150
+ url = "#{scheme}://#{[host, @api_version].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
151
+ URI.encode(url)
152
+ end
153
+
154
+ # Gets API key (with prefix if set).
155
+ # @param [String] param_name the parameter name of API key auth
156
+ def api_key_with_prefix(param_name)
157
+ if @api_key_prefix[param_name]
158
+ "#{@api_key_prefix[param_name]} #{@api_key[param_name]}"
159
+ else
160
+ @api_key[param_name]
161
+ end
162
+ end
163
+
164
+ # Gets Basic Auth token string
165
+ def basic_auth_token
166
+ 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
167
+ end
168
+
169
+ # Returns Auth Settings hash for api client.
170
+ def auth_settings
171
+ {
172
+ 'JWT' =>
173
+ {
174
+ type: 'oauth2',
175
+ in: 'header',
176
+ key: 'Authorization',
177
+ value: "Bearer #{access_token}"
178
+ },
179
+ }
180
+ end
181
+ end
182
+ end
@@ -0,0 +1,237 @@
1
+
2
+ require 'date'
3
+
4
+ module GroupDocsAssemblyCloud
5
+ #
6
+ # --------------------------------------------------------------------------------------------------------------------
7
+ # <copyright company="GroupDocs" file="AssembleOptions.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
+ # Assemble options data which is using for specifying assemble options, like template name, save format, report data and etc.
33
+ class AssembleOptions
34
+ # Gets or sets the template name which is located on storage.
35
+ attr_accessor :template_file_info
36
+
37
+ # Gets or sets a save format for assembled document.
38
+ attr_accessor :save_format
39
+
40
+ # Gets or sets a data for report.
41
+ attr_accessor :report_data
42
+
43
+ # Gets or sets result path of a built document.
44
+ attr_accessor :output_path
45
+
46
+
47
+ # Attribute mapping from ruby-style variable name to JSON key.
48
+ def self.attribute_map
49
+ {
50
+ :'template_file_info' => :'TemplateFileInfo',
51
+ :'save_format' => :'SaveFormat',
52
+ :'report_data' => :'ReportData',
53
+ :'output_path' => :'OutputPath'
54
+ }
55
+ end
56
+
57
+ # Attribute type mapping.
58
+ def self.swagger_types
59
+ {
60
+ :'template_file_info' => :'TemplateFileInfo',
61
+ :'save_format' => :'String',
62
+ :'report_data' => :'String',
63
+ :'output_path' => :'String'
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?(:'TemplateFileInfo')
76
+ self.template_file_info = attributes[:'TemplateFileInfo']
77
+ end
78
+
79
+ if attributes.key?(:'SaveFormat')
80
+ self.save_format = attributes[:'SaveFormat']
81
+ end
82
+
83
+ if attributes.key?(:'ReportData')
84
+ self.report_data = attributes[:'ReportData']
85
+ end
86
+
87
+ if attributes.key?(:'OutputPath')
88
+ self.output_path = attributes[:'OutputPath']
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
+ template_file_info == other.template_file_info &&
112
+ save_format == other.save_format &&
113
+ report_data == other.report_data &&
114
+ output_path == other.output_path
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
+ [template_file_info, save_format, report_data, output_path].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,217 @@
1
+
2
+ require 'date'
3
+
4
+ module GroupDocsAssemblyCloud
5
+ #
6
+ # --------------------------------------------------------------------------------------------------------------------
7
+ # <copyright company="GroupDocs" file="AssemblyApiErrorResponse.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 response for exceptions.
33
+ class AssemblyApiErrorResponse
34
+ # Gets or sets request Id.
35
+ attr_accessor :request_id
36
+
37
+ # Gets or sets error.
38
+ attr_accessor :error
39
+
40
+
41
+ # Attribute mapping from ruby-style variable name to JSON key.
42
+ def self.attribute_map
43
+ {
44
+ :'request_id' => :'RequestId',
45
+ :'error' => :'Error'
46
+ }
47
+ end
48
+
49
+ # Attribute type mapping.
50
+ def self.swagger_types
51
+ {
52
+ :'request_id' => :'String',
53
+ :'error' => :'ResponseError'
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?(:'Error')
70
+ self.error = attributes[:'Error']
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
+ return invalid_properties
80
+ end
81
+
82
+ # Check to see if the all the properties in the model are valid
83
+ # @return true if the model is valid
84
+ def valid?
85
+ return true
86
+ end
87
+
88
+ # Checks equality by comparing each attribute.
89
+ # @param [Object] Object to be compared
90
+ def ==(other)
91
+ return true if self.equal?(other)
92
+ self.class == other.class &&
93
+ request_id == other.request_id &&
94
+ error == other.error
95
+ end
96
+
97
+ # @see the `==` method
98
+ # @param [Object] Object to be compared
99
+ def eql?(other)
100
+ self == other
101
+ end
102
+
103
+ # Calculates hash code according to all attributes.
104
+ # @return [Fixnum] Hash code
105
+ def hash
106
+ [request_id, error].hash
107
+ end
108
+
109
+ # Builds the object from hash
110
+ # @param [Hash] attributes Model attributes in the form of hash
111
+ # @return [Object] Returns the model itself
112
+ def build_from_hash(attributes)
113
+ return nil unless attributes.is_a?(Hash)
114
+ self.class.swagger_types.each_pair do |key, type|
115
+ if type =~ /\AArray<(.*)>/i
116
+ # check to ensure the input is an array given that the the attribute
117
+ # is documented as an array but the input is not
118
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
119
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
120
+ end
121
+ elsif !attributes[self.class.attribute_map[key]].nil?
122
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
123
+ end
124
+ # or else data not found in attributes(hash), not an issue as the data can be optional
125
+ end
126
+
127
+ self
128
+ end
129
+
130
+ # Deserializes the data based on type
131
+ # @param string type Data type
132
+ # @param string value Value to be deserialized
133
+ # @return [Object] Deserialized data
134
+ def _deserialize(type, value)
135
+ case type.to_sym
136
+ when :DateTime
137
+ Time.at(/\d/.match(value)[0].to_f).to_datetime
138
+ when :Date
139
+ Time.at(/\d/.match(value)[0].to_f).to_date
140
+ when :String
141
+ value.to_s
142
+ when :Integer
143
+ value.to_i
144
+ when :Float
145
+ value.to_f
146
+ when :BOOLEAN
147
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
148
+ true
149
+ else
150
+ false
151
+ end
152
+ when :Object
153
+ # generic object (usually a Hash), return directly
154
+ value
155
+ when /\AArray<(?<inner_type>.+)>\z/
156
+ inner_type = Regexp.last_match[:inner_type]
157
+ value.map { |v| _deserialize(inner_type, v) }
158
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
159
+ k_type = Regexp.last_match[:k_type]
160
+ v_type = Regexp.last_match[:v_type]
161
+ {}.tap do |hash|
162
+ value.each do |k, v|
163
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
164
+ end
165
+ end
166
+ else
167
+ # model
168
+ temp_model = GroupDocsAssemblyCloud.const_get(type).new
169
+ temp_model.build_from_hash(value)
170
+ end
171
+ end
172
+
173
+ # Returns the string representation of the object
174
+ # @return [String] String presentation of the object
175
+ def to_s
176
+ to_hash.to_s
177
+ end
178
+
179
+ # to_body is an alias to to_hash (backward compatibility)
180
+ # @return [Hash] Returns the object in the form of hash
181
+ def to_body
182
+ to_hash
183
+ end
184
+
185
+ # Returns the object in the form of hash
186
+ # @return [Hash] Returns the object in the form of hash
187
+ def to_hash
188
+ hash = {}
189
+ self.class.attribute_map.each_pair do |attr, param|
190
+ value = self.send(attr)
191
+ next if value.nil?
192
+ hash[param] = _to_hash(value)
193
+ end
194
+ hash
195
+ end
196
+
197
+ # Outputs non-array value in the form of hash
198
+ # For object, use to_hash. Otherwise, just return the value
199
+ # @param [Object] value Any valid value
200
+ # @return [Hash] Returns the value in the form of hash
201
+ def _to_hash(value)
202
+ if value.is_a?(Array)
203
+ value.compact.map { |v| _to_hash(v) }
204
+ elsif value.is_a?(Hash)
205
+ {}.tap do |hash|
206
+ value.each { |k, v| hash[k] = _to_hash(v) }
207
+ end
208
+ elsif value.respond_to? :to_hash
209
+ value.to_hash
210
+ else
211
+ value
212
+ end
213
+ end
214
+
215
+ end
216
+
217
+ end