-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample_buildvu_usage.rb
More file actions
23 lines (16 loc) · 1.11 KB
/
example_buildvu_usage.rb
File metadata and controls
23 lines (16 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
require 'idr_cloud_client'
client = IDRCloudClient.new('http://localhost:80/' + IDRCloudClient::BUILDVU)
# Upload a local file to the BuildVu microservice
# convert() returns a hash collection with the conversion results.
conversion_results = client.convert(input: IDRCloudClient::UPLOAD, file: 'path/to/file.pdf')
# You can specify other parameters for the API as named parameters, for example
# here is the use of the callbackUrl parameter which is a URL that you want to
# be updated when the conversion finishes.
# See https://github.com/idrsolutions/buildvu-microservice-example/blob/master/API.md
#conversion_results = client.convert input: IDRCloudClient::UPLOAD, callbackUrl: 'http://listener.url'
# Alternatively, you can specify a url from which the server will download the file to convert.
#conversion_results = client.convert url: 'http://link.to/filename', input: IDRCloudClient::DOWNLOAD
output_url = conversion_results['downloadUrl']
# After the conversion you can also specify a directory to download the output to:
#client.download_result conversion_results, 'path/to/output/dir'
puts 'Converted: ' + output_url