groupdocs_parser_cloud 19.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +7 -0
  2. data/lib/groupdocs_parser_cloud.rb +91 -0
  3. data/lib/groupdocs_parser_cloud/api/file_api.rb +729 -0
  4. data/lib/groupdocs_parser_cloud/api/folder_api.rb +694 -0
  5. data/lib/groupdocs_parser_cloud/api/info_api.rb +363 -0
  6. data/lib/groupdocs_parser_cloud/api/parse_api.rb +411 -0
  7. data/lib/groupdocs_parser_cloud/api/storage_api.rb +541 -0
  8. data/lib/groupdocs_parser_cloud/api/template_api.rb +410 -0
  9. data/lib/groupdocs_parser_cloud/api_client.rb +380 -0
  10. data/lib/groupdocs_parser_cloud/api_error.rb +64 -0
  11. data/lib/groupdocs_parser_cloud/configuration.rb +95 -0
  12. data/lib/groupdocs_parser_cloud/models/container_item.rb +246 -0
  13. data/lib/groupdocs_parser_cloud/models/container_item_info.rb +224 -0
  14. data/lib/groupdocs_parser_cloud/models/container_options.rb +224 -0
  15. data/lib/groupdocs_parser_cloud/models/container_result.rb +216 -0
  16. data/lib/groupdocs_parser_cloud/models/coordinates.rb +264 -0
  17. data/lib/groupdocs_parser_cloud/models/create_template_options.rb +234 -0
  18. data/lib/groupdocs_parser_cloud/models/detector_parameters.rb +266 -0
  19. data/lib/groupdocs_parser_cloud/models/disc_usage.rb +234 -0
  20. data/lib/groupdocs_parser_cloud/models/error.rb +244 -0
  21. data/lib/groupdocs_parser_cloud/models/error_details.rb +229 -0
  22. data/lib/groupdocs_parser_cloud/models/field.rb +234 -0
  23. data/lib/groupdocs_parser_cloud/models/field_data.rb +249 -0
  24. data/lib/groupdocs_parser_cloud/models/field_position.rb +344 -0
  25. data/lib/groupdocs_parser_cloud/models/file_info.rb +234 -0
  26. data/lib/groupdocs_parser_cloud/models/file_type.rb +224 -0
  27. data/lib/groupdocs_parser_cloud/models/file_version.rb +289 -0
  28. data/lib/groupdocs_parser_cloud/models/file_versions.rb +216 -0
  29. data/lib/groupdocs_parser_cloud/models/files_list.rb +216 -0
  30. data/lib/groupdocs_parser_cloud/models/files_upload_result.rb +228 -0
  31. data/lib/groupdocs_parser_cloud/models/format.rb +224 -0
  32. data/lib/groupdocs_parser_cloud/models/formats_result.rb +216 -0
  33. data/lib/groupdocs_parser_cloud/models/formatted_text_options.rb +214 -0
  34. data/lib/groupdocs_parser_cloud/models/image.rb +224 -0
  35. data/lib/groupdocs_parser_cloud/models/image_page.rb +231 -0
  36. data/lib/groupdocs_parser_cloud/models/images_options.rb +254 -0
  37. data/lib/groupdocs_parser_cloud/models/images_result.rb +228 -0
  38. data/lib/groupdocs_parser_cloud/models/info_options.rb +224 -0
  39. data/lib/groupdocs_parser_cloud/models/info_result.rb +244 -0
  40. data/lib/groupdocs_parser_cloud/models/object_exist.rb +234 -0
  41. data/lib/groupdocs_parser_cloud/models/page.rb +229 -0
  42. data/lib/groupdocs_parser_cloud/models/page_area.rb +244 -0
  43. data/lib/groupdocs_parser_cloud/models/page_table_area.rb +246 -0
  44. data/lib/groupdocs_parser_cloud/models/page_table_area_cell.rb +274 -0
  45. data/lib/groupdocs_parser_cloud/models/page_text_area.rb +251 -0
  46. data/lib/groupdocs_parser_cloud/models/parse_options.rb +244 -0
  47. data/lib/groupdocs_parser_cloud/models/parse_result.rb +231 -0
  48. data/lib/groupdocs_parser_cloud/models/parser_options.rb +224 -0
  49. data/lib/groupdocs_parser_cloud/models/point.rb +234 -0
  50. data/lib/groupdocs_parser_cloud/models/rectangle.rb +234 -0
  51. data/lib/groupdocs_parser_cloud/models/size.rb +234 -0
  52. data/lib/groupdocs_parser_cloud/models/storage_exist.rb +219 -0
  53. data/lib/groupdocs_parser_cloud/models/storage_file.rb +264 -0
  54. data/lib/groupdocs_parser_cloud/models/table.rb +244 -0
  55. data/lib/groupdocs_parser_cloud/models/table_layout.rb +228 -0
  56. data/lib/groupdocs_parser_cloud/models/template.rb +228 -0
  57. data/lib/groupdocs_parser_cloud/models/template_options.rb +224 -0
  58. data/lib/groupdocs_parser_cloud/models/template_result.rb +224 -0
  59. data/lib/groupdocs_parser_cloud/models/text_options.rb +254 -0
  60. data/lib/groupdocs_parser_cloud/models/text_page.rb +229 -0
  61. data/lib/groupdocs_parser_cloud/models/text_result.rb +226 -0
  62. data/lib/groupdocs_parser_cloud/models/text_style.rb +269 -0
  63. data/lib/groupdocs_parser_cloud/version.rb +29 -0
  64. metadata +174 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 411ff34fc68e1dc5dcac9d551d02665c2c3d64b3
