class Evernote::EDAM::Type::Note

Public Instance Methods

add_resource(filename, file, mime) click to toggle source

Add resource to this note.

@param filename [String] the name of the resource @param file [File] @param mime [String] MIME type of the resource

@return [String] Hexdigest of the given file

# File lib/evernote/edam/type/note.rb, line 27
def add_resource(filename, file, mime)
  hash_func = Digest::MD5.new

  data = Evernote::EDAM::Type::Data.new
  data.size = file.size
  data.bodyHash = hash_func.digest(file)
  data.body = file

  resource = Evernote::EDAM::Type::Resource.new
  resource.mime = mime
  resource.data = data
  resource.attributes = Evernote::EDAM::Type::ResourceAttributes.new
  resource.attributes.fileName = filename

  self.resources = [] unless self.resources
  self.resources << resource

  hash_func.hexdigest(file)
end
notebook() click to toggle source

Returns the notebook that contains this note.

@return [Evernote::EDAM::Type::Notebook]

# File lib/evernote/edam/type/note.rb, line 9
def notebook
  @notebook ||= note_store.getNotebook(notebookGuid)
end
tags() click to toggle source

Returns the tags that are applied to this note.

@return [Array<Evernote::EDAM::Type::Tag>]

# File lib/evernote/edam/type/note.rb, line 16
def tags
  @tags ||= (tagGuids || []).map{|guid| note_store.getTag(guid)}
end