Skip to content

Commit d34ef78

Browse files
committed
Updated sources
1 parent cd3099f commit d34ef78

11 files changed

Lines changed: 702 additions & 12 deletions

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
groupdocs_viewer_cloud (24.2)
4+
groupdocs_viewer_cloud (24.3)
55
addressable (~> 2.8.0, >= 2.8.0)
66
faraday (~> 0.14.0)
77

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ gem install groupdocs_viewer_cloud
1212
To add dependency to your app copy following into your Gemfile and run `bundle install`:
1313

1414
```
15-
gem "groupdocs_viewer_cloud", "~> 24.2"
15+
gem "groupdocs_viewer_cloud", "~> 24.3"
1616
```
1717

1818
## Getting Started

lib/groupdocs_viewer_cloud.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
require_relative 'groupdocs_viewer_cloud/configuration'
3131

3232
# Models
33+
require_relative 'groupdocs_viewer_cloud/models/api_error'
34+
require_relative 'groupdocs_viewer_cloud/models/api_error_response'
3335
require_relative 'groupdocs_viewer_cloud/models/archive_options'
3436
require_relative 'groupdocs_viewer_cloud/models/archive_view_info'
3537
require_relative 'groupdocs_viewer_cloud/models/attachment_info'

lib/groupdocs_viewer_cloud/api/view_api.rb

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,73 @@ def self.from_config(config)
6464
return new(config)
6565
end
6666

67+
# Converts input document file to format specified
68+
#
69+
# @param request convert_and_download_request
70+
# @return [File]
71+
def convert_and_download(request)
72+
data, _status_code, _headers = convert_and_download_with_http_info(request)
73+
data
74+
end
75+
76+
# Converts input document file to format specified
77+
#
78+
# @param request convert_and_download_request
79+
# @return [Array<(File, Fixnum, Hash)>]
80+
# File data, response status code and response headers
81+
def convert_and_download_with_http_info(request)
82+
raise ArgumentError, 'Incorrect request type' unless request.is_a? ConvertAndDownloadRequest
83+
84+
@api_client.config.logger.debug 'Calling API: ViewApi.convert_and_download ...' if @api_client.config.debugging
85+
# verify the required parameter 'format' is set
86+
raise ArgumentError, 'Missing the required parameter format when calling ViewApi.convert_and_download' if @api_client.config.client_side_validation && request.format.nil?
87+
# verify the required parameter 'file' is set
88+
raise ArgumentError, 'Missing the required parameter file when calling ViewApi.convert_and_download' if @api_client.config.client_side_validation && request.file.nil?
89+
# resource path
90+
local_var_path = '/viewer/convertAndDownload'
91+
92+
# query parameters
93+
query_params = {}
94+
query_params[downcase_first_letter('format')] = request.format
95+
96+
if local_var_path.include? ('{' + downcase_first_letter('pages') + '}')
97+
local_var_path = local_var_path.sub('{' + downcase_first_letter('pages') + '}', request.pages.to_s)
98+
else
99+
query_params[downcase_first_letter('pages')] = request.pages unless request.pages.nil?
100+
end
101+
if local_var_path.include? ('{' + downcase_first_letter('password') + '}')
102+
local_var_path = local_var_path.sub('{' + downcase_first_letter('password') + '}', request.password.to_s)
103+
else
104+
query_params[downcase_first_letter('password')] = request.password unless request.password.nil?
105+
end
106+
107+
# header parameters
108+
header_params = {}
109+
# HTTP header 'Accept' (if needed)
110+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
111+
# HTTP header 'Content-Type'
112+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
113+
114+
# form parameters
115+
form_params = {}
116+
form_params[downcase_first_letter('File')] = request.file
117+
118+
# http body (model)
119+
post_body = nil
120+
data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
121+
header_params: header_params,
122+
query_params: query_params,
123+
form_params: form_params,
124+
body: post_body,
125+
access_token: get_access_token,
126+
return_type: 'File')
127+
if @api_client.config.debugging
128+
@api_client.config.logger.debug "API called:
129+
ViewApi#convert_and_download\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
130+
end
131+
[data, status_code, headers]
132+
end
133+
67134
# Render document pages
68135
#
69136
# @param request create_view_request
@@ -220,6 +287,63 @@ def delete_view_with_http_info(request)
220287
end
221288
end
222289
end
290+
end
291+
#
292+
# --------------------------------------------------------------------------------------------------------------------
293+
# <copyright company="Aspose Pty Ltd" file="convert_and_download_request.rb">
294+
# Copyright (c) 2003-2024 Aspose Pty Ltd
295+
# </copyright>
296+
# <summary>
297+
# Permission is hereby granted, free of charge, to any person obtaining a copy
298+
# of this software and associated documentation files (the "Software"), to deal
299+
# in the Software without restriction, including without limitation the rights
300+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
301+
# copies of the Software, and to permit persons to whom the Software is
302+
# furnished to do so, subject to the following conditions:
303+
#
304+
# The above copyright notice and this permission notice shall be included in all
305+
# copies or substantial portions of the Software.
306+
#
307+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
308+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
309+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
310+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
311+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
312+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
313+
# SOFTWARE.
314+
# </summary>
315+
# --------------------------------------------------------------------------------------------------------------------
316+
#
317+
318+
module GroupDocsViewerCloud
319+
320+
#
321+
# Request model for convert_and_download operation.
322+
#
323+
class ConvertAndDownloadRequest
324+
325+
# Requested conversion format: HTML, JPG, PNG or PDF
326+
attr_accessor :format
327+
# Input file to convert
328+
attr_accessor :file
329+
# Pages range to render, like \"1,2\" or \"3-5,10\"
330+
attr_accessor :pages
331+
# Input document password
332+
attr_accessor :password
333+
334+
#
335+
# Initializes a new instance.
336+
# @param format Requested conversion format: HTML, JPG, PNG or PDF
337+
# @param file Input file to convert
338+
# @param pages Pages range to render, like \"1,2\" or \"3-5,10\"
339+
# @param password Input document password
340+
def initialize(format, file, pages = nil, password = nil)
341+
self.format = format
342+
self.file = file
343+
self.pages = pages
344+
self.password = password
345+
end
346+
end
223347
end
224348
#
225349
# --------------------------------------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)