简体   繁体   中英

How do I create a note using the Evernote gem in Ruby on Rails?

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM