Aspose Cloud Heroku Examples for Ruby
Aspose for Cloud's REST API allows you to add support for all kinds of common tasks to your Heroku web app: document assembly, mail merge, reporting, file conversion, text and image extraction, metadata removal, barcode generation and recognition, email tracking and creation, targeting content to different devices.
Using with Ruby
Currently, work on the Ruby SDK is in progress. Only few features of each product are implemented. But we can still use the Aspose Cloud REST API to utilize ALL the features that Aspose products offer. The necessary methods for authentication and response parsing etc are implemented as Ruby Gem. This gem is required in our sample application.
In Gemfile, add the following lines to include the Aspose SDK gem and dependencies.
gem 'saasposesdk' gem 'rest-client' gem 'mime-types'
The sample code for getting properties of a Word document would be
# Set the Aspose APPSID and App key Common::Product.setBaseProductUri(ENV['SAASPOSE_URL']) Common::SaasposeApp.new(ENV['SAASPOSE_APPSID'], ENV['SAASPOSE_APPKEY']) # Get document properties using Saaspose.Words docFileName = 'DinnerInvitation.docx' urlDoc = $productURI + '/words/' + docFileName + '/documentproperties?folder=' signedURL = Common::Utils.sign(urlDoc) responseWords = RestClient.get(signedURL, :accept => 'application/json') data = JSON.parse(responseWords.body) @responseWords = 'Status: ' + data['Status'] + "<br>" @responseWords = @responseWords + 'Code: ' + data['Code'].to_s + "<br>" @responseWords = @responseWords + "<br/>Document properties:<br/>" data['DocumentProperties']['List'].each do |item| @responseWords = @responseWords + item['Name'] + ': ' + item['Value'].to_s + "<br/>" end