summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.mkd46
-rw-r--r--VERSION2
-rw-r--r--evernote.gemspec7
-rw-r--r--lib/evernote.rb1
-rw-r--r--lib/evernote/note_store.rb11
-rw-r--r--spec/evernote/note_store_spec.rb10
6 files changed, 70 insertions, 7 deletions
diff --git a/README.mkd b/README.mkd
index fd1fa20..ba370b5 100644
--- a/README.mkd
+++ b/README.mkd
@@ -1,10 +1,48 @@
# evernote #
-This gem is a high level wrapper around Evernote's Thrift-generated ruby code. It currently just bundles up Evernote's thrift-generated code. After installing, just require the gem in your project:
+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.
-require 'evernote'
+# usage #
+Create a config yml:
-# future releases #
-This gem will eventually provide a cleaner API around the generated code, so you don't feel like you're writing Java.
+ sandbox:
+ username: user
+ password: password
+ consumer_key: key
+ consumer_secret: secret
+
+ production:
+ username: user
+ password: password
+ consumer_key: key
+ consumer_secret: secret
+
+Here's an example using the sandbox key:
+
+ require 'evernote'
+
+ user_store_url = "https://sandbox.evernote.com/edam/user"
+ config = File.dirname(__FILE__) + "/config.yml"
+ user_store = Evernote::UserStore.new(user_store_url, config, "sandbox")
+
+ 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
## Copyright ##
Copyright (c) 2010 Chris Sepic. See LICENSE for details.
diff --git a/VERSION b/VERSION
index 0ea3a94..a3df0a6 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.2.0
+0.8.0
diff --git a/evernote.gemspec b/evernote.gemspec
index b630d3c..e5e9694 100644
--- a/evernote.gemspec
+++ b/evernote.gemspec
@@ -5,11 +5,11 @@
Gem::Specification.new do |s|
s.name = %q{evernote}
- s.version = "0.2.0"
+ s.version = "0.8.0"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Chris Sepic"]
- s.date = %q{2010-02-27}
+ s.date = %q{2010-03-19}
s.email = %q{chris.sepic@gmail.com}
s.extra_rdoc_files = [
"LICENSE",
@@ -25,9 +25,11 @@ Gem::Specification.new do |s|
"evernote.gemspec",
"lib/evernote.rb",
"lib/evernote/client.rb",
+ "lib/evernote/note_store.rb",
"lib/evernote/user_store.rb",
"spec/evernote/auth.yaml",
"spec/evernote/client_spec.rb",
+ "spec/evernote/note_store_spec.rb",
"spec/evernote/user_store_spec.rb",
"spec/spec.opts",
"spec/spec_helper.rb",
@@ -51,6 +53,7 @@ Gem::Specification.new do |s|
s.summary = %q{High level wrapper for the Evernote API}
s.test_files = [
"spec/evernote/client_spec.rb",
+ "spec/evernote/note_store_spec.rb",
"spec/evernote/user_store_spec.rb",
"spec/spec_helper.rb"
]
diff --git a/lib/evernote.rb b/lib/evernote.rb
index 81441d7..d12c9b6 100644
--- a/lib/evernote.rb
+++ b/lib/evernote.rb
@@ -7,3 +7,4 @@ $LOAD_PATH.unshift "#{gen_rb_path}/evernote/edam"
require "#{gen_rb_path}/evernote"
require "evernote/client"
require "evernote/user_store"
+require "evernote/note_store"
diff --git a/lib/evernote/note_store.rb b/lib/evernote/note_store.rb
new file mode 100644
index 0000000..218d4c9
--- /dev/null
+++ b/lib/evernote/note_store.rb
@@ -0,0 +1,11 @@
+module Evernote
+ class NoteStore
+ def initialize(uri, thrift_client_options = {})
+ @client = Evernote::Client.new(Evernote::EDAM::NoteStore::NoteStore::Client, uri, thrift_client_options)
+ end
+
+ def method_missing(name, *args, &block)
+ @client.send(name, *args, &block)
+ end
+ end
+end
diff --git a/spec/evernote/note_store_spec.rb b/spec/evernote/note_store_spec.rb
new file mode 100644
index 0000000..366adbd
--- /dev/null
+++ b/spec/evernote/note_store_spec.rb
@@ -0,0 +1,10 @@
+require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
+
+describe "Evernote::NoteStore" do
+ it "should proxy methods" do
+ note_store = Evernote::NoteStore.new("http://sandbox.evernote.com/edam/note/")
+ note_store.instance_variable_get(:@client).should_receive(:foobar).and_return(nil)
+
+ note_store.foobar
+ end
+end