Class: Evernote::EDAM::Type::Note
- Inherits:
-
Object
- Object
- Evernote::EDAM::Type::Note
- Defined in:
- lib/evernote/edam/type/note.rb
Instance Method Summary collapse
-
#add_resource(filename, file, mime) ⇒ String
Add resource to this note.
-
#notebook ⇒ Evernote::EDAM::Type::Notebook
Returns the notebook that contains this note.
-
#tags ⇒ Array<Evernote::EDAM::Type::Tag>
Returns the tags that are applied to this note.
Instance Method Details
#add_resource(filename, file, mime) ⇒ String
Add resource to this note.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# 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 ⇒ Evernote::EDAM::Type::Notebook
Returns the notebook that contains this note.
9 10 11 |
# File 'lib/evernote/edam/type/note.rb', line 9 def notebook @notebook ||= note_store.getNotebook(notebookGuid) end |
#tags ⇒ Array<Evernote::EDAM::Type::Tag>
Returns the tags that are applied to this note.
16 17 18 |
# File 'lib/evernote/edam/type/note.rb', line 16 def ||= (tagGuids || []).map{|guid| note_store.getTag(guid)} end |