summaryrefslogtreecommitdiffstats
path: root/example.rb
diff options
context:
space:
mode:
authorChris Sepic2011-07-23 15:57:08 -0500
committerChris Sepic2011-07-23 15:57:08 -0500
commit9102191ea729c695289f8c9ce6ca8fadc8619227 (patch)
treefc1631a28ae008413e2fb797357a599a625ae591 /example.rb
parent3b8bfd529b9031c8787382293d69d9a030798a2d (diff)
downloadevernote-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.rb27
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}"}