groupdocs_merger_cloud 19.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +7 -0
  2. data/lib/groupdocs_merger_cloud.rb +72 -0
  3. data/lib/groupdocs_merger_cloud/api/document_api.rb +411 -0
  4. data/lib/groupdocs_merger_cloud/api/file_api.rb +729 -0
  5. data/lib/groupdocs_merger_cloud/api/folder_api.rb +694 -0
  6. data/lib/groupdocs_merger_cloud/api/info_api.rb +266 -0
  7. data/lib/groupdocs_merger_cloud/api/pages_api.rb +702 -0
  8. data/lib/groupdocs_merger_cloud/api/security_api.rb +528 -0
  9. data/lib/groupdocs_merger_cloud/api/storage_api.rb +541 -0
  10. data/lib/groupdocs_merger_cloud/api_client.rb +380 -0
  11. data/lib/groupdocs_merger_cloud/api_error.rb +58 -0
  12. data/lib/groupdocs_merger_cloud/configuration.rb +95 -0
  13. data/lib/groupdocs_merger_cloud/models/disc_usage.rb +234 -0
  14. data/lib/groupdocs_merger_cloud/models/document_result.rb +214 -0
  15. data/lib/groupdocs_merger_cloud/models/error.rb +244 -0
  16. data/lib/groupdocs_merger_cloud/models/error_details.rb +229 -0
  17. data/lib/groupdocs_merger_cloud/models/extract_options.rb +318 -0
  18. data/lib/groupdocs_merger_cloud/models/file_info.rb +244 -0
  19. data/lib/groupdocs_merger_cloud/models/file_version.rb +289 -0
  20. data/lib/groupdocs_merger_cloud/models/file_versions.rb +216 -0
  21. data/lib/groupdocs_merger_cloud/models/files_list.rb +216 -0
  22. data/lib/groupdocs_merger_cloud/models/files_upload_result.rb +228 -0
  23. data/lib/groupdocs_merger_cloud/models/format.rb +224 -0
  24. data/lib/groupdocs_merger_cloud/models/formats_result.rb +216 -0
  25. data/lib/groupdocs_merger_cloud/models/info_result.rb +251 -0
  26. data/lib/groupdocs_merger_cloud/models/join_item.rb +308 -0
  27. data/lib/groupdocs_merger_cloud/models/join_options.rb +226 -0
  28. data/lib/groupdocs_merger_cloud/models/move_options.rb +254 -0
  29. data/lib/groupdocs_merger_cloud/models/multi_document_result.rb +216 -0
  30. data/lib/groupdocs_merger_cloud/models/object_exist.rb +234 -0
  31. data/lib/groupdocs_merger_cloud/models/options.rb +224 -0
  32. data/lib/groupdocs_merger_cloud/models/orientation_options.rb +349 -0
  33. data/lib/groupdocs_merger_cloud/models/page_info.rb +264 -0
  34. data/lib/groupdocs_merger_cloud/models/page_options.rb +318 -0
  35. data/lib/groupdocs_merger_cloud/models/password_result.rb +219 -0
  36. data/lib/groupdocs_merger_cloud/models/preview_options.rb +379 -0
  37. data/lib/groupdocs_merger_cloud/models/remove_options.rb +318 -0
  38. data/lib/groupdocs_merger_cloud/models/rotate_options.rb +349 -0
  39. data/lib/groupdocs_merger_cloud/models/split_options.rb +349 -0
  40. data/lib/groupdocs_merger_cloud/models/storage_exist.rb +219 -0
  41. data/lib/groupdocs_merger_cloud/models/storage_file.rb +264 -0
  42. data/lib/groupdocs_merger_cloud/models/swap_options.rb +254 -0
  43. data/lib/groupdocs_merger_cloud/models/update_password_options.rb +234 -0
  44. data/lib/groupdocs_merger_cloud/version.rb +29 -0
  45. metadata +155 -0
