groupdocs_annotation_cloud 18.7 → 19.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/lib/groupdocs_annotation_cloud.rb +23 -39
  3. data/lib/groupdocs_annotation_cloud/api/annotate_api.rb +664 -0
  4. data/lib/groupdocs_annotation_cloud/api/file_api.rb +729 -0
  5. data/lib/groupdocs_annotation_cloud/api/folder_api.rb +694 -0
  6. data/lib/groupdocs_annotation_cloud/api/{pdf_file_api.rb → info_api.rb} +101 -105
  7. data/lib/groupdocs_annotation_cloud/api/preview_api.rb +380 -0
  8. data/lib/groupdocs_annotation_cloud/api/storage_api.rb +541 -0
  9. data/lib/groupdocs_annotation_cloud/api_client.rb +7 -17
  10. data/lib/groupdocs_annotation_cloud/api_error.rb +5 -3
  11. data/lib/groupdocs_annotation_cloud/configuration.rb +3 -3
  12. data/lib/groupdocs_annotation_cloud/models/annotation_api_link.rb +24 -16
  13. data/lib/groupdocs_annotation_cloud/models/annotation_info.rb +97 -82
  14. data/lib/groupdocs_annotation_cloud/models/annotation_reply_info.rb +31 -23
  15. data/lib/groupdocs_annotation_cloud/models/disc_usage.rb +234 -0
  16. data/lib/groupdocs_annotation_cloud/models/document_info.rb +44 -22
  17. data/lib/groupdocs_annotation_cloud/models/error.rb +244 -0
  18. data/lib/groupdocs_annotation_cloud/models/error_details.rb +229 -0
  19. data/lib/groupdocs_annotation_cloud/models/file_version.rb +289 -0
  20. data/lib/groupdocs_annotation_cloud/models/{value_type.rb → file_versions.rb} +33 -13
  21. data/lib/groupdocs_annotation_cloud/models/files_list.rb +216 -0
  22. data/lib/groupdocs_annotation_cloud/models/files_upload_result.rb +228 -0
  23. data/lib/groupdocs_annotation_cloud/models/format.rb +224 -0
  24. data/lib/groupdocs_annotation_cloud/models/formats_result.rb +216 -0
  25. data/lib/groupdocs_annotation_cloud/models/link.rb +24 -16
  26. data/lib/groupdocs_annotation_cloud/models/link_element.rb +18 -10
  27. data/lib/groupdocs_annotation_cloud/models/object_exist.rb +234 -0
  28. data/lib/groupdocs_annotation_cloud/models/{image_page.rb → page_image.rb} +28 -13
  29. data/lib/groupdocs_annotation_cloud/models/{image_pages.rb → page_images.rb} +26 -14
  30. data/lib/groupdocs_annotation_cloud/models/page_info.rb +41 -23
  31. data/lib/groupdocs_annotation_cloud/models/point.rb +31 -13
  32. data/lib/groupdocs_annotation_cloud/models/rectangle.rb +45 -17
  33. data/lib/groupdocs_annotation_cloud/models/row_info.rb +38 -16
  34. data/lib/groupdocs_annotation_cloud/models/storage_exist.rb +219 -0
  35. data/lib/groupdocs_annotation_cloud/models/storage_file.rb +264 -0
  36. data/lib/groupdocs_annotation_cloud/version.rb +2 -2
  37. metadata +22 -39
  38. data/lib/groupdocs_annotation_cloud/api/annotation_api.rb +0 -344
  39. data/lib/groupdocs_annotation_cloud/api/image_info_api.rb +0 -218
  40. data/lib/groupdocs_annotation_cloud/api/image_pages_api.rb +0 -395
  41. data/lib/groupdocs_annotation_cloud/models/requests/delete_clean_document_request.rb +0 -53
  42. data/lib/groupdocs_annotation_cloud/models/requests/delete_pages_request.rb +0 -49
  43. data/lib/groupdocs_annotation_cloud/models/requests/get_import_request.rb +0 -53
  44. data/lib/groupdocs_annotation_cloud/models/requests/get_info_request.rb +0 -53
  45. data/lib/groupdocs_annotation_cloud/models/requests/get_page_request.rb +0 -53
  46. data/lib/groupdocs_annotation_cloud/models/requests/get_pages_request.rb +0 -49
  47. data/lib/groupdocs_annotation_cloud/models/requests/get_pdf_request.rb +0 -53
  48. data/lib/groupdocs_annotation_cloud/models/requests/get_pdf_stream_request.rb +0 -53
  49. data/lib/groupdocs_annotation_cloud/models/requests/post_pages_request.rb +0 -53
  50. data/lib/groupdocs_annotation_cloud/models/requests/put_export_request.rb +0 -57
