class ENUtils::Core
Attributes
notestore[RW]
token[RW]
Public Class Methods
new(token, production=true)
click to toggle source
# File lib/evernote_utils.rb, line 16 def initialize(token, production=true) userStoreUrl = "https://#{production ? 'www' : 'sandbox'}.evernote.com/edam/user" userStoreTransport = Thrift::HTTPClientTransport.new(userStoreUrl) userStoreProtocol = Thrift::BinaryProtocol.new(userStoreTransport) userStore = Evernote::EDAM::UserStore::UserStore::Client.new(userStoreProtocol) versionOK = userStore.checkVersion("Evernote EDAMTest (Ruby)", Evernote::EDAM::UserStore::EDAM_VERSION_MAJOR, Evernote::EDAM::UserStore::EDAM_VERSION_MINOR) raise InvalidVersion unless versionOK noteStoreUrl = userStore.getNoteStoreUrl(token) noteStoreTransport = Thrift::HTTPClientTransport.new(noteStoreUrl) noteStoreProtocol = Thrift::BinaryProtocol.new(noteStoreTransport) @notestore = Evernote::EDAM::NoteStore::NoteStore::Client.new(noteStoreProtocol) @token = token end
Public Instance Methods
create_note(attrs)
click to toggle source
# File lib/evernote_utils.rb, line 53 def create_note(attrs) Note.create(self, attrs) end
create_tag(attrs)
click to toggle source
# File lib/evernote_utils.rb, line 72 def create_tag(attrs) Tag.create(self, attrs) end
delete_note(guid)
click to toggle source
# File lib/evernote_utils.rb, line 57 def delete_note(guid) Note.delete(self, guid) end
find_note(guid, with_content: false, with_resources_data: false, with_resources_recognition: false, with_resources_alternate_data: false)
click to toggle source
# File lib/evernote_utils.rb, line 42 def find_note(guid, with_content: false, with_resources_data: false, with_resources_recognition: false, with_resources_alternate_data: false) self.notestore.getNote(self.token, guid, with_content, with_resources_data, with_resources_recognition, with_resources_alternate_data) end
Also aliased as: note
find_notebook(name=nil)
click to toggle source
# File lib/evernote_utils.rb, line 61 def find_notebook(name=nil) return nil unless name Notebook.find_by_name(self, name) end
Also aliased as: notebook
find_notebooks(options={})
click to toggle source
# File lib/evernote_utils.rb, line 67 def find_notebooks(options={}) Notebook.where(self, options) end
Also aliased as: notebooks
find_notes(options={})
click to toggle source
# File lib/evernote_utils.rb, line 37 def find_notes(options={}) Note.where(self, options.reverse_merge(order: :updated)) end
Also aliased as: notes
find_tag(name=nil)
click to toggle source
# File lib/evernote_utils.rb, line 76 def find_tag(name=nil) return nil unless name Tag.find_by_name(self, name) end
Also aliased as: tag
note(guid, with_content: false, with_resources_data: false, with_resources_recognition: false, with_resources_alternate_data: false)
Alias for: find_note