class Aspose::Cloud::Email::Converter
Public Class Methods
new(filename)
click to toggle source
# File lib/Email/converter.rb, line 5 def initialize(filename) @filename = filename raise 'filename not specified.' if filename.empty? @base_uri = Aspose::Cloud::Common::Product.product_uri + '/email/' + @filename end
Public Instance Methods
convert(save_format, folder_name = '', storage_type = 'Aspose', storage_name = '')
click to toggle source
convert an email message document to a different format @param string save_format The converted document format.
# File lib/Email/converter.rb, line 15 def convert(save_format, folder_name = '', storage_type = 'Aspose', storage_name = '') raise 'save format not specified.' if save_format.empty? str_uri = "#{@base_uri}?format=#{save_format}" str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type) signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri) response_stream = RestClient.get(signed_str_uri, {:accept=>'application/json'}) valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream) if valid_output.empty? output_path = "#{Aspose::Cloud::Common::AsposeApp.output_location}#{Aspose::Cloud::Common::Utils.get_filename(@filename)}.#{save_format}" Aspose::Cloud::Common::Utils.save_file(response_stream,output_path) end valid_output end