@@ -1,6 +1,6 @@
1
1
  # -----------------------------------------------------------------------------------
2
- # <copyright company="Aspose Pty Ltd" file="pdfFile.rb">
3
- # Copyright (c) 2003-2018 Aspose Pty Ltd
2
+ # <copyright company="Aspose Pty Ltd" file="info.rb">
3
+ # Copyright (c) 2003-2019 Aspose Pty Ltd
4
4
  # </copyright>
5
5
  # <summary>
6
6
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -30,85 +30,79 @@ module GroupDocsAnnotationCloud
30
30
  #
31
31
  # GroupDocs.Annotation Cloud API
32
32
  #
33
- class PdfFileApi
33
+ class InfoApi
34
34
  attr_accessor :config
35
35
 
36
- #make PdfFileApi.new private
36
+ #make InfoApi.new private
37
37
  private_class_method :new
38
38
 
39
- # Initializes new instance of PdfFileApi
39
+ # Initializes new instance of InfoApi
40
40
  #
41
41
  # @param [config] Configuration
42
- # @return [PdfFileApi] New instance of PdfFileApi
42
+ # @return [InfoApi] New instance of InfoApi
43
43
  def initialize(config)
44
44
  @config = config
45
45
  @api_client = ApiClient.new(config)
46
- require_all '../models/requests'
47
-
48
46
  @access_token = nil
49
47
  end
50
48
 
51
- # Initializes new instance of PdfFileApi
49
+ # Initializes new instance of InfoApi
52
50
  #
53
51
  # @param [app_sid] Application identifier (App SID)
54
52
  # @param [app_key] Application private key (App Key)
55
- # @return [PdfFileApi] New instance of PdfFileApi
53
+ # @return [InfoApi] New instance of InfoApi
56
54
  def self.from_keys(app_sid, app_key)
57
55
  config = Configuration.new(app_sid, app_key)
58
56
  return new(config)
59
57
  end
60
58
 
61
- # Initializes new instance of PdfFileApi
59
+ # Initializes new instance of InfoApi
62
60
  #
63
61
  # @param [config] Configuration
64
- # @return [PdfFileApi] New instance of PdfFileApi
62
+ # @return [InfoApi] New instance of InfoApi
65
63
  def self.from_config(config)
66
64
  return new(config)
67
65
  end
68
66
 
69
- # Retrieves document as PDF.
67
+ # Retrieves basic document info - path, extension, formats, size etc
70
68
  #
71
- # @param request get_pdf_request
72
- # @return [File]
73
- def get_pdf(request)
74
- data, _status_code, _headers = get_pdf_with_http_info(request)
69
+ # @param request get_info_request
70
+ # @return [DocumentInfo]
71
+ def get_info(request)
72
+ data, _status_code, _headers = get_info_with_http_info(request)
75
73
  data
76
74
  end
77
75
 
78
- # Retrieves document as PDF.
76
+ # Retrieves basic document info - path, extension, formats, size etc
79
77
  #
