I’m new to trying out the aspose.words cloud platform and it seems like a good fit for what we need. In order to try it, I have created the necessary account and new application to get my client ID and client secret. I’ve added the aspose_words_cloud ruby gem to my gemfile and ran “bundle install” like you normally do. I’ve added “require ‘aspose_words_cloud’” and the following to convert a PDF to HTML (Client ID and Client Secret left out for obvious reasons):
AsposeWordsCloud.configure do |config|
config.client_data[‘ClientId’] = ‘…’
config.client_data[‘ClientSecret’] = ‘…’
end
@words_api = AsposeWordsCloud::WordsApi.new
request = AsposeWordsCloud::GetDocumentWithFormatRequest.new(name: “#{section_title}.pdf”, format: ‘html’, out_path: “#{section_title}.html”)
result = @words_api.get_document_with_format(request)
From what I can tell, the line “@words_api = AsposeWordsCloud::WordsApi.new” fails because it executes this line in the words_api.rb class with the following variables:
request_url = “/connect/token”
post_data = “grant_type=client_credentials&client_id=…&client_secret=…”
data, status_code, header = @api_client.call_api(:POST, request_url, :body => post_data, :return_type => ‘Object’, :header_params => {‘Content-Type’: ‘application/x-www-form-urlencoded’})
I get back the following error message:
Error: the evaluation of @api_client.call_api(:POST, request_url, :body => post_data, :return_type => 'Object', :header_params => {'Content-Type': 'application/x-www-form-urlencoded'})
failed with the exception ‘:multipart is not registered on Faraday::Request’
I noticed that the version of the faraday gem that came with the aspose_words gem was at version 2.8.1 so I installed version 2.13.2 (the most recent version as of today) but that did not fix the issue. I’m not sure what is causing this issue but any assistance or insight would be greatly appreciated.