I was going through the Aspose Word Cloud for Ruby language https://products.aspose.cloud/words/ruby/ and started incorporating it in my local project by adding the Ruby SDK but I guess I didn’t follow the necessary steps and was getting errors on multiple occasions.
Can you guide me with all the necessary steps in order to incorporate it in Ruby project? It would be a great favour.
Please double check that you have following the required steps. You can also check Aspose.Words Cloud SDK for Ruby usage details from GitHub.
Hopefully, it will help to integrate Aspose.Words Cloud in your Ruby project. However, if you still face any issues then please share the error details, we will guide you accordingly.
Please check the sample Mail Merge Ruby code. I installed Aspose.Words Cloud SDK for Ruby form rubygem.org and unable to notice any issue. Hopefully, it will help you to accomplish the task. You can check other unit tests from the GitHub repo for reference.
require 'aspose_words_cloud'
class Document
include AsposeWordsCloud
# Get Client ID and Client Secret from https://dashboard.aspose.cloud/
Client_KEY = "xxxxxxxxxxxxxxxxxxxxxxxxxxx"
Client_ID = "xxxxxx-xxxx-xxxx-xxxx-xxxxxxxx"
FILE_PATH = "C:/Temp/"
def initialize
AsposeWordsCloud.configure do |config|
config.client_data['ClientId'] = Client_ID
config.client_data['ClientSecret'] = Client_KEY
end
@words_api = WordsApi.new
end
# MailMerge
def execute_mailmerge
local_document_file = 'SampleMailMergeTemplate.docx'
remote_file_name = 'SampleMailMergeTemplate.docx'
remote_file_output = 'TestExecuteTemplate.docx'
local_data_file = File.read(FILE_PATH + 'SampleMailMergeTemplateData.txt')
request_file_content = File.open(FILE_PATH+ local_document_file)
request_upload = UploadFileRequest.new(file_content: request_file_content, path: remote_file_name)
@words_api.upload_file(request_upload)
request = ExecuteMailMergeRequest.new(name: remote_file_name, data: local_data_file, dest_file_name: remote_file_output)
result = @words_api.execute_mail_merge(request)
end
end
document = Document.new()
puts document.execute_mailmerge
I have tried the above code you shared and now I am getting error this error AsposeWordsCloud::ApiError: Bad Request
on the line @words_api = WordsApi.new
I tried adding words_api gem as well but it didn’t resolve the error.
Help in this case will be highly appreciated. Thanks.
Please share your code screenshot along with the credentials via a private message. For a private message, please click on my user icon and opt the message tab with the required information. Kindly remove “RE:” from the title as well. We will investigate the issue and will update you.
It looks like your credentials issue. Please double check the credentials(Client Id and Secret) of your aspose.cloud application from aspose.cloud dashboard https://dashboard.aspose.cloud/applications and confirm.