Class: ENUtils::Core

Inherits:
Object
  • Object
show all
Defined in:
lib/evernote_utils.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(token, production = true) ⇒ Core

Returns a new instance of Core.

Raises:



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/evernote_utils.rb', line 14

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

Instance Attribute Details

#notestoreObject

Returns the value of attribute notestore.



12
13
14
# File 'lib/evernote_utils.rb', line 12

def notestore
  @notestore
end

#tokenObject

Returns the value of attribute token.



12
13
14
# File 'lib/evernote_utils.rb', line 12

def token
  @token
end

Instance Method Details

#notebooks(options = {}) ⇒ Object



39
40
41
# File 'lib/evernote_utils.rb', line 39

def notebooks(options={})
  Notebook.where(self, options)
end

#notes(options = {}) ⇒ Object



35
36
37
# File 'lib/evernote_utils.rb', line 35

def notes(options={})
  Note.where(self, options)
end

#tags(options = {}) ⇒ Object



43
44
45
# File 'lib/evernote_utils.rb', line 43

def tags(options={})
  Tag.where(self, options)
end