4
+ data.tar.gz: f46434261ffe71cfcddc2fe2ea1c5006654cd041
5
+ SHA512:
6
+ metadata.gz: 3f6e88cc6b36f5d42cb2f3b805c704c26097c6fb6ff5731e093cdf16735732b8f109f10e8a4c2f9ac1d274b21093e206a47ee396c343af78e782f1adf66b0e77
7
+ data.tar.gz: 577f0f63d496b933e82909738106a0f72239666564b1235af11af8e211c00c5da7c987b1910173b6ef45d8fca1d1bdeaaac13b708a5082637070b50c97862152
@@ -0,0 +1,91 @@
1
+ # ------------------------------------------------------------------------------------
2
+ # <copyright company="Aspose Pty Ltd" file="groupdocs_parser_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_parser_cloud/api_client'
28
+ require_relative 'groupdocs_parser_cloud/api_error'
29
+ require_relative 'groupdocs_parser_cloud/version'
30
+ require_relative 'groupdocs_parser_cloud/configuration'
31
+
32
+ # Models
33
+ require_relative 'groupdocs_parser_cloud/models/container_item'
34
+ require_relative 'groupdocs_parser_cloud/models/container_item_info'
35
+ require_relative 'groupdocs_parser_cloud/models/container_result'
36
+ require_relative 'groupdocs_parser_cloud/models/coordinates'
37
+ require_relative 'groupdocs_parser_cloud/models/create_template_options'
38
+ require_relative 'groupdocs_parser_cloud/models/detector_parameters'
39
+ require_relative 'groupdocs_parser_cloud/models/disc_usage'
40
+ require_relative 'groupdocs_parser_cloud/models/error'
41
+ require_relative 'groupdocs_parser_cloud/models/error_details'
42
+ require_relative 'groupdocs_parser_cloud/models/field'
43
+ require_relative 'groupdocs_parser_cloud/models/field_data'
44
+ require_relative 'groupdocs_parser_cloud/models/field_position'
45
+ require_relative 'groupdocs_parser_cloud/models/file_info'
46
+ require_relative 'groupdocs_parser_cloud/models/file_type'
47
+ require_relative 'groupdocs_parser_cloud/models/file_versions'
48
+ require_relative 'groupdocs_parser_cloud/models/files_list'
49
+ require_relative 'groupdocs_parser_cloud/models/files_upload_result'
50
+ require_relative 'groupdocs_parser_cloud/models/format'
51
+ require_relative 'groupdocs_parser_cloud/models/formats_result'
52
+ require_relative 'groupdocs_parser_cloud/models/formatted_text_options'
53
+ require_relative 'groupdocs_parser_cloud/models/image'
54
+ require_relative 'groupdocs_parser_cloud/models/image_page'
55
+ require_relative 'groupdocs_parser_cloud/models/images_result'
56
+ require_relative 'groupdocs_parser_cloud/models/info_result'
57
+ require_relative 'groupdocs_parser_cloud/models/object_exist'
58
+ require_relative 'groupdocs_parser_cloud/models/page'
59
+ require_relative 'groupdocs_parser_cloud/models/page_area'
60
+ require_relative 'groupdocs_parser_cloud/models/page_table_area'
61
+ require_relative 'groupdocs_parser_cloud/models/page_table_area_cell'
62
+ require_relative 'groupdocs_parser_cloud/models/page_text_area'
63
+ require_relative 'groupdocs_parser_cloud/models/parse_result'
64
+ require_relative 'groupdocs_parser_cloud/models/parser_options'
65
+ require_relative 'groupdocs_parser_cloud/models/point'
66
+ require_relative 'groupdocs_parser_cloud/models/rectangle'
67
+ require_relative 'groupdocs_parser_cloud/models/size'
68
+ require_relative 'groupdocs_parser_cloud/models/storage_exist'
69
+ require_relative 'groupdocs_parser_cloud/models/storage_file'
70
+ require_relative 'groupdocs_parser_cloud/models/table'
71
+ require_relative 'groupdocs_parser_cloud/models/table_layout'
72
+ require_relative 'groupdocs_parser_cloud/models/template'
73
+ require_relative 'groupdocs_parser_cloud/models/template_options'
74
+ require_relative 'groupdocs_parser_cloud/models/template_result'
75
+ require_relative 'groupdocs_parser_cloud/models/text_page'
76
+ require_relative 'groupdocs_parser_cloud/models/text_result'
77
+ require_relative 'groupdocs_parser_cloud/models/text_style'
78
+ require_relative 'groupdocs_parser_cloud/models/container_options'
79
+ require_relative 'groupdocs_parser_cloud/models/file_version'
80
+ require_relative 'groupdocs_parser_cloud/models/images_options'
81
+ require_relative 'groupdocs_parser_cloud/models/info_options'
82
+ require_relative 'groupdocs_parser_cloud/models/parse_options'
83
+ require_relative 'groupdocs_parser_cloud/models/text_options'
84
+
85
+ # APIs
86
+ require_relative 'groupdocs_parser_cloud/api/file_api'
87
+ require_relative 'groupdocs_parser_cloud/api/folder_api'
88
+ require_relative 'groupdocs_parser_cloud/api/info_api'
89
+ require_relative 'groupdocs_parser_cloud/api/parse_api'
90
+ require_relative 'groupdocs_parser_cloud/api/storage_api'
91
+ require_relative 'groupdocs_parser_cloud/api/template_api'
@@ -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 GroupDocsParserCloud
30
+ #
31
+ # GroupDocs.Parser 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 = '/parser/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 = '/parser/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 = '/parser/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 = '/parser/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 = '/parser/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 GroupDocsParserCloud
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 GroupDocsParserCloud
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 GroupDocsParserCloud
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 GroupDocsParserCloud
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 GroupDocsParserCloud
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