diff options
| author | Chris Sepic | 2011-07-23 15:57:08 -0500 |
|---|---|---|
| committer | Chris Sepic | 2011-07-23 15:57:08 -0500 |
| commit | 9102191ea729c695289f8c9ce6ca8fadc8619227 (patch) | |
| tree | fc1631a28ae008413e2fb797357a599a625ae591 /example.rb | |
| parent | 3b8bfd529b9031c8787382293d69d9a030798a2d (diff) | |
| download | evernote-9102191ea729c695289f8c9ce6ca8fadc8619227.tar.bz2 | |
add example as runnable script, version bump for new api versionv1.1.0
Diffstat (limited to 'example.rb')
| -rw-r--r-- | example.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/example.rb b/example.rb new file mode 100644 index 0000000..861a412 --- /dev/null +++ b/example.rb @@ -0,0 +1,27 @@ +require 'rubygems' +require 'evernote' + +user_store_url = "https://sandbox.evernote.com/edam/user" + +config = { + :username => 'username', + :password => 'password', + :consumer_key => 'consumer_key', + :consumer_secret => 'consumer_secret' +} + +user_store = Evernote::UserStore.new(user_store_url, config) + +auth_result = user_store.authenticate +user = auth_result.user +auth_token = auth_result.authenticationToken +puts "Authentication was successful for #{user.username}" +puts "Authentication token = #{auth_token}" + +note_store_url = "http://sandbox.evernote.com/edam/note/#{user.shardId}" +note_store = Evernote::NoteStore.new(note_store_url) + +notebooks = note_store.listNotebooks(auth_token) +puts "Found #{notebooks.size} notebooks:" +default_notebook = notebooks[0] +notebooks.each { |notebook| puts " * #{notebook.name}"} |