@@ -0,0 +1,266 @@
1
+ # -----------------------------------------------------------------------------------
2
+ # <copyright company="Aspose Pty Ltd" file="info.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 GroupDocsMergerCloud
30
+ #
31
+ # GroupDocs.Merger Cloud API
32
+ #
33
+ class InfoApi
34
+ attr_accessor :config
35
+
36
+ #make InfoApi.new private
37
+ private_class_method :new
38
+
39
+ # Initializes new instance of InfoApi
40
+ #
41
+ # @param [config] Configuration
42
+ # @return [InfoApi] New instance of InfoApi
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 InfoApi
50
+ #
51
+ # @param [app_sid] Application identifier (App SID)
52
+ # @param [app_key] Application private key (App Key)
53
+ # @return [InfoApi] New instance of InfoApi
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 InfoApi
60
+ #
61
+ # @param [config] Configuration
62
+ # @return [InfoApi] New instance of InfoApi
63
+ def self.from_config(config)
64
+ return new(config)
65
+ end
66
+
67
+ # Retrieve information about document pages: size, height, width etc.
68
+ #
69
+ # @param request get_info_request
70
+ # @return [InfoResult]
71
+ def get_info(request)
72
+ data, _status_code, _headers = get_info_with_http_info(request)
73
+ data
74
+ end
75
+
76
+ # Retrieve information about document pages: size, height, width etc.
77
+ #
78
+ # @param request get_info_request
79
+ # @return [Array<(InfoResult, Fixnum, Hash)>]
80
+ # InfoResult data, response status code and response headers
81
+ def get_info_with_http_info(request)
82
+ raise ArgumentError, 'Incorrect request type' unless request.is_a? GetInfoRequest
83
+
84
+ @api_client.config.logger.debug 'Calling API: InfoApi.get_info ...' if @api_client.config.debugging
85
+ # verify the required parameter 'file_info' is set
86
+ raise ArgumentError, 'Missing the required parameter file_info when calling InfoApi.get_info' if @api_client.config.client_side_validation && request.file_info.nil?
87
+ # resource path
88
+ local_var_path = '/merger/info'
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.file_info)
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: 'InfoResult')
112
+ if @api_client.config.debugging
113
+ @api_client.config.logger.debug "API called:
114
+ InfoApi#get_info\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
115
+ end
116
+ [data, status_code, headers]
117
+ end
118
+
119
+ # List supported file formats
120
+ #
121
+ # @return [FormatsResult]
122
+ def get_supported_file_formats()
123
+ data, _status_code, _headers = get_supported_file_formats_with_http_info()
124
+ data
125
+ end
126
+
127
+ # List supported file formats
128
+ #
129
+
130
+ # @return [Array<(FormatsResult, Fixnum, Hash)>]
131
+ # FormatsResult data, response status code and response headers
132
+ def get_supported_file_formats_with_http_info()
133
+
134
+
135
+ @api_client.config.logger.debug 'Calling API: InfoApi.get_supported_file_formats ...' if @api_client.config.debugging
136
+ # resource path
137
+ local_var_path = '/merger/formats'
138
+
139
+ # query parameters
140
+ query_params = {}
141
+
142
+ # header parameters
143
+ header_params = {}
144
+ # HTTP header 'Accept' (if needed)
145
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
146
+ # HTTP header 'Content-Type'
147
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
148
+
149
+ # form parameters
150
+ form_params = {}
151
+
152
+ # http body (model)
153
+ post_body = nil
154
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
155
+ header_params: header_params,
156
+ query_params: query_params,
157
+ form_params: form_params,
158
+ body: post_body,
159
+ access_token: get_access_token,
160
+ return_type: 'FormatsResult')
161
+ if @api_client.config.debugging
162
+ @api_client.config.logger.debug "API called:
163
+ InfoApi#get_supported_file_formats\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
164
+ end
165
+ [data, status_code, headers]
166
+ end
167
+
168
+ #
169
+ # Helper method to convert first letter to downcase
170
+ #
171
+ private def downcase_first_letter(str)
172
+ value = str[0].downcase + str[1..-1]
173
+ value
174
+ end
175
+
176
+ #
177
+ # Retrieves access token
178
+ #
179
+ private def get_access_token
180
+ if @access_token.nil? then
181
+ request_access_token
182
+ end
183
+
184
+ @access_token
185
+ end
186
+
187
+ #
188
+ # Gets a access token from server
189
+ #
190
+ private def request_access_token
191
+ auth_config = Configuration.new(@config.app_sid, @config.app_key)
192
+ auth_config.api_base_url = @config.api_base_url
193
+ auth_config.debugging = @config.debugging
194
+ auth_config.logger = @config.logger
195
+ auth_config.temp_folder_path = @config.temp_folder_path
196
+ auth_config.client_side_validation = @config.client_side_validation
197
+ auth_config.api_version = ''
198
+
199
+ auth_api_client = ApiClient.new(auth_config)
200
+
201
+ request_url = "/connect/token"
202
+ post_data = "grant_type=client_credentials&client_id=#{@config.app_sid}&client_secret=#{@config.app_key}"
203
+
204
+ data, _status_code, _header = auth_api_client.call_api(:POST, request_url, :body => post_data, :return_type => 'Object')
205
+
206
+ @access_token = data[:access_token]
207
+
208
+ expires_in_seconds = data[:expires_in].to_i - 5 * 60
209
+ expires_in_days = Rational(expires_in_seconds, 60 * 60 * 24)
210
+ @access_token_expires_at = DateTime.now + expires_in_days
211
+ end
212
+
213
+ # requires all files inside a directory from current dir
214
+ # @param _dir can be relative path like '/lib' or "../lib"
215
+ private def require_all(_dir)
216
+ Dir[File.expand_path(File.join(File.dirname(File.absolute_path(__FILE__)), _dir)) + "/*.rb"].each do |file|
217
+ require file
218
+ end
219
+ end
220
+ end
221
+ end
222
+ #
223
+ # --------------------------------------------------------------------------------------------------------------------
224
+ # <copyright company="Aspose Pty Ltd" file="get_info_request.rb">
225
+ # Copyright (c) 2003-2019 Aspose Pty Ltd
226
+ # </copyright>
227
+ # <summary>
228
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
229
+ # of this software and associated documentation files (the "Software"), to deal
230
+ # in the Software without restriction, including without limitation the rights
231
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
232
+ # copies of the Software, and to permit persons to whom the Software is
233
+ # furnished to do so, subject to the following conditions:
234
+ #
235
+ # The above copyright notice and this permission notice shall be included in all
236
+ # copies or substantial portions of the Software.
237
+ #
238
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
239
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
240
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
241
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
242
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
243
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
244
+ # SOFTWARE.
245
+ # </summary>
246
+ # --------------------------------------------------------------------------------------------------------------------
247
+ #
248
+
249
+ module GroupDocsMergerCloud
250
+
251
+ #
252
+ # Request model for get_info operation.
253
+ #
254
+ class GetInfoRequest
255
+
256
+ # File Info
257
+ attr_accessor :file_info
258
+
259
+ #
260
+ # Initializes a new instance.
261
+ # @param file_info File Info
262
+ def initialize(file_info)
263
+ self.file_info = file_info
264
+ end
265
+ end
266
+ end
@@ -0,0 +1,702 @@
1
+ # -----------------------------------------------------------------------------------
2
+ # <copyright company="Aspose Pty Ltd" file="pages.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 GroupDocsMergerCloud
30
+ #
31
+ # GroupDocs.Merger Cloud API
32
+ #
33
+ class PagesApi
34
+ attr_accessor :config
35
+
36
+ #make PagesApi.new private
37
+ private_class_method :new
38
+
39
+ # Initializes new instance of PagesApi
40
+ #
41
+ # @param [config] Configuration
42
+ # @return [PagesApi] New instance of PagesApi
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 PagesApi
50
+ #
51
+ # @param [app_sid] Application identifier (App SID)
52
+ # @param [app_key] Application private key (App Key)
53
+ # @return [PagesApi] New instance of PagesApi
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 PagesApi
60
+ #
61
+ # @param [config] Configuration
62
+ # @return [PagesApi] New instance of PagesApi
63
+ def self.from_config(config)
64
+ return new(config)
65
+ end
66
+
67
+ # Make new document with some pages from source document
68
+ #
69
+ # @param request extract_request
70
+ # @return [DocumentResult]
71
+ def extract(request)
72
+ data, _status_code, _headers = extract_with_http_info(request)
73
+ data
74
+ end
75
+
76
+ # Make new document with some pages from source document
77
+ #
78
+ # @param request extract_request
79
+ # @return [Array<(DocumentResult, Fixnum, Hash)>]
80
+ # DocumentResult data, response status code and response headers
81
+ def extract_with_http_info(request)
82
+ raise ArgumentError, 'Incorrect request type' unless request.is_a? ExtractRequest
83
+
84
+ @api_client.config.logger.debug 'Calling API: PagesApi.extract ...' if @api_client.config.debugging
85
+ # verify the required parameter 'options' is set
86
+ raise ArgumentError, 'Missing the required parameter options when calling PagesApi.extract' if @api_client.config.client_side_validation && request.options.nil?
87
+ # resource path
88
+ local_var_path = '/merger/pages/extract'
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.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: 'DocumentResult')
112
+ if @api_client.config.debugging
113
+ @api_client.config.logger.debug "API called:
114
+ PagesApi#extract\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
115
+ end
116
+ [data, status_code, headers]
117
+ end
118
+
119
+ # Move page to a new position within document
120
+ #
121
+ # @param request move_request
122
+ # @return [DocumentResult]
123
+ def move(request)
124
+ data, _status_code, _headers = move_with_http_info(request)
125
+ data
126
+ end
127
+
128
+ # Move page to a new position within document
129
+ #
130
+ # @param request move_request
131
+ # @return [Array<(DocumentResult, Fixnum, Hash)>]
132
+ # DocumentResult data, response status code and response headers
133
+ def move_with_http_info(request)
134
+ raise ArgumentError, 'Incorrect request type' unless request.is_a? MoveRequest
135
+
136
+ @api_client.config.logger.debug 'Calling API: PagesApi.move ...' if @api_client.config.debugging
137
+ # verify the required parameter 'options' is set
138
+ raise ArgumentError, 'Missing the required parameter options when calling PagesApi.move' if @api_client.config.client_side_validation && request.options.nil?
139
+ # resource path
140
+ local_var_path = '/merger/pages/move'
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.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
+ PagesApi#move\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
167
+ end
168
+ [data, status_code, headers]
169
+ end
170
+
171
+ # Make new document and apply new orientation mode for specified pages
172
+ #
173
+ # @param request orientation_request
174
+ # @return [DocumentResult]
175
+ def orientation(request)
176
+ data, _status_code, _headers = orientation_with_http_info(request)
177
+ data
178
+ end
179
+
180
+ # Make new document and apply new orientation mode for specified pages
181
+ #
182
+ # @param request orientation_request
183
+ # @return [Array<(DocumentResult, Fixnum, Hash)>]
184
+ # DocumentResult data, response status code and response headers
185
+ def orientation_with_http_info(request)
186
+ raise ArgumentError, 'Incorrect request type' unless request.is_a? OrientationRequest
187
+
188
+ @api_client.config.logger.debug 'Calling API: PagesApi.orientation ...' if @api_client.config.debugging
189
+ # verify the required parameter 'options' is set
190
+ raise ArgumentError, 'Missing the required parameter options when calling PagesApi.orientation' if @api_client.config.client_side_validation && request.options.nil?
191
+ # resource path
192
+ local_var_path = '/merger/pages/orientation'
193
+
194
+ # query parameters
195
+ query_params = {}
196
+
197
+ # header parameters
198
+ header_params = {}
199
+ # HTTP header 'Accept' (if needed)
200
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
201
+ # HTTP header 'Content-Type'
202
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
203
+
204
+ # form parameters
205
+ form_params = {}
206
+
207
+ # http body (model)
208
+ post_body = @api_client.object_to_http_body(request.options)
209
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
210
+ header_params: header_params,
211
+ query_params: query_params,
212
+ form_params: form_params,
213
+ body: post_body,
214
+ access_token: get_access_token,
215
+ return_type: 'DocumentResult')
216
+ if @api_client.config.debugging
217
+ @api_client.config.logger.debug "API called:
218
+ PagesApi#orientation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
219
+ end
220
+ [data, status_code, headers]
221
+ end
222
+
223
+ # Remove pages from document
224
+ #
225
+ # @param request remove_request
226
+ # @return [DocumentResult]
227
+ def remove(request)
228
+ data, _status_code, _headers = remove_with_http_info(request)
229
+ data
230
+ end
231
+
232
+ # Remove pages from document
233
+ #
234
+ # @param request remove_request
235
+ # @return [Array<(DocumentResult, Fixnum, Hash)>]
236
+ # DocumentResult data, response status code and response headers
237
+ def remove_with_http_info(request)
238
+ raise ArgumentError, 'Incorrect request type' unless request.is_a? RemoveRequest
239
+
240
+ @api_client.config.logger.debug 'Calling API: PagesApi.remove ...' if @api_client.config.debugging
241
+ # verify the required parameter 'options' is set
242
+ raise ArgumentError, 'Missing the required parameter options when calling PagesApi.remove' if @api_client.config.client_side_validation && request.options.nil?
243
+ # resource path
244
+ local_var_path = '/merger/pages/remove'
245
+
246
+ # query parameters
247
+ query_params = {}
248
+
249
+ # header parameters
250
+ header_params = {}
251
+ # HTTP header 'Accept' (if needed)
252
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
253
+ # HTTP header 'Content-Type'
254
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
255
+
256
+ # form parameters
257
+ form_params = {}
258
+
259
+ # http body (model)
260
+ post_body = @api_client.object_to_http_body(request.options)
261
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
262
+ header_params: header_params,
263
+ query_params: query_params,
264
+ form_params: form_params,
265
+ body: post_body,
266
+ access_token: get_access_token,
267
+ return_type: 'DocumentResult')
268
+ if @api_client.config.debugging
269
+ @api_client.config.logger.debug "API called:
270
+ PagesApi#remove\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
271
+ end
272
+ [data, status_code, headers]
273
+ end
274
+
275
+ # Rotate pages in document
276
+ #
277
+ # @param request rotate_request
278
+ # @return [DocumentResult]
279
+ def rotate(request)
280
+ data, _status_code, _headers = rotate_with_http_info(request)
281
+ data
282
+ end
283
+
284
+ # Rotate pages in document
285
+ #
286
+ # @param request rotate_request
287
+ # @return [Array<(DocumentResult, Fixnum, Hash)>]
288
+ # DocumentResult data, response status code and response headers
289
+ def rotate_with_http_info(request)
290
+ raise ArgumentError, 'Incorrect request type' unless request.is_a? RotateRequest
291
+
292
+ @api_client.config.logger.debug 'Calling API: PagesApi.rotate ...' if @api_client.config.debugging
293
+ # verify the required parameter 'options' is set
294
+ raise ArgumentError, 'Missing the required parameter options when calling PagesApi.rotate' if @api_client.config.client_side_validation && request.options.nil?
295
+ # resource path
296
+ local_var_path = '/merger/pages/rotate'
297
+
298
+ # query parameters
299
+ query_params = {}
300
+
301
+ # header parameters
302
+ header_params = {}
303
+ # HTTP header 'Accept' (if needed)
304
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
305
+ # HTTP header 'Content-Type'
306
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
307
+
308
+ # form parameters
309
+ form_params = {}
310
+
311
+ # http body (model)
312
+ post_body = @api_client.object_to_http_body(request.options)
313
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
314
+ header_params: header_params,
315
+ query_params: query_params,
316
+ form_params: form_params,
317
+ body: post_body,
318
+ access_token: get_access_token,
319
+ return_type: 'DocumentResult')
320
+ if @api_client.config.debugging
321
+ @api_client.config.logger.debug "API called:
322
+ PagesApi#rotate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
323
+ end
324
+ [data, status_code, headers]
325
+ end
326
+
327
+ # Swap two pages within document
328
+ #
329
+ # @param request swap_request
330
+ # @return [DocumentResult]
331
+ def swap(request)
332
+ data, _status_code, _headers = swap_with_http_info(request)
333
+ data
334
+ end
335
+
336
+ # Swap two pages within document
337
+ #
338
+ # @param request swap_request
339
+ # @return [Array<(DocumentResult, Fixnum, Hash)>]
340
+ # DocumentResult data, response status code and response headers
341
+ def swap_with_http_info(request)
342
+ raise ArgumentError, 'Incorrect request type' unless request.is_a? SwapRequest
343
+
344
+ @api_client.config.logger.debug 'Calling API: PagesApi.swap ...' if @api_client.config.debugging
345
+ # verify the required parameter 'options' is set
346
+ raise ArgumentError, 'Missing the required parameter options when calling PagesApi.swap' if @api_client.config.client_side_validation && request.options.nil?
347
+ # resource path
348
+ local_var_path = '/merger/pages/swap'
349
+
350
+ # query parameters
351
+ query_params = {}
352
+
353
+ # header parameters
354
+ header_params = {}
355
+ # HTTP header 'Accept' (if needed)
356
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
357
+ # HTTP header 'Content-Type'
358
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
359
+
360
+ # form parameters
361
+ form_params = {}
362
+
363
+ # http body (model)
364
+ post_body = @api_client.object_to_http_body(request.options)
365
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
366
+ header_params: header_params,
367
+ query_params: query_params,
368
+ form_params: form_params,
369
+ body: post_body,
370
+ access_token: get_access_token,
371
+ return_type: 'DocumentResult')
372
+ if @api_client.config.debugging
373
+ @api_client.config.logger.debug "API called:
374
+ PagesApi#swap\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
375
+ end
376
+ [data, status_code, headers]
377
+ end
378
+
379
+ #
380
+ # Helper method to convert first letter to downcase
381
+ #
382
+ private def downcase_first_letter(str)
383
+ value = str[0].downcase + str[1..-1]
384
+ value
385
+ end
386
+
387
+ #
388
+ # Retrieves access token
389
+ #
390
+ private def get_access_token
391
+ if @access_token.nil? then
392
+ request_access_token
393
+ end
394
+
395
+ @access_token
396
+ end
397
+
398
+ #
399
+ # Gets a access token from server
400
+ #
401
+ private def request_access_token
402
+ auth_config = Configuration.new(@config.app_sid, @config.app_key)
403
+ auth_config.api_base_url = @config.api_base_url
404
+ auth_config.debugging = @config.debugging
405
+ auth_config.logger = @config.logger
406
+ auth_config.temp_folder_path = @config.temp_folder_path
407
+ auth_config.client_side_validation = @config.client_side_validation
408
+ auth_config.api_version = ''
409
+
410
+ auth_api_client = ApiClient.new(auth_config)
411
+
412
+ request_url = "/connect/token"
413
+ post_data = "grant_type=client_credentials&client_id=#{@config.app_sid}&client_secret=#{@config.app_key}"
414
+
415
+ data, _status_code, _header = auth_api_client.call_api(:POST, request_url, :body => post_data, :return_type => 'Object')
416
+
417
+ @access_token = data[:access_token]
418
+
419
+ expires_in_seconds = data[:expires_in].to_i - 5 * 60
420
+ expires_in_days = Rational(expires_in_seconds, 60 * 60 * 24)
421
+ @access_token_expires_at = DateTime.now + expires_in_days
422
+ end
423
+
424
+ # requires all files inside a directory from current dir
425
+ # @param _dir can be relative path like '/lib' or "../lib"
426
+ private def require_all(_dir)
427
+ Dir[File.expand_path(File.join(File.dirname(File.absolute_path(__FILE__)), _dir)) + "/*.rb"].each do |file|
428
+ require file
429
+ end
430
+ end
431
+ end
432
+ end
433
+ #
434
+ # --------------------------------------------------------------------------------------------------------------------
435
+ # <copyright company="Aspose Pty Ltd" file="extract_request.rb">
436
+ # Copyright (c) 2003-2019 Aspose Pty Ltd
437
+ # </copyright>
438
+ # <summary>
439
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
440
+ # of this software and associated documentation files (the "Software"), to deal
441
+ # in the Software without restriction, including without limitation the rights
442
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
443
+ # copies of the Software, and to permit persons to whom the Software is
444
+ # furnished to do so, subject to the following conditions:
445
+ #
446
+ # The above copyright notice and this permission notice shall be included in all
447
+ # copies or substantial portions of the Software.
448
+ #
449
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
450
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
451
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
452
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
453
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
454
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
455
+ # SOFTWARE.
456
+ # </summary>
457
+ # --------------------------------------------------------------------------------------------------------------------
458
+ #
459
+
460
+ module GroupDocsMergerCloud
461
+
462
+ #
463
+ # Request model for extract operation.
464
+ #
465
+ class ExtractRequest
466
+
467
+ # Extract options
468
+ attr_accessor :options
469
+
470
+ #
471
+ # Initializes a new instance.
472
+ # @param options Extract options
473
+ def initialize(options)
474
+ self.options = options
475
+ end
476
+ end
477
+ end
478
+ #
479
+ # --------------------------------------------------------------------------------------------------------------------
480
+ # <copyright company="Aspose Pty Ltd" file="move_request.rb">
481
+ # Copyright (c) 2003-2019 Aspose Pty Ltd
482
+ # </copyright>
483
+ # <summary>
484
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
485
+ # of this software and associated documentation files (the "Software"), to deal
486
+ # in the Software without restriction, including without limitation the rights
487
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
488
+ # copies of the Software, and to permit persons to whom the Software is
489
+ # furnished to do so, subject to the following conditions:
490
+ #
491
+ # The above copyright notice and this permission notice shall be included in all
492
+ # copies or substantial portions of the Software.
493
+ #
494
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
495
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
496
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
497
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
498
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
499
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
500
+ # SOFTWARE.
501
+ # </summary>
502
+ # --------------------------------------------------------------------------------------------------------------------
503
+ #
504
+
505
+ module GroupDocsMergerCloud
506
+
507
+ #
508
+ # Request model for move operation.
509
+ #
510
+ class MoveRequest
511
+
512
+ # Move options
513
+ attr_accessor :options
514
+
515
+ #
516
+ # Initializes a new instance.
517
+ # @param options Move options
518
+ def initialize(options)
519
+ self.options = options
520
+ end
521
+ end
522
+ end
523
+ #
524
+ # --------------------------------------------------------------------------------------------------------------------
525
+ # <copyright company="Aspose Pty Ltd" file="orientation_request.rb">
526
+ # Copyright (c) 2003-2019 Aspose Pty Ltd
527
+ # </copyright>
528
+ # <summary>
529
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
530
+ # of this software and associated documentation files (the "Software"), to deal
531
+ # in the Software without restriction, including without limitation the rights
532
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
533
+ # copies of the Software, and to permit persons to whom the Software is
534
+ # furnished to do so, subject to the following conditions:
535
+ #
536
+ # The above copyright notice and this permission notice shall be included in all
537
+ # copies or substantial portions of the Software.
538
+ #
539
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
540
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
541
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
542
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
543
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
544
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
545
+ # SOFTWARE.
546
+ # </summary>
547
+ # --------------------------------------------------------------------------------------------------------------------
548
+ #
549
+
550
+ module GroupDocsMergerCloud
551
+
552
+ #
553
+ # Request model for orientation operation.
554
+ #
555
+ class OrientationRequest
556
+
557
+ # Orientation options
558
+ attr_accessor :options
559
+
560
+ #
561
+ # Initializes a new instance.
562
+ # @param options Orientation options
563
+ def initialize(options)
564
+ self.options = options
565
+ end
566
+ end
567
+ end
568
+ #
569
+ # --------------------------------------------------------------------------------------------------------------------
570
+ # <copyright company="Aspose Pty Ltd" file="remove_request.rb">
571
+ # Copyright (c) 2003-2019 Aspose Pty Ltd
572
+ # </copyright>
573
+ # <summary>
574
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
575
+ # of this software and associated documentation files (the "Software"), to deal
576
+ # in the Software without restriction, including without limitation the rights
577
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
578
+ # copies of the Software, and to permit persons to whom the Software is
579
+ # furnished to do so, subject to the following conditions:
580
+ #
581
+ # The above copyright notice and this permission notice shall be included in all
582
+ # copies or substantial portions of the Software.
583
+ #
584
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
585
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
586
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
587
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
588
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
589
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
590
+ # SOFTWARE.
591
+ # </summary>
592
+ # --------------------------------------------------------------------------------------------------------------------
593
+ #
594
+
595
+ module GroupDocsMergerCloud
596
+
597
+ #
598
+ # Request model for remove operation.
599
+ #
600
+ class RemoveRequest
601
+
602
+ # Remove options
603
+ attr_accessor :options
604
+
605
+ #
606
+ # Initializes a new instance.
607
+ # @param options Remove options
608
+ def initialize(options)
609
+ self.options = options
610
+ end
611
+ end
612
+ end
613
+ #
614
+ # --------------------------------------------------------------------------------------------------------------------
615
+ # <copyright company="Aspose Pty Ltd" file="rotate_request.rb">
616
+ # Copyright (c) 2003-2019 Aspose Pty Ltd
617
+ # </copyright>
618
+ # <summary>
619
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
620
+ # of this software and associated documentation files (the "Software"), to deal
621
+ # in the Software without restriction, including without limitation the rights
622
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
623
+ # copies of the Software, and to permit persons to whom the Software is
624
+ # furnished to do so, subject to the following conditions:
625
+ #
626
+ # The above copyright notice and this permission notice shall be included in all
627
+ # copies or substantial portions of the Software.
628
+ #
629
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
630
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
631
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
632
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
633
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
634
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
635
+ # SOFTWARE.
636
+ # </summary>
637
+ # --------------------------------------------------------------------------------------------------------------------
638
+ #
639
+
640
+ module GroupDocsMergerCloud
641
+
642
+ #
643
+ # Request model for rotate operation.
644
+ #
645
+ class RotateRequest
646
+
647
+ # Rotate options
648
+ attr_accessor :options
649
+
650
+ #
651
+ # Initializes a new instance.
652
+ # @param options Rotate options
653
+ def initialize(options)
654
+ self.options = options
655
+ end
656
+ end
657
+ end
658
+ #
659
+ # --------------------------------------------------------------------------------------------------------------------
660
+ # <copyright company="Aspose Pty Ltd" file="swap_request.rb">
661
+ # Copyright (c) 2003-2019 Aspose Pty Ltd
662
+ # </copyright>
663
+ # <summary>
664
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
665
+ # of this software and associated documentation files (the "Software"), to deal
666
+ # in the Software without restriction, including without limitation the rights
667
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
668
+ # copies of the Software, and to permit persons to whom the Software is
669
+ # furnished to do so, subject to the following conditions:
670
+ #
671
+ # The above copyright notice and this permission notice shall be included in all
672
+ # copies or substantial portions of the Software.
673
+ #
674
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
675
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
676
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
677
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
678
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
679
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
680
+ # SOFTWARE.
681
+ # </summary>
682
+ # --------------------------------------------------------------------------------------------------------------------
683
+ #
684
+
685
+ module GroupDocsMergerCloud
686
+
687
+ #
688
+ # Request model for swap operation.
689
+ #
690
+ class SwapRequest
691
+
692
+ # Swap options
693
+ attr_accessor :options
694
+
695
+ #
696
+ # Initializes a new instance.
697
+ # @param options Swap options
698
+ def initialize(options)
699
+ self.options = options
700
+ end
701
+ end
702
+ end