summaryrefslogtreecommitdiffstats
path: root/lib/evernote
diff options
context:
space:
mode:
Diffstat (limited to 'lib/evernote')
-rw-r--r--lib/evernote/client.rb17
-rw-r--r--lib/evernote/note_store.rb10
2 files changed, 7 insertions, 20 deletions
diff --git a/lib/evernote/client.rb b/lib/evernote/client.rb
deleted file mode 100644
index 6293f17..0000000
--- a/lib/evernote/client.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-module Evernote
- class Client
-
- THRIFT_DEFAULTS = {
- :transport => Thrift::HTTPClientTransport
- }.freeze
-
- def initialize(klass, url, thrift_client_options = {})
- thrift_opts = THRIFT_DEFAULTS.merge(thrift_client_options)
- @client = ThriftClient.new(klass, url, thrift_opts)
- end
-
- def method_missing(name, *args, &block)
- @client.send(name, *args, &block)
- end
- end
-end
diff --git a/lib/evernote/note_store.rb b/lib/evernote/note_store.rb
index 218d4c9..5c8f225 100644
--- a/lib/evernote/note_store.rb
+++ b/lib/evernote/note_store.rb
@@ -1,11 +1,15 @@
module Evernote
class NoteStore
- def initialize(uri, thrift_client_options = {})
- @client = Evernote::Client.new(Evernote::EDAM::NoteStore::NoteStore::Client, uri, thrift_client_options)
+ def initialize(notestore_url, access_token)
+ notestore_transport = Thrift::HTTPClientTransport.new(notestore_url)
+ notestore_protocol = Thrift::BinaryProtocol.new(notestore_transport)
+ @notestore = Evernote::EDAM::NoteStore::NoteStore::Client.new(notestore_protocol)
+ @access_token = access_token
end
+ # Camelize the method names for ruby consistency and push the access_token to the front of the args array
def method_missing(name, *args, &block)
- @client.send(name, *args, &block)
+ @notestore.send(name.to_s.camelize(:lower), *(args.unshift(@access_token)), &block)
end
end
end