How do I create a note using the Evernote gem in Ruby on Rails?
-
28-10-2019 - |
Question
I am using the Evernote gem in my Ruby on Rails app.
I am creating a NoteStore by doing this:
# Construct the URL used to access the user's account
noteStoreUrl = "https://sandbox.evernote.com/edam/note/" + shard_id
noteStoreTransport = Thrift::HTTPClientTransport.new(noteStoreUrl)
noteStoreProtocol = Thrift::BinaryProtocol.new(noteStoreTransport)
noteStore = Evernote::EDAM::NoteStore::NoteStore::Client.new(noteStoreProtocol)
I can access the users' notes fine. My question is, how do I create a note object?
Solution
Try calling:
note = Evernote::EDAM::Type::Note.new()
note.title = "Test note from ENTest.rb"
note.content = '<?xml version="1.0" encoding="UTF-8"?>' +
'<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml2.dtd">' +
'<en-note>Here is the Evernote logo:<br/>'
createdNote = noteStore.createNote(authToken, note)
In the evernote official ruby app that's how they construct the note.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow