summaryrefslogtreecommitdiffstats
path: root/README.mkd
blob: 94f7101eb19adfa03ac24ee6feaa5db22e9fd267 (plain)
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# evernote #
This gem is a high level wrapper around Evernote's Thrift-generated ruby code. It bundles up Evernote's thrift-generated code and creates some simple wrapper classes.

# setup #
Get yourself a "Client application" API key from Evernote (http://www.evernote.com/about/developer/api/#key), which gives you a "consumer_key" and "consumer_secret" (note that a "web application" API key uses OAuth to authenticate and will not work).  Put the key in a YML file or any other place you put configuration information.  Also, get yourself a username and password on both their sandbox system (http://sandbox.evernote.com) and live system.  You will be using sandbox for testing.

# usage #
This script is also located in /example.rb

    require 'evernote'

    user_store_url = "https://sandbox.evernote.com/edam/user"
      
    config = {
       :username => 'YOUR_USERNAME',
       :password => 'YOUR_PASSWORD',
       :consumer_key => 'YOUR_CONSUMER_KEY_FROM_EVERNOTE',
       :consumer_secret => 'YOUR_CONSUMER_SECRECT_FROM_EVERNOTE'
             }
               
    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}"

Once you've authenticated, you could do something like list all of your notebooks:

    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}"}

The evernote API can be viewed at http://www.evernote.com/about/developer/api/ref/

If the vendored code is out of date and you get an error indicating so, feel free to create an issue at http://github.com/cgs/evernote/issues

# contributors #
Thanks to the following peeps for helping out:

* Peter Mangiafico (peetucket)
* d1
* Mikhail Zelenin (MioGreen)
* Jimmy Zimmerman (jimmyz)
* Buck Doyle (backspace)

## Copyright ##
Copyright (c) 2011 Chris Sepic. See LICENSE for details.