Class: Aspose::Cloud::Email::Document
- Inherits:
-
Object
- Object
- Aspose::Cloud::Email::Document
- Defined in:
- lib/Email/document.rb
Instance Method Summary collapse
-
#add_attachment(attachment_name, folder_name = '', storage_type = 'Aspose', storage_name = '') ⇒ Object
Add email attachment @param string attachment_name Name of the attachment.
-
#get_attachment(attachment_name, folder_name = '', storage_type = 'Aspose', storage_name = '') ⇒ Object
Get attachment from the email document @param string attachment_name Name of the attachment.
-
#get_property(property_name, folder_name = '', storage_type = 'Aspose', storage_name = '') ⇒ Object
Get property of the email document @param string property_name Name of the property.
-
#initialize(filename) ⇒ Document
constructor
A new instance of Document.
-
#set_property(property_name, property_value, folder_name = '', storage_type = 'Aspose', storage_name = '') ⇒ Object
Set property of the email document @param string property_name Name of the property.
Constructor Details
Instance Method Details
#add_attachment(attachment_name, folder_name = '', storage_type = 'Aspose', storage_name = '') ⇒ Object
Add email attachment
@param string attachment_name Name of the attachment.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/Email/document.rb', line 65 def (, folder_name = '', storage_type = 'Aspose', storage_name = '') raise 'attachment_name not specified.' if .empty? str_uri = "#{@base_uri}/attachments/#{}" 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.post(signed_str_uri, '', {:accept=>'application/json'}) valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream) if valid_output.empty? Aspose::Cloud::Common::Utils.download_file(@filename,@filename) end valid_output end |
#get_attachment(attachment_name, folder_name = '', storage_type = 'Aspose', storage_name = '') ⇒ Object
Get attachment from the email document
@param string attachment_name Name of the attachment.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/Email/document.rb', line 45 def (, folder_name = '', storage_type = 'Aspose', storage_name = '') raise 'attachment_name not specified.' if .empty? str_uri = "#{@base_uri}/attachments/#{}" 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.save_file(response_stream,output_path) end valid_output end |
#get_property(property_name, folder_name = '', storage_type = 'Aspose', storage_name = '') ⇒ Object
Get property of the email document
@param string property_name Name of the property.
15 16 17 18 19 20 21 22 |
# File 'lib/Email/document.rb', line 15 def get_property(property_name, folder_name = '', storage_type = 'Aspose', storage_name = '') raise 'property_name not specified.' if property_name.empty? str_uri = "#{@base_uri}/properties/#{property_name}" 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) JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['EmailProperty']['Value'] end |
#set_property(property_name, property_value, folder_name = '', storage_type = 'Aspose', storage_name = '') ⇒ Object
Set property of the email document
@param string property_name Name of the property.
@param string property_value Value of the property.
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/Email/document.rb', line 29 def set_property(property_name, property_value, folder_name = '', storage_type = 'Aspose', storage_name = '') raise 'property_name not specified.' if property_name.empty? raise 'property_value not specified.' if property_value.empty? json_data = JSON.generate('Value'=>property_value) str_uri = "#{@base_uri}/properties/#{property_name}" 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) JSON.parse(RestClient.put(signed_str_uri, json_data, {:content_type=>:json, :accept=>'application/json'}))['EmailProperty']['Value'] end |