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 | |
| parent | 3b8bfd529b9031c8787382293d69d9a030798a2d (diff) | |
| download | evernote-9102191ea729c695289f8c9ce6ca8fadc8619227.tar.bz2 | |
add example as runnable script, version bump for new api versionv1.1.0
| -rw-r--r-- | README.mkd | 4 | ||||
| -rw-r--r-- | VERSION | 1 | ||||
| -rw-r--r-- | evernote.gemspec | 2 | ||||
| -rw-r--r-- | example.rb | 27 | ||||
| -rw-r--r-- | lib/evernote/version.rb | 2 |
5 files changed, 31 insertions, 5 deletions
@@ -5,6 +5,7 @@ This gem is a high level wrapper around Evernote's Thrift-generated ruby code. I 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' @@ -17,8 +18,6 @@ Get yourself a "Client application" API key from Evernote (http://www.evernote.c :consumer_secret => 'YOUR_CONSUMER_SECRECT_FROM_EVERNOTE' } - # note, you could also read in your consumer key information from a YML file - user_store = Evernote::UserStore.new(user_store_url, config) auth_result = user_store.authenticate @@ -46,6 +45,7 @@ Thanks to the following peeps for helping out: * Peter Mangiafico (peetucket) * d1 +* Mikhail Zelenin (MioGreen) ## Copyright ## diff --git a/VERSION b/VERSION deleted file mode 100644 index ac39a10..0000000 --- a/VERSION +++ /dev/null @@ -1 +0,0 @@ -0.9.0 diff --git a/evernote.gemspec b/evernote.gemspec index 45f98e3..20225b0 100644 --- a/evernote.gemspec +++ b/evernote.gemspec @@ -22,6 +22,6 @@ Gem::Specification.new do |s| s.add_development_dependency "yard" s.files = Dir.glob("{lib,spec,vendor}/**/*") + - %w(LICENSE README.mkd Rakefile .gitignore) + %w(LICENSE README.mkd Rakefile .gitignore example.rb) s.require_path = 'lib' end 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}"} diff --git a/lib/evernote/version.rb b/lib/evernote/version.rb index 0e8686b..855b01b 100644 --- a/lib/evernote/version.rb +++ b/lib/evernote/version.rb @@ -1,3 +1,3 @@ module Evernote - VERSION = "1.0.0" + VERSION = "1.1.0" end |
