class Evertils::Common::ENML
Attributes
element[R]
embeddable_element[R]
Public Class Methods
new(file = nil)
click to toggle source
# File lib/evertils/common/enml.rb, line 6 def initialize(file = nil) @file = file @element = enml_element if !@element.nil? @embeddable_element = "<hr/>Attachment with hash #{@element.data.bodyHash}<br /><en-media type=\"#{@element.mime}\" hash=\"#{@element.data.bodyHash}\" /><br /><br />" end end
Private Instance Methods
enml_element()
click to toggle source
# File lib/evertils/common/enml.rb, line 17 def enml_element read_file = File.open(@file, 'rb') { |io| io.read } el = ::Evernote::EDAM::Type::Resource.new() el.mime = MIME::Types.type_for(@file)[0].content_type el.data = ::Evernote::EDAM::Type::Data.new() el.data.size = read_file.size el.data.bodyHash = Digest::MD5.hexdigest(read_file) el.data.body = read_file el.attributes = ::Evernote::EDAM::Type::ResourceAttributes.new() el.attributes.fileName = @file # temporary for now, the actual file name el end