groupdocs_editor_cloud 19.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +7 -0
  2. data/lib/groupdocs_editor_cloud.rb +70 -0
  3. data/lib/groupdocs_editor_cloud/api/edit_api.rb +314 -0
  4. data/lib/groupdocs_editor_cloud/api/file_api.rb +729 -0
  5. data/lib/groupdocs_editor_cloud/api/folder_api.rb +694 -0
  6. data/lib/groupdocs_editor_cloud/api/info_api.rb +266 -0
  7. data/lib/groupdocs_editor_cloud/api/storage_api.rb +541 -0
  8. data/lib/groupdocs_editor_cloud/api_client.rb +380 -0
  9. data/lib/groupdocs_editor_cloud/api_error.rb +58 -0
  10. data/lib/groupdocs_editor_cloud/configuration.rb +95 -0
  11. data/lib/groupdocs_editor_cloud/models/delimited_text_load_options.rb +279 -0
  12. data/lib/groupdocs_editor_cloud/models/delimited_text_save_options.rb +304 -0
  13. data/lib/groupdocs_editor_cloud/models/disc_usage.rb +234 -0
  14. data/lib/groupdocs_editor_cloud/models/document_result.rb +214 -0
  15. data/lib/groupdocs_editor_cloud/models/error.rb +244 -0
  16. data/lib/groupdocs_editor_cloud/models/error_details.rb +229 -0
  17. data/lib/groupdocs_editor_cloud/models/file_info.rb +244 -0
  18. data/lib/groupdocs_editor_cloud/models/file_version.rb +289 -0
  19. data/lib/groupdocs_editor_cloud/models/file_versions.rb +216 -0
  20. data/lib/groupdocs_editor_cloud/models/files_list.rb +216 -0
  21. data/lib/groupdocs_editor_cloud/models/files_upload_result.rb +228 -0
  22. data/lib/groupdocs_editor_cloud/models/format.rb +224 -0
  23. data/lib/groupdocs_editor_cloud/models/formats_result.rb +216 -0
  24. data/lib/groupdocs_editor_cloud/models/info_result.rb +269 -0
  25. data/lib/groupdocs_editor_cloud/models/load_options.rb +224 -0
  26. data/lib/groupdocs_editor_cloud/models/load_result.rb +224 -0
  27. data/lib/groupdocs_editor_cloud/models/object_exist.rb +234 -0
  28. data/lib/groupdocs_editor_cloud/models/options.rb +224 -0
  29. data/lib/groupdocs_editor_cloud/models/pdf_save_options.rb +316 -0
  30. data/lib/groupdocs_editor_cloud/models/presentation_load_options.rb +254 -0
  31. data/lib/groupdocs_editor_cloud/models/presentation_save_options.rb +264 -0
  32. data/lib/groupdocs_editor_cloud/models/save_options.rb +254 -0
  33. data/lib/groupdocs_editor_cloud/models/spreadsheet_load_options.rb +254 -0
  34. data/lib/groupdocs_editor_cloud/models/spreadsheet_save_options.rb +326 -0
  35. data/lib/groupdocs_editor_cloud/models/storage_exist.rb +219 -0
  36. data/lib/groupdocs_editor_cloud/models/storage_file.rb +264 -0
  37. data/lib/groupdocs_editor_cloud/models/text_load_options.rb +347 -0
  38. data/lib/groupdocs_editor_cloud/models/text_save_options.rb +294 -0
  39. data/lib/groupdocs_editor_cloud/models/word_processing_load_options.rb +306 -0
  40. data/lib/groupdocs_editor_cloud/models/word_processing_save_options.rb +371 -0
  41. data/lib/groupdocs_editor_cloud/models/xml_load_options.rb +346 -0
  42. data/lib/groupdocs_editor_cloud/version.rb +29 -0
  43. metadata +153 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f7258c135bd01b6007733a1741ecdc82ddfbad7d
