forked from cgs/evernote
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.rb
27 lines (21 loc) · 820 Bytes
/
example.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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}"}