80
- # @param request get_pdf_request
81
- # @return [Array<(File, Fixnum, Hash)>]
82
- # File data, response status code and response headers
83
- def get_pdf_with_http_info(request)
84
- raise ArgumentError, 'Incorrect request type' unless request.is_a? GetPdfRequest
85
-
86
- @api_client.config.logger.debug 'Calling API: PdfFileApi.get_pdf ...' if @api_client.config.debugging
87
- # verify the required parameter 'name' is set
88
- raise ArgumentError, 'Missing the required parameter name when calling PdfFileApi.get_pdf' if @api_client.config.client_side_validation && request.name.nil?
78
+ # @param request get_info_request
79
+ # @return [Array<(DocumentInfo, Fixnum, Hash)>]
80
+ # DocumentInfo 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_path' is set
86
+ raise ArgumentError, 'Missing the required parameter file_path when calling InfoApi.get_info' if @api_client.config.client_side_validation && request.file_path.nil?
89
87
  # resource path
90
- local_var_path = '/annotation/{name}/pdf'
91
- local_var_path = local_var_path.sub('{' + downcase_first_letter('Name') + '}', request.name.to_s)
88
+ local_var_path = '/annotation/info'
92
89
 
93
90
  # query parameters
94
91
  query_params = {}
95
- if local_var_path.include? ('{' + downcase_first_letter('Folder') + '}')
96
- local_var_path = local_var_path.sub('{' + downcase_first_letter('Folder') + '}', request.folder.to_s)
97
- else
98
- query_params[downcase_first_letter('Folder')] = request.folder unless request.folder.nil?
99
- end
100
- if local_var_path.include? ('{' + downcase_first_letter('Password') + '}')
101
- local_var_path = local_var_path.sub('{' + downcase_first_letter('Password') + '}', request.password.to_s)
92
+ query_params[downcase_first_letter('filePath')] = request.file_path
93
+
94
+ if local_var_path.include? ('{' + downcase_first_letter('password') + '}')
95
+ local_var_path = local_var_path.sub('{' + downcase_first_letter('password') + '}', request.password.to_s)
102
96
  else
103
- query_params[downcase_first_letter('Password')] = request.password unless request.password.nil?
97
+ query_params[downcase_first_letter('password')] = request.password unless request.password.nil?
104
98
  end
105
99
 
106
100
  # header parameters
107
101
  header_params = {}
108
102
  # HTTP header 'Accept' (if needed)
109
- header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])
103
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
110
104
  # HTTP header 'Content-Type'
111
- header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/xml'])
105
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
112
106
 
113
107
  # form parameters
114
108
  form_params = {}
@@ -121,57 +115,43 @@ module GroupDocsAnnotationCloud
121
115
  form_params: form_params,
122
116
  body: post_body,
123
117
  access_token: get_access_token,
124
- return_type: 'File')
118
+ return_type: 'DocumentInfo')
125
119
  if @api_client.config.debugging
126
120
  @api_client.config.logger.debug "API called:
127
- PdfFileApi#get_pdf\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
121
+ InfoApi#get_info\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
128
122
  end
129
123
  [data, status_code, headers]
130
124
  end
131
125
 
132
- # Downloads document as PDF.
126
+ # Retrieves supported file formats list
133
127
  #
134
- # @param request get_pdf_stream_request
135
- # @return [File]
136
- def get_pdf_stream(request)
137
- data, _status_code, _headers = get_pdf_stream_with_http_info(request)
128
+ # @return [FormatsResult]
129
+ def get_supported_file_formats()
130
+ data, _status_code, _headers = get_supported_file_formats_with_http_info()
138
131
  data
139
132
  end
140
133
 
141
- # Downloads document as PDF.
134
+ # Retrieves supported file formats list
142
135
  #
143
- # @param request get_pdf_stream_request
144
- # @return [Array<(File, Fixnum, Hash)>]
145
- # File data, response status code and response headers
146
- def get_pdf_stream_with_http_info(request)
147
- raise ArgumentError, 'Incorrect request type' unless request.is_a? GetPdfStreamRequest
136
+
137
+ # @return [Array<(FormatsResult, Fixnum, Hash)>]
138
+ # FormatsResult data, response status code and response headers
139
+ def get_supported_file_formats_with_http_info()
140
+
148
141
 