4
+ data.tar.gz: 0d2b192d670e41ad29a343efbbebf9e1ec135b14
5
+ SHA512:
6
+ metadata.gz: 9755770427b393e0479b8d0f4e2576ea18c297b29b00643718e6436583956307b7097ddcf06536260424d1dd03effaf974591086e8f64da630e7befbd1057594
7
+ data.tar.gz: f255d60cdde06f8f88fee26db495ff126a792f629321c858827cbdbc51d47b14384a65070d4a27186a934a45074072f345f176a25da8ee722fb26791e2a9d8f7
@@ -0,0 +1,70 @@
1
+ # ------------------------------------------------------------------------------------
2
+ # <copyright company="Aspose Pty Ltd" file="groupdocs_editor_cloud.rb">
3
+ # Copyright (c) 2003-2019 Aspose Pty Ltd
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
+ # Common files
27
+ require_relative 'groupdocs_editor_cloud/api_client'
28
+ require_relative 'groupdocs_editor_cloud/api_error'
29
+ require_relative 'groupdocs_editor_cloud/version'
30
+ require_relative 'groupdocs_editor_cloud/configuration'
31
+
32
+ # Models
33
+ require_relative 'groupdocs_editor_cloud/models/disc_usage'
34
+ require_relative 'groupdocs_editor_cloud/models/document_result'
35
+ require_relative 'groupdocs_editor_cloud/models/error'
36
+ require_relative 'groupdocs_editor_cloud/models/error_details'
37
+ require_relative 'groupdocs_editor_cloud/models/file_info'
38
+ require_relative 'groupdocs_editor_cloud/models/file_versions'
39
+ require_relative 'groupdocs_editor_cloud/models/files_list'
40
+ require_relative 'groupdocs_editor_cloud/models/files_upload_result'
41
+ require_relative 'groupdocs_editor_cloud/models/format'
42
+ require_relative 'groupdocs_editor_cloud/models/formats_result'
43
+ require_relative 'groupdocs_editor_cloud/models/info_result'
44
+ require_relative 'groupdocs_editor_cloud/models/load_result'
45
+ require_relative 'groupdocs_editor_cloud/models/object_exist'
46
+ require_relative 'groupdocs_editor_cloud/models/options'
47
+ require_relative 'groupdocs_editor_cloud/models/storage_exist'
48
+ require_relative 'groupdocs_editor_cloud/models/storage_file'
49
+ require_relative 'groupdocs_editor_cloud/models/file_version'
50
+ require_relative 'groupdocs_editor_cloud/models/load_options'
51
+ require_relative 'groupdocs_editor_cloud/models/save_options'
52
+ require_relative 'groupdocs_editor_cloud/models/delimited_text_load_options'
53
+ require_relative 'groupdocs_editor_cloud/models/delimited_text_save_options'
54
+ require_relative 'groupdocs_editor_cloud/models/pdf_save_options'
55
+ require_relative 'groupdocs_editor_cloud/models/presentation_load_options'
56
+ require_relative 'groupdocs_editor_cloud/models/presentation_save_options'
57
+ require_relative 'groupdocs_editor_cloud/models/spreadsheet_load_options'
58
+ require_relative 'groupdocs_editor_cloud/models/spreadsheet_save_options'
59
+ require_relative 'groupdocs_editor_cloud/models/text_load_options'
60
+ require_relative 'groupdocs_editor_cloud/models/text_save_options'
61
+ require_relative 'groupdocs_editor_cloud/models/word_processing_load_options'
62
+ require_relative 'groupdocs_editor_cloud/models/word_processing_save_options'
63
+ require_relative 'groupdocs_editor_cloud/models/xml_load_options'
64
+
65
+ # APIs
66
+ require_relative 'groupdocs_editor_cloud/api/edit_api'
67
+ require_relative 'groupdocs_editor_cloud/api/file_api'
68
+ require_relative 'groupdocs_editor_cloud/api/folder_api'
69
+ require_relative 'groupdocs_editor_cloud/api/info_api'
70
+ require_relative 'groupdocs_editor_cloud/api/storage_api'
@@ -0,0 +1,314 @@
1
+ # -----------------------------------------------------------------------------------
2
+ # <copyright company="Aspose Pty Ltd" file="edit.rb">
3
+ # Copyright (c) 2003-2019 Aspose Pty Ltd
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
+ require 'date'
28
+
29
+ module GroupDocsEditorCloud
30
+ #
31
+ # GroupDocs.Editor Cloud API
32
+ #
33
+ class EditApi
34
+ attr_accessor :config
35
+
36
+ #make EditApi.new private
37
+ private_class_method :new
38
+
39
+ # Initializes new instance of EditApi
40
+ #
41
+ # @param [config] Configuration
42
+ # @return [EditApi] New instance of EditApi
43
+ def initialize(config)
44
+ @config = config
45
+ @api_client = ApiClient.new(config)
46
+ @access_token = nil
47
+ end
48
+
49
+ # Initializes new instance of EditApi
50
+ #
51
+ # @param [app_sid] Application identifier (App SID)
52
+ # @param [app_key] Application private key (App Key)
53
+ # @return [EditApi] New instance of EditApi
54
+ def self.from_keys(app_sid, app_key)
55
+ config = Configuration.new(app_sid, app_key)
56
+ return new(config)
57
+ end
58
+
59
+ # Initializes new instance of EditApi
60
+ #
61
+ # @param [config] Configuration
62
+ # @return [EditApi] New instance of EditApi
63
+ def self.from_config(config)
64
+ return new(config)
65
+ end
66
+
67
+ # Load document for editing
68
+ #
69
+ # @param request load_request
70
+ # @return [LoadResult]
71
+ def load(request)
72
+ data, _status_code, _headers = load_with_http_info(request)
73
+ data
74
+ end
75
+
76
+ # Load document for editing
77
+ #
78
+ # @param request load_request
79
+ # @return [Array<(LoadResult, Fixnum, Hash)>]
80
+ # LoadResult data, response status code and response headers
81
+ def load_with_http_info(request)
82
+ raise ArgumentError, 'Incorrect request type' unless request.is_a? LoadRequest
83
+
84
+ @api_client.config.logger.debug 'Calling API: EditApi.load ...' if @api_client.config.debugging
85
+ # verify the required parameter 'load_options' is set
86
+ raise ArgumentError, 'Missing the required parameter load_options when calling EditApi.load' if @api_client.config.client_side_validation && request.load_options.nil?
87
+ # resource path
88
+ local_var_path = '/editor/load'
89
+
90
+ # query parameters
91
+ query_params = {}
92
+
93
+ # header parameters
94
+ header_params = {}
95
+ # HTTP header 'Accept' (if needed)
96
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
97
+ # HTTP header 'Content-Type'
98
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
99
+
100
+ # form parameters
101
+ form_params = {}
102
+
103
+ # http body (model)
104
+ post_body = @api_client.object_to_http_body(request.load_options)
105
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
106
+ header_params: header_params,
107
+ query_params: query_params,
108
+ form_params: form_params,
109
+ body: post_body,
110
+ access_token: get_access_token,
111
+ return_type: 'LoadResult')
112
+ if @api_client.config.debugging
113
+ @api_client.config.logger.debug "API called:
114
+ EditApi#load\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
115
+ end
116
+ [data, status_code, headers]
117
+ end
118
+
119
+ # Save document after editing
120
+ #
121
+ # @param request save_request
122
+ # @return [DocumentResult]
123
+ def save(request)
124
+ data, _status_code, _headers = save_with_http_info(request)
125
+ data
126
+ end
127
+
128
+ # Save document after editing
129
+ #
130
+ # @param request save_request
131
+ # @return [Array<(DocumentResult, Fixnum, Hash)>]
132
+ # DocumentResult data, response status code and response headers
133
+ def save_with_http_info(request)
134
+ raise ArgumentError, 'Incorrect request type' unless request.is_a? SaveRequest
135
+
136
+ @api_client.config.logger.debug 'Calling API: EditApi.save ...' if @api_client.config.debugging
137
+ # verify the required parameter 'save_options' is set
138
+ raise ArgumentError, 'Missing the required parameter save_options when calling EditApi.save' if @api_client.config.client_side_validation && request.save_options.nil?
139
+ # resource path
140
+ local_var_path = '/editor/save'
141
+
142
+ # query parameters
143
+ query_params = {}
144
+
145
+ # header parameters
146
+ header_params = {}
147
+ # HTTP header 'Accept' (if needed)
148
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
149
+ # HTTP header 'Content-Type'
150
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
151
+
152
+ # form parameters
153
+ form_params = {}
154
+
155
+ # http body (model)
156
+ post_body = @api_client.object_to_http_body(request.save_options)
157
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
158
+ header_params: header_params,
159
+ query_params: query_params,
160
+ form_params: form_params,
161
+ body: post_body,
162
+ access_token: get_access_token,
163
+ return_type: 'DocumentResult')
164
+ if @api_client.config.debugging
165
+ @api_client.config.logger.debug "API called:
166
+ EditApi#save\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
167
+ end
168
+ [data, status_code, headers]
169
+ end
170
+
171
+ #
172
+ # Helper method to convert first letter to downcase
173
+ #
174
+ private def downcase_first_letter(str)
175
+ value = str[0].downcase + str[1..-1]
176
+ value
177
+ end
178
+
179
+ #
180
+ # Retrieves access token
181
+ #
182
+ private def get_access_token
183
+ if @access_token.nil? then
184
+ request_access_token
185
+ end
186
+
187
+ @access_token
188
+ end
189
+
190
+ #
191
+ # Gets a access token from server
192
+ #
193
+ private def request_access_token
194
+ auth_config = Configuration.new(@config.app_sid, @config.app_key)
195
+ auth_config.api_base_url = @config.api_base_url
196
+ auth_config.debugging = @config.debugging
197
+ auth_config.logger = @config.logger
198
+ auth_config.temp_folder_path = @config.temp_folder_path
199
+ auth_config.client_side_validation = @config.client_side_validation
200
+ auth_config.api_version = ''
201
+
202
+ auth_api_client = ApiClient.new(auth_config)
203
+
204
+ request_url = "/connect/token"
205
+ post_data = "grant_type=client_credentials&client_id=#{@config.app_sid}&client_secret=#{@config.app_key}"
206
+
207
+ data, _status_code, _header = auth_api_client.call_api(:POST, request_url, :body => post_data, :return_type => 'Object')
208
+
209
+ @access_token = data[:access_token]
210
+
211
+ expires_in_seconds = data[:expires_in].to_i - 5 * 60
212
+ expires_in_days = Rational(expires_in_seconds, 60 * 60 * 24)
213
+ @access_token_expires_at = DateTime.now + expires_in_days
214
+ end
215
+
216
+ # requires all files inside a directory from current dir
217
+ # @param _dir can be relative path like '/lib' or "../lib"
218
+ private def require_all(_dir)
219
+ Dir[File.expand_path(File.join(File.dirname(File.absolute_path(__FILE__)), _dir)) + "/*.rb"].each do |file|
220
+ require file
221
+ end
222
+ end
223
+ end
224
+ end
225
+ #
226
+ # --------------------------------------------------------------------------------------------------------------------
227
+ # <copyright company="Aspose Pty Ltd" file="load_request.rb">
228
+ # Copyright (c) 2003-2019 Aspose Pty Ltd
229
+ # </copyright>
230
+ # <summary>
231
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
232
+ # of this software and associated documentation files (the "Software"), to deal
233
+ # in the Software without restriction, including without limitation the rights
234
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
235
+ # copies of the Software, and to permit persons to whom the Software is
236
+ # furnished to do so, subject to the following conditions:
237
+ #
238
+ # The above copyright notice and this permission notice shall be included in all
239
+ # copies or substantial portions of the Software.
240
+ #
241
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
242
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
243
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
244
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
245
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
246
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
247
+ # SOFTWARE.
248
+ # </summary>
249
+ # --------------------------------------------------------------------------------------------------------------------
250
+ #
251
+
252
+ module GroupDocsEditorCloud
253
+
254
+ #
255
+ # Request model for load operation.
256
+ #
257
+ class LoadRequest
258
+
259
+ # The document load options
260
+ attr_accessor :load_options
261
+
262
+ #
263
+ # Initializes a new instance.
264
+ # @param load_options The document load options
265
+ def initialize(load_options)
266
+ self.load_options = load_options
267
+ end
268
+ end
269
+ end
270
+ #
271
+ # --------------------------------------------------------------------------------------------------------------------
272
+ # <copyright company="Aspose Pty Ltd" file="save_request.rb">
273
+ # Copyright (c) 2003-2019 Aspose Pty Ltd
274
+ # </copyright>
275
+ # <summary>
276
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
277
+ # of this software and associated documentation files (the "Software"), to deal
278
+ # in the Software without restriction, including without limitation the rights
279
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
280
+ # copies of the Software, and to permit persons to whom the Software is
281
+ # furnished to do so, subject to the following conditions:
282
+ #
283
+ # The above copyright notice and this permission notice shall be included in all
284
+ # copies or substantial portions of the Software.
285
+ #
286
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
287
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
288
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
289
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
290
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
291
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
292
+ # SOFTWARE.
293
+ # </summary>
294
+ # --------------------------------------------------------------------------------------------------------------------
295
+ #
296
+
297
+ module GroupDocsEditorCloud
298
+
299
+ #
300
+ # Request model for save operation.
301
+ #
302
+ class SaveRequest
303
+
304
+ # Edited document save options
305
+ attr_accessor :save_options
306
+
307
+ #
308
+ # Initializes a new instance.
309
+ # @param save_options Edited document save options
310
+ def initialize(save_options)
311
+ self.save_options = save_options
312
+ end
313
+ end
314
+ end
@@ -0,0 +1,729 @@
1
+ # -----------------------------------------------------------------------------------
2
+ # <copyright company="Aspose Pty Ltd" file="file.rb">
3
+ # Copyright (c) 2003-2019 Aspose Pty Ltd
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
+ require 'date'
28
+
29
+ module GroupDocsEditorCloud
30
+ #
31
+ # GroupDocs.Editor Cloud API
32
+ #
33
+ class FileApi
34
+ attr_accessor :config
35
+
36
+ #make FileApi.new private
37
+ private_class_method :new
38
+
39
+ # Initializes new instance of FileApi
40
+ #
41
+ # @param [config] Configuration
42
+ # @return [FileApi] New instance of FileApi
43
+ def initialize(config)
44
+ @config = config
45
+ @api_client = ApiClient.new(config)
46
+ @access_token = nil
47
+ end
48
+
49
+ # Initializes new instance of FileApi
50
+ #
51
+ # @param [app_sid] Application identifier (App SID)
52
+ # @param [app_key] Application private key (App Key)
53
+ # @return [FileApi] New instance of FileApi
54
+ def self.from_keys(app_sid, app_key)
55
+ config = Configuration.new(app_sid, app_key)
56
+ return new(config)
57
+ end
58
+
59
+ # Initializes new instance of FileApi
60
+ #
61
+ # @param [config] Configuration
62
+ # @return [FileApi] New instance of FileApi
63
+ def self.from_config(config)
64
+ return new(config)
65
+ end
66
+
67
+ # Copy file
68
+ #
69
+ # @param request copy_file_request
70
+ # @return [nil]
71
+ def copy_file(request)
72
+ copy_file_with_http_info(request)
73
+ nil
74
+ end
75
+
76
+ # Copy file
77
+ #
78
+ # @param request copy_file_request
79
+ # @return [Array<(nil, Fixnum, Hash)>]
80
+ # nil, response status code and response headers
81
+ def copy_file_with_http_info(request)
82
+ raise ArgumentError, 'Incorrect request type' unless request.is_a? CopyFileRequest
83
+
84
+ @api_client.config.logger.debug 'Calling API: FileApi.copy_file ...' if @api_client.config.debugging
85
+ # verify the required parameter 'src_path' is set
86
+ raise ArgumentError, 'Missing the required parameter src_path when calling FileApi.copy_file' if @api_client.config.client_side_validation && request.src_path.nil?
87
+ # verify the required parameter 'dest_path' is set
88
+ raise ArgumentError, 'Missing the required parameter dest_path when calling FileApi.copy_file' if @api_client.config.client_side_validation && request.dest_path.nil?
89
+ # resource path
90
+ local_var_path = '/editor/storage/file/copy/{srcPath}'
91
+ local_var_path = local_var_path.sub('{' + downcase_first_letter('srcPath') + '}', request.src_path.to_s)
92
+
93
+ # query parameters
94
+ query_params = {}
95
+ query_params[downcase_first_letter('destPath')] = request.dest_path
96
+
97
+ if local_var_path.include? ('{' + downcase_first_letter('srcStorageName') + '}')
98
+ local_var_path = local_var_path.sub('{' + downcase_first_letter('srcStorageName') + '}', request.src_storage_name.to_s)
99
+ else
100
+ query_params[downcase_first_letter('srcStorageName')] = request.src_storage_name unless request.src_storage_name.nil?
101
+ end
102
+ if local_var_path.include? ('{' + downcase_first_letter('destStorageName') + '}')
103
+ local_var_path = local_var_path.sub('{' + downcase_first_letter('destStorageName') + '}', request.dest_storage_name.to_s)
104
+ else
105
+ query_params[downcase_first_letter('destStorageName')] = request.dest_storage_name unless request.dest_storage_name.nil?
106
+ end
107
+ if local_var_path.include? ('{' + downcase_first_letter('versionId') + '}')
108
+ local_var_path = local_var_path.sub('{' + downcase_first_letter('versionId') + '}', request.version_id.to_s)
109
+ else
110
+ query_params[downcase_first_letter('versionId')] = request.version_id unless request.version_id.nil?
111
+ end
112
+
113
+ # header parameters
114
+ header_params = {}
115
+ # HTTP header 'Accept' (if needed)
116
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
117
+ # HTTP header 'Content-Type'
118
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
119
+
120
+ # form parameters
121
+ form_params = {}
122
+
123
+ # http body (model)
124
+ post_body = nil
125
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
126
+ header_params: header_params,
127
+ query_params: query_params,
128
+ form_params: form_params,
129
+ body: post_body,
130
+ access_token: get_access_token)
131
+ if @api_client.config.debugging
132
+ @api_client.config.logger.debug "API called:
133
+ FileApi#copy_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
134
+ end
135
+ [data, status_code, headers]
136
+ end
137
+
138
+ # Delete file
139
+ #
140
+ # @param request delete_file_request
141
+ # @return [nil]
142
+ def delete_file(request)
143
+ delete_file_with_http_info(request)
144
+ nil
145
+ end
146
+
147
+ # Delete file
148
+ #
149
+ # @param request delete_file_request
150
+ # @return [Array<(nil, Fixnum, Hash)>]
151
+ # nil, response status code and response headers
152
+ def delete_file_with_http_info(request)
153
+ raise ArgumentError, 'Incorrect request type' unless request.is_a? DeleteFileRequest
154
+
155
+ @api_client.config.logger.debug 'Calling API: FileApi.delete_file ...' if @api_client.config.debugging
156
+ # verify the required parameter 'path' is set
157
+ raise ArgumentError, 'Missing the required parameter path when calling FileApi.delete_file' if @api_client.config.client_side_validation && request.path.nil?
158
+ # resource path
159
+ local_var_path = '/editor/storage/file/{path}'
160
+ local_var_path = local_var_path.sub('{' + downcase_first_letter('path') + '}', request.path.to_s)
161
+
162
+ # query parameters
163
+ query_params = {}
164
+ if local_var_path.include? ('{' + downcase_first_letter('storageName') + '}')
165
+ local_var_path = local_var_path.sub('{' + downcase_first_letter('storageName') + '}', request.storage_name.to_s)
166
+ else
167
+ query_params[downcase_first_letter('storageName')] = request.storage_name unless request.storage_name.nil?
168
+ end
169
+ if local_var_path.include? ('{' + downcase_first_letter('versionId') + '}')
170
+ local_var_path = local_var_path.sub('{' + downcase_first_letter('versionId') + '}', request.version_id.to_s)
171
+ else
172
+ query_params[downcase_first_letter('versionId')] = request.version_id unless request.version_id.nil?
173
+ end
174
+
175
+ # header parameters
176
+ header_params = {}
177
+ # HTTP header 'Accept' (if needed)
178
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
179
+ # HTTP header 'Content-Type'
180
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
181
+
182
+ # form parameters
183
+ form_params = {}
184
+
185
+ # http body (model)
186
+ post_body = nil
187
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
188
+ header_params: header_params,
189
+ query_params: query_params,
190
+ form_params: form_params,
191
+ body: post_body,
192
+ access_token: get_access_token)
193
+ if @api_client.config.debugging
194
+ @api_client.config.logger.debug "API called:
195
+ FileApi#delete_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
196
+ end
197
+ [data, status_code, headers]
198
+ end
199
+
200
+ # Download file
201
+ #
202
+ # @param request download_file_request
203
+ # @return [File]
204
+ def download_file(request)
205
+ data, _status_code, _headers = download_file_with_http_info(request)
206
+ data
207
+ end
208
+
209
+ # Download file
210
+ #
211
+ # @param request download_file_request
212
+ # @return [Array<(File, Fixnum, Hash)>]
213
+ # File data, response status code and response headers
214
+ def download_file_with_http_info(request)
215
+ raise ArgumentError, 'Incorrect request type' unless request.is_a? DownloadFileRequest
216
+
217
+ @api_client.config.logger.debug 'Calling API: FileApi.download_file ...' if @api_client.config.debugging
218
+ # verify the required parameter 'path' is set
219
+ raise ArgumentError, 'Missing the required parameter path when calling FileApi.download_file' if @api_client.config.client_side_validation && request.path.nil?
220
+ # resource path
221
+ local_var_path = '/editor/storage/file/{path}'
222
+ local_var_path = local_var_path.sub('{' + downcase_first_letter('path') + '}', request.path.to_s)
223
+
224
+ # query parameters
225
+ query_params = {}
226
+ if local_var_path.include? ('{' + downcase_first_letter('storageName') + '}')
227
+ local_var_path = local_var_path.sub('{' + downcase_first_letter('storageName') + '}', request.storage_name.to_s)
228
+ else
229
+ query_params[downcase_first_letter('storageName')] = request.storage_name unless request.storage_name.nil?
230
+ end
231
+ if local_var_path.include? ('{' + downcase_first_letter('versionId') + '}')
232
+ local_var_path = local_var_path.sub('{' + downcase_first_letter('versionId') + '}', request.version_id.to_s)
233
+ else
234
+ query_params[downcase_first_letter('versionId')] = request.version_id unless request.version_id.nil?
235
+ end
236
+
237
+ # header parameters
238
+ header_params = {}
239
+ # HTTP header 'Accept' (if needed)
240
+ header_params['Accept'] = @api_client.select_header_accept(['multipart/form-data'])
241
+ # HTTP header 'Content-Type'
242
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
243
+
244
+ # form parameters
245
+ form_params = {}
246
+
247
+ # http body (model)
248
+ post_body = nil
249
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
250
+ header_params: header_params,
251
+ query_params: query_params,
252
+ form_params: form_params,
253
+ body: post_body,
254
+ access_token: get_access_token,
255
+ return_type: 'File')
256
+ if @api_client.config.debugging
257
+ @api_client.config.logger.debug "API called:
258
+ FileApi#download_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
259
+ end
260
+ [data, status_code, headers]
261
+ end
262
+
263
+ # Move file
264
+ #
265
+ # @param request move_file_request
266
+ # @return [nil]
267
+ def move_file(request)
268
+ move_file_with_http_info(request)
269
+ nil
270
+ end
271
+
272
+ # Move file
273
+ #
274
+ # @param request move_file_request
275
+ # @return [Array<(nil, Fixnum, Hash)>]
276
+ # nil, response status code and response headers
277
+ def move_file_with_http_info(request)
278
+ raise ArgumentError, 'Incorrect request type' unless request.is_a? MoveFileRequest
279
+
280
+ @api_client.config.logger.debug 'Calling API: FileApi.move_file ...' if @api_client.config.debugging
281
+ # verify the required parameter 'src_path' is set
282
+ raise ArgumentError, 'Missing the required parameter src_path when calling FileApi.move_file' if @api_client.config.client_side_validation && request.src_path.nil?
283
+ # verify the required parameter 'dest_path' is set
284
+ raise ArgumentError, 'Missing the required parameter dest_path when calling FileApi.move_file' if @api_client.config.client_side_validation && request.dest_path.nil?
285
+ # resource path
286
+ local_var_path = '/editor/storage/file/move/{srcPath}'
287
+ local_var_path = local_var_path.sub('{' + downcase_first_letter('srcPath') + '}', request.src_path.to_s)
288
+
289
+ # query parameters
290
+ query_params = {}
291
+ query_params[downcase_first_letter('destPath')] = request.dest_path
292
+
293
+ if local_var_path.include? ('{' + downcase_first_letter('srcStorageName') + '}')
294
+ local_var_path = local_var_path.sub('{' + downcase_first_letter('srcStorageName') + '}', request.src_storage_name.to_s)
295
+ else
296
+ query_params[downcase_first_letter('srcStorageName')] = request.src_storage_name unless request.src_storage_name.nil?
297
+ end
298
+ if local_var_path.include? ('{' + downcase_first_letter('destStorageName') + '}')
299
+ local_var_path = local_var_path.sub('{' + downcase_first_letter('destStorageName') + '}', request.dest_storage_name.to_s)
300
+ else
301
+ query_params[downcase_first_letter('destStorageName')] = request.dest_storage_name unless request.dest_storage_name.nil?
302
+ end
303
+ if local_var_path.include? ('{' + downcase_first_letter('versionId') + '}')
304
+ local_var_path = local_var_path.sub('{' + downcase_first_letter('versionId') + '}', request.version_id.to_s)
305
+ else
306
+ query_params[downcase_first_letter('versionId')] = request.version_id unless request.version_id.nil?
307
+ end
308
+
309
+ # header parameters
310
+ header_params = {}
311
+ # HTTP header 'Accept' (if needed)
312
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
313
+ # HTTP header 'Content-Type'
314
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
315
+
316
+ # form parameters
317
+ form_params = {}
318
+
319
+ # http body (model)
320
+ post_body = nil
321
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
322
+ header_params: header_params,
323
+ query_params: query_params,
324
+ form_params: form_params,
325
+ body: post_body,
326
+ access_token: get_access_token)
327
+ if @api_client.config.debugging
328
+ @api_client.config.logger.debug "API called:
329
+ FileApi#move_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
330
+ end
331
+ [data, status_code, headers]
332
+ end
333
+
334
+ # Upload file
335
+ #
336
+ # @param request upload_file_request
337
+ # @return [FilesUploadResult]
338
+ def upload_file(request)
339
+ data, _status_code, _headers = upload_file_with_http_info(request)
340
+ data
341
+ end
342
+
343
+ # Upload file
344
+ #
345
+ # @param request upload_file_request
346
+ # @return [Array<(FilesUploadResult, Fixnum, Hash)>]
347
+ # FilesUploadResult data, response status code and response headers
348
+ def upload_file_with_http_info(request)
349
+ raise ArgumentError, 'Incorrect request type' unless request.is_a? UploadFileRequest
350
+
351
+ @api_client.config.logger.debug 'Calling API: FileApi.upload_file ...' if @api_client.config.debugging
352
+ # verify the required parameter 'path' is set
353
+ raise ArgumentError, 'Missing the required parameter path when calling FileApi.upload_file' if @api_client.config.client_side_validation && request.path.nil?
354
+ # verify the required parameter 'file' is set
355
+ raise ArgumentError, 'Missing the required parameter file when calling FileApi.upload_file' if @api_client.config.client_side_validation && request.file.nil?
356
+ # resource path
357
+ local_var_path = '/editor/storage/file/{path}'
358
+ local_var_path = local_var_path.sub('{' + downcase_first_letter('path') + '}', request.path.to_s)
359
+
360
+ # query parameters
361
+ query_params = {}
362
+ if local_var_path.include? ('{' + downcase_first_letter('storageName') + '}')
363
+ local_var_path = local_var_path.sub('{' + downcase_first_letter('storageName') + '}', request.storage_name.to_s)
364
+ else
365
+ query_params[downcase_first_letter('storageName')] = request.storage_name unless request.storage_name.nil?
366
+ end
367
+
368
+ # header parameters
369
+ header_params = {}
370
+ # HTTP header 'Accept' (if needed)
371
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
372
+ # HTTP header 'Content-Type'
373
+ header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
374
+
375
+ # form parameters
376
+ form_params = {}
377
+ form_params[downcase_first_letter('File')] = request.file
378
+
379
+ # http body (model)
380
+ post_body = nil
381
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
382
+ header_params: header_params,
383
+ query_params: query_params,
384
+ form_params: form_params,
385
+ body: post_body,
386
+ access_token: get_access_token,
387
+ return_type: 'FilesUploadResult')
388
+ if @api_client.config.debugging
389
+ @api_client.config.logger.debug "API called:
390
+ FileApi#upload_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
391
+ end
392
+ [data, status_code, headers]
393
+ end
394
+
395
+ #
396
+ # Helper method to convert first letter to downcase
397
+ #
398
+ private def downcase_first_letter(str)
399
+ value = str[0].downcase + str[1..-1]
400
+ value
401
+ end
402
+
403
+ #
404
+ # Retrieves access token
405
+ #
406
+ private def get_access_token
407
+ if @access_token.nil? then
408
+ request_access_token
409
+ end
410
+
411
+ @access_token
412
+ end
413
+
414
+ #
415
+ # Gets a access token from server
416
+ #
417
+ private def request_access_token
418
+ auth_config = Configuration.new(@config.app_sid, @config.app_key)
419
+ auth_config.api_base_url = @config.api_base_url
420
+ auth_config.debugging = @config.debugging
421
+ auth_config.logger = @config.logger
422
+ auth_config.temp_folder_path = @config.temp_folder_path
423
+ auth_config.client_side_validation = @config.client_side_validation
424
+ auth_config.api_version = ''
425
+
426
+ auth_api_client = ApiClient.new(auth_config)
427
+
428
+ request_url = "/connect/token"
429
+ post_data = "grant_type=client_credentials&client_id=#{@config.app_sid}&client_secret=#{@config.app_key}"
430
+
431
+ data, _status_code, _header = auth_api_client.call_api(:POST, request_url, :body => post_data, :return_type => 'Object')
432
+
433
+ @access_token = data[:access_token]
434
+
435
+ expires_in_seconds = data[:expires_in].to_i - 5 * 60
436
+ expires_in_days = Rational(expires_in_seconds, 60 * 60 * 24)
437
+ @access_token_expires_at = DateTime.now + expires_in_days
438
+ end
439
+
440
+ # requires all files inside a directory from current dir
441
+ # @param _dir can be relative path like '/lib' or "../lib"
442
+ private def require_all(_dir)
443
+ Dir[File.expand_path(File.join(File.dirname(File.absolute_path(__FILE__)), _dir)) + "/*.rb"].each do |file|
444
+ require file
445
+ end
446
+ end
447
+ end
448
+ end
449
+ #
450
+ # --------------------------------------------------------------------------------------------------------------------
451
+ # <copyright company="Aspose Pty Ltd" file="copy_file_request.rb">
452
+ # Copyright (c) 2003-2019 Aspose Pty Ltd
453
+ # </copyright>
454
+ # <summary>
455
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
456
+ # of this software and associated documentation files (the "Software"), to deal
457
+ # in the Software without restriction, including without limitation the rights
458
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
459
+ # copies of the Software, and to permit persons to whom the Software is
460
+ # furnished to do so, subject to the following conditions:
461
+ #
462
+ # The above copyright notice and this permission notice shall be included in all
463
+ # copies or substantial portions of the Software.
464
+ #
465
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
466
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
467
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
468
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
469
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
470
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
471
+ # SOFTWARE.
472
+ # </summary>
473
+ # --------------------------------------------------------------------------------------------------------------------
474
+ #
475
+
476
+ module GroupDocsEditorCloud
477
+
478
+ #
479
+ # Request model for copy_file operation.
480
+ #
481
+ class CopyFileRequest
482
+
483
+ # Source file path e.g. '/folder/file.ext'
484
+ attr_accessor :src_path
485
+ # Destination file path
486
+ attr_accessor :dest_path
487
+ # Source storage name
488
+ attr_accessor :src_storage_name
489
+ # Destination storage name
490
+ attr_accessor :dest_storage_name
491
+ # File version ID to copy
492
+ attr_accessor :version_id
493
+
494
+ #
495
+ # Initializes a new instance.
496
+ # @param src_path Source file path e.g. '/folder/file.ext'
497
+ # @param dest_path Destination file path
498
+ # @param src_storage_name Source storage name
499
+ # @param dest_storage_name Destination storage name
500
+ # @param version_id File version ID to copy
501
+ def initialize(src_path, dest_path, src_storage_name = nil, dest_storage_name = nil, version_id = nil)
502
+ self.src_path = src_path
503
+ self.dest_path = dest_path
504
+ self.src_storage_name = src_storage_name
505
+ self.dest_storage_name = dest_storage_name
506
+ self.version_id = version_id
507
+ end
508
+ end
509
+ end
510
+ #
511
+ # --------------------------------------------------------------------------------------------------------------------
512
+ # <copyright company="Aspose Pty Ltd" file="delete_file_request.rb">
513
+ # Copyright (c) 2003-2019 Aspose Pty Ltd
514
+ # </copyright>
515
+ # <summary>
516
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
517
+ # of this software and associated documentation files (the "Software"), to deal
518
+ # in the Software without restriction, including without limitation the rights
519
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
520
+ # copies of the Software, and to permit persons to whom the Software is
521
+ # furnished to do so, subject to the following conditions:
522
+ #
523
+ # The above copyright notice and this permission notice shall be included in all
524
+ # copies or substantial portions of the Software.
525
+ #
526
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
527
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
528
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
529
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
530
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
531
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
532
+ # SOFTWARE.
533
+ # </summary>
534
+ # --------------------------------------------------------------------------------------------------------------------
535
+ #
536
+
537
+ module GroupDocsEditorCloud
538
+
539
+ #
540
+ # Request model for delete_file operation.
541
+ #
542
+ class DeleteFileRequest
543
+
544
+ # File path e.g. '/folder/file.ext'
545
+ attr_accessor :path
546
+ # Storage name
547
+ attr_accessor :storage_name
548
+ # File version ID to delete
549
+ attr_accessor :version_id
550
+
551
+ #
552
+ # Initializes a new instance.
553
+ # @param path File path e.g. '/folder/file.ext'
554
+ # @param storage_name Storage name
555
+ # @param version_id File version ID to delete
556
+ def initialize(path, storage_name = nil, version_id = nil)
557
+ self.path = path
558
+ self.storage_name = storage_name
559
+ self.version_id = version_id
560
+ end
561
+ end
562
+ end
563
+ #
564
+ # --------------------------------------------------------------------------------------------------------------------
565
+ # <copyright company="Aspose Pty Ltd" file="download_file_request.rb">
566
+ # Copyright (c) 2003-2019 Aspose Pty Ltd
567
+ # </copyright>
568
+ # <summary>
569
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
570
+ # of this software and associated documentation files (the "Software"), to deal
571
+ # in the Software without restriction, including without limitation the rights
572
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
573
+ # copies of the Software, and to permit persons to whom the Software is
574
+ # furnished to do so, subject to the following conditions:
575
+ #
576
+ # The above copyright notice and this permission notice shall be included in all
577
+ # copies or substantial portions of the Software.
578
+ #
579
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
580
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
581
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
582
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
583
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
584
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
585
+ # SOFTWARE.
586
+ # </summary>
587
+ # --------------------------------------------------------------------------------------------------------------------
588
+ #
589
+
590
+ module GroupDocsEditorCloud
591
+
592
+ #
593
+ # Request model for download_file operation.
594
+ #
595
+ class DownloadFileRequest
596
+
597
+ # File path e.g. '/folder/file.ext'
598
+ attr_accessor :path
599
+ # Storage name
600
+ attr_accessor :storage_name
601
+ # File version ID to download
602
+ attr_accessor :version_id
603
+
604
+ #
605
+ # Initializes a new instance.
606
+ # @param path File path e.g. '/folder/file.ext'
607
+ # @param storage_name Storage name
608
+ # @param version_id File version ID to download
609
+ def initialize(path, storage_name = nil, version_id = nil)
610
+ self.path = path
611
+ self.storage_name = storage_name
612
+ self.version_id = version_id
613
+ end
614
+ end
615
+ end
616
+ #
617
+ # --------------------------------------------------------------------------------------------------------------------
618
+ # <copyright company="Aspose Pty Ltd" file="move_file_request.rb">
619
+ # Copyright (c) 2003-2019 Aspose Pty Ltd
620
+ # </copyright>
621
+ # <summary>
622
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
623
+ # of this software and associated documentation files (the "Software"), to deal
624
+ # in the Software without restriction, including without limitation the rights
625
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
626
+ # copies of the Software, and to permit persons to whom the Software is
627
+ # furnished to do so, subject to the following conditions:
628
+ #
629
+ # The above copyright notice and this permission notice shall be included in all
630
+ # copies or substantial portions of the Software.
631
+ #
632
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
633
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
634
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
635
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
636
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
637
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
638
+ # SOFTWARE.
639
+ # </summary>
640
+ # --------------------------------------------------------------------------------------------------------------------
641
+ #
642
+
643
+ module GroupDocsEditorCloud
644
+
645
+ #
646
+ # Request model for move_file operation.
647
+ #
648
+ class MoveFileRequest
649
+
650
+ # Source file path e.g. '/src.ext'
651
+ attr_accessor :src_path
652
+ # Destination file path e.g. '/dest.ext'
653
+ attr_accessor :dest_path
654
+ # Source storage name
655
+ attr_accessor :src_storage_name
656
+ # Destination storage name
657
+ attr_accessor :dest_storage_name
658
+ # File version ID to move
659
+ attr_accessor :version_id
660
+
661
+ #
662
+ # Initializes a new instance.
663
+ # @param src_path Source file path e.g. '/src.ext'
664
+ # @param dest_path Destination file path e.g. '/dest.ext'
665
+ # @param src_storage_name Source storage name
666
+ # @param dest_storage_name Destination storage name
667
+ # @param version_id File version ID to move
668
+ def initialize(src_path, dest_path, src_storage_name = nil, dest_storage_name = nil, version_id = nil)
669
+ self.src_path = src_path
670
+ self.dest_path = dest_path
671
+ self.src_storage_name = src_storage_name
672
+ self.dest_storage_name = dest_storage_name
673
+ self.version_id = version_id
674
+ end
675
+ end
676
+ end
677
+ #
678
+ # --------------------------------------------------------------------------------------------------------------------
679
+ # <copyright company="Aspose Pty Ltd" file="upload_file_request.rb">
680
+ # Copyright (c) 2003-2019 Aspose Pty Ltd
681
+ # </copyright>
682
+ # <summary>
683
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
684
+ # of this software and associated documentation files (the "Software"), to deal
685
+ # in the Software without restriction, including without limitation the rights
686
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
687
+ # copies of the Software, and to permit persons to whom the Software is
688
+ # furnished to do so, subject to the following conditions:
689
+ #
690
+ # The above copyright notice and this permission notice shall be included in all
691
+ # copies or substantial portions of the Software.
692
+ #
693
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
694
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
695
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
696
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
697
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
698
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
699
+ # SOFTWARE.
700
+ # </summary>
701
+ # --------------------------------------------------------------------------------------------------------------------
702
+ #
703
+
704
+ module GroupDocsEditorCloud
705
+
706
+ #
707
+ # Request model for upload_file operation.
708
+ #
709
+ class UploadFileRequest
710
+
711
+ # Path where to upload including filename and extension e.g. /file.ext or /Folder 1/file.ext If the content is multipart and path does not contains the file name it tries to get them from filename parameter from Content-Disposition header.
712
+ attr_accessor :path
713
+ # File to upload
714
+ attr_accessor :file
715
+ # Storage name
716
+ attr_accessor :storage_name
717
+
718
+ #
719
+ # Initializes a new instance.
720
+ # @param path Path where to upload including filename and extension e.g. /file.ext or /Folder 1/file.ext If the content is multipart and path does not contains the file name it tries to get them from filename parameter from Content-Disposition header.
721
+ # @param file File to upload
722
+ # @param storage_name Storage name
723
+ def initialize(path, file, storage_name = nil)
724
+ self.path = path
725
+ self.file = file
726
+ self.storage_name = storage_name
727
+ end
728
+ end
729
+ end