blob: 307d86280e37e5037194f9bb3acff8ccc2be2774 (
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
|
# 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. Based from Chris Sepic's gem this gem (a work in progress) is different in the following ways:
* Will only support Oauth for authentication. You'll need your access token to use the gem.
* Vendors the thrift code. It wasn't working for me using Thrift 0.8 and thrift-client gems. Vendored code comes from the evernote-ruby-sdk.
* Reflects that fact that evernote is sharded and the notestore URL should be stored as part of the user profile (not defaulted)
# setup #
Get a "Client application" API key from Evernote (http://www.evernote.com/about/developer/api/#key), which gives you a "consumer_key" and "consumer_secret". Put the key in a YML file or any other place you put configuration information. Also, get yourself account on both their sandbox system (http://sandbox.evernote.com) and live system. You will be using sandbox for testing.
For rails users, configure gems in your Gemfile and 'bundle install'
gem 'evernote', :github => 'kipcole9/evernote'
gem 'omniauth-evernote', :github => 'kipcole9/omniauth-evernote'
Start your app server and visit '/auth/evernote' to start the app oauth authorization process for your account. Note this requires creating a 'auth_sessions' controller (see omniauth documentation for details). At the end of that process you will have your access token which you'll need to use this gem.
# usage #
Once you got your access token, you could do something like list all of your notebooks:
note_store = Evernote::NoteStore.new(notestore_url, access_token)
notebooks = note_store.list_notebooks
puts "Found #{notebooks.size} notebooks:"
default_notebook = notebooks.first
notebooks.each { |notebook| puts " * #{notebook.name}"}
Note that we're using Ruby-style method names (which will be transformed to the underlying thrift camel-case method names) and that the access token will be unshifted onto the argument array so you don't need to supply it for each method invocation.
The evernote API can be viewed at http://www.evernote.com/about/developer/api/ref/
# to do #
This is a work in progress and not ready for anything except experimentation. Only the notestore api is working.
# contributors #
Thanks to the following peeps for helping out:
* Peter Mangiafico (peetucket)
* d1
* Mikhail Zelenin (MioGreen)
* Jimmy Zimmerman (jimmyz)
* Buck Doyle (backspace)
* Philippe Creux (pcreux)
## Copyright ##
Copyright (c) 2011 Chris Sepic. See LICENSE for details.
|