149
- @api_client.config.logger.debug 'Calling API: PdfFileApi.get_pdf_stream ...' if @api_client.config.debugging
150
- # verify the required parameter 'name' is set
151
- raise ArgumentError, 'Missing the required parameter name when calling PdfFileApi.get_pdf_stream' if @api_client.config.client_side_validation && request.name.nil?
142
+ @api_client.config.logger.debug 'Calling API: InfoApi.get_supported_file_formats ...' if @api_client.config.debugging
152
143
  # resource path
153
- local_var_path = '/annotation/{name}/pdf/stream'
154
- local_var_path = local_var_path.sub('{' + downcase_first_letter('Name') + '}', request.name.to_s)
144
+ local_var_path = '/annotation/formats'
155
145
 
156
146
  # query parameters
157
147
  query_params = {}
158
- if local_var_path.include? ('{' + downcase_first_letter('Folder') + '}')
159
- local_var_path = local_var_path.sub('{' + downcase_first_letter('Folder') + '}', request.folder.to_s)
160
- else
161
- query_params[downcase_first_letter('Folder')] = request.folder unless request.folder.nil?
162
- end
163
- if local_var_path.include? ('{' + downcase_first_letter('Password') + '}')
164
- local_var_path = local_var_path.sub('{' + downcase_first_letter('Password') + '}', request.password.to_s)
165
- else
166
- query_params[downcase_first_letter('Password')] = request.password unless request.password.nil?
167
- end
168
148
 
169
149
  # header parameters
170
150
  header_params = {}
171
151
  # HTTP header 'Accept' (if needed)
172
- header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])
152
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
173
153
  # HTTP header 'Content-Type'
174
- header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/xml'])
154
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
175
155
 
176
156
  # form parameters
177
157
  form_params = {}
@@ -184,10 +164,10 @@ module GroupDocsAnnotationCloud
184
164
  form_params: form_params,
185
165
  body: post_body,
186
166
  access_token: get_access_token,
187
- return_type: 'File')
167
+ return_type: 'FormatsResult')
188
168
  if @api_client.config.debugging
189
169
  @api_client.config.logger.debug "API called:
190
- PdfFileApi#get_pdf_stream\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
170
+ InfoApi#get_supported_file_formats\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
191
171
  end
192
172
  [data, status_code, headers]
193
173
  end
@@ -206,11 +186,6 @@ module GroupDocsAnnotationCloud
206
186
  private def get_access_token
207
187
  if @access_token.nil? then
208
188
  request_access_token
209
- else
210
- access_token_expired = @access_token_expires_at < DateTime.now
211
- if access_token_expired then
212
- reset_access_token
213
- end
214
189
  end
215
190
 
216
191
  @access_token
@@ -230,40 +205,12 @@ module GroupDocsAnnotationCloud
230
205
 
231
206
  auth_api_client = ApiClient.new(auth_config)
232
207
 
233
- request_url = "/oauth2/token"
208
+ request_url = "/connect/token"
234
209
  post_data = "grant_type=client_credentials&client_id=#{@config.app_sid}&client_secret=#{@config.app_key}"
235
210
 
236
211
  data, _status_code, _header = auth_api_client.call_api(:POST, request_url, :body => post_data, :return_type => 'Object')
237
212
 
238
213
  @access_token = data[:access_token]
239
- @refresh_token = data[:refresh_token]
240
-
241
- expires_in_seconds = data[:expires_in].to_i - 5 * 60
242
- expires_in_days = Rational(expires_in_seconds, 60 * 60 * 24)
243
- @access_token_expires_at = DateTime.now + expires_in_days
244
- end
245
-
246
- #
247
- # Resets access token
248
- #
249
- private def reset_access_token
250
- auth_config = Configuration.new(@config.app_sid, @config.app_key)
251
- auth_config.api_base_url = @config.api_base_url
252
- auth_config.debugging = @config.debugging
253
- auth_config.logger = @config.logger
254
- auth_config.temp_folder_path = @config.temp_folder_path
255
- auth_config.client_side_validation = @config.client_side_validation
256
- auth_config.api_version = ''
257
-
258
- auth_api_client = ApiClient.new(auth_config)
259
-
260
- request_url = "/oauth2/token"
261
- post_data = "grant_type=refresh_token&refresh_token=#{@refresh_token}"
262
-
263
- data, _status_code, _header = auth_api_client.call_api(:POST, request_url, :body => post_data, :return_type => 'Object')
264
-
265
- @access_token = data[:access_token]
266
- @refresh_token = data[:refresh_token]
267
214
 
