2011-06-16 71 views
0

我在我的Ruby on Rails應用程序中使用了Evernote gem如何在Ruby on Rails中使用Evernote gem創建筆記?

我做這個創建NoteStore:

# 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) 

我可以訪問用戶的筆記罰款。我的問題是,如何創建一個note object?

回答

2

嘗試調用:

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) 

在Evernote的官方紅寶石的應用程序,是他們如何構建注。