Skip to content

Commit 3b17cd3

Browse files
committed
Updated sources
1 parent 02efdd2 commit 3b17cd3

6 files changed

Lines changed: 154 additions & 10 deletions

File tree

Gemfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
groupdocs_conversion_cloud (20.3)
4+
groupdocs_conversion_cloud (20.11)
55
addressable (~> 2.5.0, >= 2.5.0)
66
faraday (~> 0.14.0)
77
mimemagic (~> 0.3.2)
@@ -13,7 +13,7 @@ GEM
1313
public_suffix (>= 2.0.2, < 4.0)
1414
faraday (0.14.0)
1515
multipart-post (>= 1.2, < 3)
16-
mimemagic (0.3.4)
16+
mimemagic (0.3.5)
1717
minitest (5.11.3)
1818
multipart-post (2.1.1)
1919
public_suffix (3.1.1)

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ gem install groupdocs_conversion_cloud
1212
To add dependency to your app copy following into your Gemfile and run `bundle install`:
1313

1414
```
15-
gem "groupdocs_conversion_cloud", "~> 20.3"
15+
gem "groupdocs_conversion_cloud", "~> 20.11"
1616
```
1717

1818
## Getting Started
@@ -42,4 +42,12 @@ puts("#{format.source_format} to [#{format.target_formats.join(', ')}]")
4242
## Licensing
4343
GroupDocs.Conversion Cloud Ruby SDK licensed under [MIT License](LICENSE).
4444

45-
[Home](https://www.groupdocs.cloud/) | [Product Page](https://products.groupdocs.cloud/conversion/ruby) | [Docs](https://docs.groupdocs.cloud/conversion/) | [Demos](https://products.groupdocs.app/conversion/family) | [API Reference](https://apireference.groupdocs.cloud/conversion/) | [Examples](https://github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-ruby-samples) | [Blog](https://blog.groupdocs.cloud/category/conversion/) | [Free Support](https://forum.groupdocs.cloud/c/conversion) | [Free Trial](https://purchase.groupdocs.cloud/trial)
45+
## Resources
46+
+ [**Website**](https://www.groupdocs.cloud)
47+
+ [**Product Home**](https://products.groupdocs.cloud/conversion)
48+
+ [**Documentation**](https://docs.groupdocs.cloud/display/conversioncloud/Home)
49+
+ [**Free Support Forum**](https://forum.groupdocs.cloud/c/conversion)
50+
+ [**Blog**](https://blog.groupdocs.cloud/category/conversion)
51+
52+
## Contact Us
53+
Your feedback is very important to us. Please feel free to contact us using our [Support Forums](https://forum.groupdocs.cloud/c/conversion).

lib/groupdocs_conversion_cloud/api/convert_api.rb

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,73 @@ def convert_document_with_http_info(request)
117117
end
118118

119119

120+
# Converts input document file to format specified
121+
#
122+
# @param request convert_document_direct_request
123+
# @return [File]
124+
def convert_document_direct(request)
125+
data, _status_code, _headers = convert_document_direct_with_http_info(request)
126+
data
127+
end
128+
129+
# Converts input document file to format specified
130+
#
131+
# @param request convert_document_direct_request
132+
# @return [Array<(File, Fixnum, Hash)>]
133+
# File data, response status code and response headers
134+
def convert_document_direct_with_http_info(request)
135+
raise ArgumentError, 'Incorrect request type' unless request.is_a? ConvertDocumentDirectRequest
136+
137+
@api_client.config.logger.debug 'Calling API: ConvertApi.convert_document_direct ...' if @api_client.config.debugging
138+
# verify the required parameter 'format' is set
139+
raise ArgumentError, 'Missing the required parameter format when calling ConvertApi.convert_document_direct' if @api_client.config.client_side_validation && request.format.nil?
140+
# verify the required parameter 'file' is set
141+
raise ArgumentError, 'Missing the required parameter file when calling ConvertApi.convert_document_direct' if @api_client.config.client_side_validation && request.file.nil?
142+
# resource path
143+
local_var_path = '/conversion'
144+
145+
# query parameters
146+
query_params = {}
147+
query_params[downcase_first_letter('format')] = request.format
148+
149+
if local_var_path.include? ('{' + downcase_first_letter('fromPage') + '}')
150+
local_var_path = local_var_path.sub('{' + downcase_first_letter('fromPage') + '}', request.from_page.to_s)
151+
else
152+
query_params[downcase_first_letter('fromPage')] = request.from_page unless request.from_page.nil?
153+
end
154+
if local_var_path.include? ('{' + downcase_first_letter('pagesCount') + '}')
155+
local_var_path = local_var_path.sub('{' + downcase_first_letter('pagesCount') + '}', request.pages_count.to_s)
156+
else
157+
query_params[downcase_first_letter('pagesCount')] = request.pages_count unless request.pages_count.nil?
158+
end
159+
160+
# header parameters
161+
header_params = {}
162+
# HTTP header 'Accept' (if needed)
163+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
164+
# HTTP header 'Content-Type'
165+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
166+
167+
# form parameters
168+
form_params = {}
169+
form_params[downcase_first_letter('File')] = request.file
170+
171+
# http body (model)
172+
post_body = nil
173+
data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
174+
header_params: header_params,
175+
query_params: query_params,
176+
form_params: form_params,
177+
body: post_body,
178+
access_token: get_access_token,
179+
return_type: 'File')
180+
if @api_client.config.debugging
181+
@api_client.config.logger.debug "API called:
182+
ConvertApi#convert_document_direct\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
183+
end
184+
[data, status_code, headers]
185+
end
186+
120187
#
121188
# Helper method to convert first letter to downcase
122189
#
@@ -216,3 +283,60 @@ def initialize(convert_settings)
216283
end
217284
end
218285
end
286+
#
287+
# --------------------------------------------------------------------------------------------------------------------
288+
# <copyright company="Aspose Pty Ltd" file="convert_document_direct_request.rb">
289+
# Copyright (c) 2003-2020 Aspose Pty Ltd
290+
# </copyright>
291+
# <summary>
292+
# Permission is hereby granted, free of charge, to any person obtaining a copy
293+
# of this software and associated documentation files (the "Software"), to deal
294+
# in the Software without restriction, including without limitation the rights
295+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
296+
# copies of the Software, and to permit persons to whom the Software is
297+
# furnished to do so, subject to the following conditions:
298+
#
299+
# The above copyright notice and this permission notice shall be included in all
300+
# copies or substantial portions of the Software.
301+
#
302+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
303+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
304+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
305+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
306+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
307+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
308+
# SOFTWARE.
309+
# </summary>
310+
# --------------------------------------------------------------------------------------------------------------------
311+
#
312+
313+
module GroupDocsConversionCloud
314+
315+
#
316+
# Request model for convert_document_direct operation.
317+
#
318+
class ConvertDocumentDirectRequest
319+
320+
# Requested conversion format
321+
attr_accessor :format
322+
# Input file to convert
323+
attr_accessor :file
324+
# Page start conversion from
325+
attr_accessor :from_page
326+
# Number of pages to convert
327+
attr_accessor :pages_count
328+
329+
#
330+
# Initializes a new instance.
331+
# @param format Requested conversion format
332+
# @param file Input file to convert
333+
# @param from_page Page start conversion from
334+
# @param pages_count Number of pages to convert
335+
def initialize(format, file, from_page = nil, pages_count = nil)
336+
self.format = format
337+
self.file = file
338+
self.from_page = from_page
339+
self.pages_count = pages_count
340+
end
341+
end
342+
end

lib/groupdocs_conversion_cloud/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@
2525
# --------------------------------------------------------------------------------------------------------------------
2626
#
2727
module GroupDocsConversionCloud
28-
VERSION = "20.3".freeze
28+
VERSION = "20.11".freeze
2929
end

test/api/test_convert_api.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,17 @@ def test_convert_document_download
5959
assert_operator response.length, :>, 0
6060
end
6161

62+
def test_convert_document_direct
63+
test_file = TestFile.four_pages_docx
64+
format = "pdf"
65+
file = File.open(get_test_path() + test_file.path, "r")
66+
67+
request = ConvertDocumentDirectRequest.new format, file
68+
69+
response = @convert_api.convert_document_direct(request)
70+
71+
assert_operator response.length, :>, 0
72+
end
73+
6274
end
6375
end

test/test_context.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,18 @@ def remove_folder_in_storage(folder)
6565
@folder_api.delete_folder request
6666
end
6767

68+
def get_test_path
69+
"test\\test_files\\"
70+
end
71+
6872
def upload_test_files
6973
unless @@test_files_uploaded then
70-
test_file_path = "test\\test_files\\"
71-
7274
TestFile.test_files_list.each do |test_file|
73-
7475
exist_request = ObjectExistsRequest.new(test_file.path)
7576
exist_response = @storage_api.object_exists(exist_request)
76-
7777
if !exist_response.exists then
7878
@storage_api.config.logger.debug "Uploading: " + test_file.path
79-
file = File.open(test_file_path + test_file.path, "r")
79+
file = File.open(get_test_path() + test_file.path, "r")
8080
upload_request = UploadFileRequest.new test_file.path, file
8181
@file_api.upload_file(upload_request)
8282
end

0 commit comments

Comments
 (0)