268
215
  expires_in_seconds = data[:expires_in].to_i - 5 * 60
269
216
  expires_in_days = Rational(expires_in_seconds, 60 * 60 * 24)
@@ -279,3 +226,52 @@ module GroupDocsAnnotationCloud
279
226
  end
280
227
  end
281
228
  end
229
+ #
230
+ # --------------------------------------------------------------------------------------------------------------------
231
+ # <copyright company="Aspose Pty Ltd" file="get_info_request.rb">
232
+ # Copyright (c) 2003-2019 Aspose Pty Ltd
233
+ # </copyright>
234
+ # <summary>
235
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
236
+ # of this software and associated documentation files (the "Software"), to deal
237
+ # in the Software without restriction, including without limitation the rights
238
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
239
+ # copies of the Software, and to permit persons to whom the Software is
240
+ # furnished to do so, subject to the following conditions:
241
+ #
242
+ # The above copyright notice and this permission notice shall be included in all
243
+ # copies or substantial portions of the Software.
244
+ #
245
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
246
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
247
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
248
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
249
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
250
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
251
+ # SOFTWARE.
252
+ # </summary>
253
+ # --------------------------------------------------------------------------------------------------------------------
254
+ #
255
+
256
+ module GroupDocsAnnotationCloud
257
+
258
+ #
259
+ # Request model for get_info operation.
260
+ #
261
+ class GetInfoRequest
262
+
263
+ # Document path in storage
264
+ attr_accessor :file_path
265
+ # Source document password
266
+ attr_accessor :password
267
+
268
+ #
269
+ # Initializes a new instance.
270
+ # @param file_path Document path in storage
271
+ # @param password Source document password
272
+ def initialize(file_path, password = nil)
273
+ self.file_path = file_path
274
+ self.password = password
275
+ end
276
+ end
277
+ end
@@ -0,0 +1,380 @@
1
+ # -----------------------------------------------------------------------------------
2
+ # <copyright company="Aspose Pty Ltd" file="preview.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 GroupDocsAnnotationCloud
30
+ #
31
+ # GroupDocs.Annotation Cloud API
32
+ #
33
+ class PreviewApi
34
+ attr_accessor :config
35
+
36
+ #make PreviewApi.new private
37
+ private_class_method :new
38
+
39
+ # Initializes new instance of PreviewApi
40
+ #
41
+ # @param [config] Configuration
42
+ # @return [PreviewApi] New instance of PreviewApi
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 PreviewApi
50
+ #
51
+ # @param [app_sid] Application identifier (App SID)
52
+ # @param [app_key] Application private key (App Key)
53
+ # @return [PreviewApi] New instance of PreviewApi
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 PreviewApi
60
+ #
61
+ # @param [config] Configuration
62
+ # @return [PreviewApi] New instance of PreviewApi
63
+ def self.from_config(config)
64
+ return new(config)
65
+ end
66
+
67
+ # Removes document's pages image representations
68
+ #
69
+ # @param request delete_pages_request
70
+ # @return [nil]
71
+ def delete_pages(request)
72
+ delete_pages_with_http_info(request)
73
+ nil
74
+ end
75
+
76
+ # Removes document&#39;s pages image representations
77
+ #
78
+ # @param request delete_pages_request
79
+ # @return [Array<(nil, Fixnum, Hash)>]
80
+ # nil, response status code and response headers
81
+ def delete_pages_with_http_info(request)
82
+ raise ArgumentError, 'Incorrect request type' unless request.is_a? DeletePagesRequest
83
+
84
+ @api_client.config.logger.debug 'Calling API: PreviewApi.delete_pages ...' if @api_client.config.debugging
85
+ # verify the required parameter 'file_path' is set
86
+ raise ArgumentError, 'Missing the required parameter file_path when calling PreviewApi.delete_pages' if @api_client.config.client_side_validation && request.file_path.nil?
87
+ # resource path
88
+ local_var_path = '/annotation/pages'
89
+
90
+ # query parameters
91
+ query_params = {}
92
+ query_params[downcase_first_letter('filePath')] = request.file_path
93
+
94
+
95
+ # header parameters
96
+ header_params = {}
97
+ # HTTP header 'Accept' (if needed)
98
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
99
+ # HTTP header 'Content-Type'
100
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
101
+
102
+ # form parameters
103
+ form_params = {}
104
+
105
+ # http body (model)
106
+ post_body = nil
107
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
108
+ header_params: header_params,
109
+ query_params: query_params,
110
+ form_params: form_params,
111
+ body: post_body,
112
+ access_token: get_access_token)
113
+ if @api_client.config.debugging
114
+ @api_client.config.logger.debug "API called:
115
+ PreviewApi#delete_pages\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
116
+ end
117
+ [data, status_code, headers]
118
+ end
119
+
120
+ # Generates image representations from documents pages
121
+ #
122
+ # @param request get_pages_request
123
+ # @return [PageImages]
124
+ def get_pages(request)
125
+ data, _status_code, _headers = get_pages_with_http_info(request)
126
+ data
127
+ end
128
+
129
+ # Generates image representations from documents pages
130
+ #
131
+ # @param request get_pages_request
132
+ # @return [Array<(PageImages, Fixnum, Hash)>]
133
+ # PageImages data, response status code and response headers
134
+ def get_pages_with_http_info(request)
135
+ raise ArgumentError, 'Incorrect request type' unless request.is_a? GetPagesRequest
136
+
137
+ @api_client.config.logger.debug 'Calling API: PreviewApi.get_pages ...' if @api_client.config.debugging
138
+ # verify the required parameter 'file_path' is set
139
+ raise ArgumentError, 'Missing the required parameter file_path when calling PreviewApi.get_pages' if @api_client.config.client_side_validation && request.file_path.nil?
140
+ # resource path
141
+ local_var_path = '/annotation/pages'
142
+
143
+ # query parameters
144
+ query_params = {}
145
+ query_params[downcase_first_letter('filePath')] = request.file_path
146
+
147
+ if local_var_path.include? ('{' + downcase_first_letter('countPagesToConvert') + '}')
148
+ local_var_path = local_var_path.sub('{' + downcase_first_letter('countPagesToConvert') + '}', request.count_pages_to_convert.to_s)
149
+ else
150
+ query_params[downcase_first_letter('countPagesToConvert')] = request.count_pages_to_convert unless request.count_pages_to_convert.nil?
151
+ end
152
+ if local_var_path.include? ('{' + downcase_first_letter('pageNumber') + '}')
153
+ local_var_path = local_var_path.sub('{' + downcase_first_letter('pageNumber') + '}', request.page_number.to_s)
154
+ else
155
+ query_params[downcase_first_letter('pageNumber')] = request.page_number unless request.page_number.nil?
156
+ end
157
+ if local_var_path.include? ('{' + downcase_first_letter('pageNumbersToConvert') + '}')
158
+ local_var_path = local_var_path.sub('{' + downcase_first_letter('pageNumbersToConvert') + '}', request.page_numbers_to_convert.to_s)
159
+ else
160
+ query_params[downcase_first_letter('pageNumbersToConvert')] = @api_client.build_collection_param(request.page_numbers_to_convert, :multi) unless request.page_numbers_to_convert.nil?
161
+ end
162
+ if local_var_path.include? ('{' + downcase_first_letter('withoutAnnotations') + '}')
163
+ local_var_path = local_var_path.sub('{' + downcase_first_letter('withoutAnnotations') + '}', request.without_annotations.to_s)
164
+ else
165
+ query_params[downcase_first_letter('withoutAnnotations')] = request.without_annotations unless request.without_annotations.nil?
166
+ end
167
+ if local_var_path.include? ('{' + downcase_first_letter('enableCaching') + '}')
168
+ local_var_path = local_var_path.sub('{' + downcase_first_letter('enableCaching') + '}', request.enable_caching.to_s)
169
+ else
170
+ query_params[downcase_first_letter('enableCaching')] = request.enable_caching unless request.enable_caching.nil?
171
+ end
172
+ if local_var_path.include? ('{' + downcase_first_letter('cacheStoragePath') + '}')
173
+ local_var_path = local_var_path.sub('{' + downcase_first_letter('cacheStoragePath') + '}', request.cache_storage_path.to_s)
174
+ else
175
+ query_params[downcase_first_letter('cacheStoragePath')] = request.cache_storage_path unless request.cache_storage_path.nil?
176
+ end
177
+ if local_var_path.include? ('{' + downcase_first_letter('password') + '}')
178
+ local_var_path = local_var_path.sub('{' + downcase_first_letter('password') + '}', request.password.to_s)
179
+ else
180
+ query_params[downcase_first_letter('password')] = request.password unless request.password.nil?
181
+ end
182
+
183
+ # header parameters
184
+ header_params = {}
185
+ # HTTP header 'Accept' (if needed)
186
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
187
+ # HTTP header 'Content-Type'
188
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
189
+
190
+ # form parameters
191
+ form_params = {}
192
+
193
+ # http body (model)
194
+ post_body = nil
195
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
196
+ header_params: header_params,
197
+ query_params: query_params,
198
+ form_params: form_params,
199
+ body: post_body,
200
+ access_token: get_access_token,
201
+ return_type: 'PageImages')
202
+ if @api_client.config.debugging
203
+ @api_client.config.logger.debug "API called:
204
+ PreviewApi#get_pages\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
205
+ end
206
+ [data, status_code, headers]
207
+ end
208
+
209
+ #
210
+ # Helper method to convert first letter to downcase
211
+ #
212
+ private def downcase_first_letter(str)
213
+ value = str[0].downcase + str[1..-1]
214
+ value
215
+ end
216
+
217
+ #
218
+ # Retrieves access token
219
+ #
220
+ private def get_access_token
221
+ if @access_token.nil? then
222
+ request_access_token
223
+ end
224
+
225
+ @access_token
226
+ end
227
+
228
+ #
229
+ # Gets a access token from server
230
+ #
231
+ private def request_access_token
232
+ auth_config = Configuration.new(@config.app_sid, @config.app_key)
233
+ auth_config.api_base_url = @config.api_base_url
234
+ auth_config.debugging = @config.debugging
235
+ auth_config.logger = @config.logger
236
+ auth_config.temp_folder_path = @config.temp_folder_path
237
+ auth_config.client_side_validation = @config.client_side_validation
238
+ auth_config.api_version = ''
239
+
240
+ auth_api_client = ApiClient.new(auth_config)
241
+
242
+ request_url = "/connect/token"
243
+ post_data = "grant_type=client_credentials&client_id=#{@config.app_sid}&client_secret=#{@config.app_key}"
244
+
245
+ data, _status_code, _header = auth_api_client.call_api(:POST, request_url, :body => post_data, :return_type => 'Object')
246
+
247
+ @access_token = data[:access_token]
248
+
249
+ expires_in_seconds = data[:expires_in].to_i - 5 * 60
250
+ expires_in_days = Rational(expires_in_seconds, 60 * 60 * 24)
251
+ @access_token_expires_at = DateTime.now + expires_in_days
252
+ end
253
+
254
+ # requires all files inside a directory from current dir
255
+ # @param _dir can be relative path like '/lib' or "../lib"
256
+ private def require_all(_dir)
257
+ Dir[File.expand_path(File.join(File.dirname(File.absolute_path(__FILE__)), _dir)) + "/*.rb"].each do |file|
258
+ require file
259
+ end
260
+ end
261
+ end
262
+ end
263
+ #
264
+ # --------------------------------------------------------------------------------------------------------------------
265
+ # <copyright company="Aspose Pty Ltd" file="delete_pages_request.rb">
266
+ # Copyright (c) 2003-2019 Aspose Pty Ltd
267
+ # </copyright>
268
+ # <summary>
269
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
270
+ # of this software and associated documentation files (the "Software"), to deal
271
+ # in the Software without restriction, including without limitation the rights
272
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
273
+ # copies of the Software, and to permit persons to whom the Software is
274
+ # furnished to do so, subject to the following conditions:
275
+ #
276
+ # The above copyright notice and this permission notice shall be included in all
277
+ # copies or substantial portions of the Software.
278
+ #
279
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
280
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
281
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
282
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
283
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
284
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
285
+ # SOFTWARE.
286
+ # </summary>
287
+ # --------------------------------------------------------------------------------------------------------------------
288
+ #
289
+
290
+ module GroupDocsAnnotationCloud
291
+
292
+ #
293
+ # Request model for delete_pages operation.
294
+ #
295
+ class DeletePagesRequest
296
+
297
+ # Document path in storage
298
+ attr_accessor :file_path
299
+
300
+ #
301
+ # Initializes a new instance.
302
+ # @param file_path Document path in storage
303
+ def initialize(file_path)
304
+ self.file_path = file_path
305
+ end
306
+ end
307
+ end
308
+ #
309
+ # --------------------------------------------------------------------------------------------------------------------
310
+ # <copyright company="Aspose Pty Ltd" file="get_pages_request.rb">
311
+ # Copyright (c) 2003-2019 Aspose Pty Ltd
312
+ # </copyright>
313
+ # <summary>
314
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
315
+ # of this software and associated documentation files (the "Software"), to deal
316
+ # in the Software without restriction, including without limitation the rights
317
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
318
+ # copies of the Software, and to permit persons to whom the Software is
319
+ # furnished to do so, subject to the following conditions:
320
+ #
321
+ # The above copyright notice and this permission notice shall be included in all
322
+ # copies or substantial portions of the Software.
323
+ #
324
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
325
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
326
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
327
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
328
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
329
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
330
+ # SOFTWARE.
331
+ # </summary>
332
+ # --------------------------------------------------------------------------------------------------------------------
333
+ #
334
+
335
+ module GroupDocsAnnotationCloud
336
+
337
+ #
338
+ # Request model for get_pages operation.
339
+ #
340
+ class GetPagesRequest
341
+
342
+ # Document path in storage
343
+ attr_accessor :file_path
344
+ # The count pages to convert
345
+ attr_accessor :count_pages_to_convert
346
+ # The start page number
347
+ attr_accessor :page_number
348
+ # The list of page numbers to convert
349
+ attr_accessor :page_numbers_to_convert
350
+ # If true returns specific pages without annotations
351
+ attr_accessor :without_annotations
352
+ # Indicates whether to use previously cached document or not
353
+ attr_accessor :enable_caching
354
+ # The cache storage path
355
+ attr_accessor :cache_storage_path
356
+ # Source document opening password
357
+ attr_accessor :password
358
+
359
+ #
360
+ # Initializes a new instance.
361
+ # @param file_path Document path in storage
362
+ # @param count_pages_to_convert The count pages to convert
363
+ # @param page_number The start page number
364
+ # @param page_numbers_to_convert The list of page numbers to convert
365
+ # @param without_annotations If true returns specific pages without annotations
366
+ # @param enable_caching Indicates whether to use previously cached document or not
367
+ # @param cache_storage_path The cache storage path
368
+ # @param password Source document opening password
369
+ def initialize(file_path, count_pages_to_convert = nil, page_number = nil, page_numbers_to_convert = nil, without_annotations = nil, enable_caching = nil, cache_storage_path = nil, password = nil)
370
+ self.file_path = file_path
371
+ self.count_pages_to_convert = count_pages_to_convert
372
+ self.page_number = page_number
373
+ self.page_numbers_to_convert = page_numbers_to_convert
374
+ self.without_annotations = without_annotations
375
+ self.enable_caching = enable_caching
376
+ self.cache_storage_path = cache_storage_path
377
+ self.password = password
378
+ end
379
+ end
380
+ end