class Everlog::Inf::Api::Evernote

Public Class Methods

new(is_sandbox, config) click to toggle source
# File lib/everlog/inf/api/evernote.rb, line 5
def initialize(is_sandbox, config)
  @is_sandbox = is_sandbox
  @config = config
end

Public Instance Methods

client() click to toggle source
# File lib/everlog/inf/api/evernote.rb, line 10
def client
  @client ||= EvernoteOAuth::Client.new(token: @config.access_secret, sandbox: @is_sandbox)
end
create_notebook(title) click to toggle source
# File lib/everlog/inf/api/evernote.rb, line 30
def create_notebook title
  notebook.name = title
  client.note_store.createNotebook notebook
rescue => e
  raise InfrastructureEvernoteError, "create_notebook error / class:#{e.class} code:#{e.errorCode}"
end
note() click to toggle source
# File lib/everlog/inf/api/evernote.rb, line 14
def note
  @note ||= ::Evernote::EDAM::Type::Note.new
end
notebook() click to toggle source
# File lib/everlog/inf/api/evernote.rb, line 18
def notebook
  @notebook ||= ::Evernote::EDAM::Type::Notebook.new
end
notebooks() click to toggle source
# File lib/everlog/inf/api/evernote.rb, line 37
def notebooks
  client.note_store.listNotebooks
rescue => e
  raise InfrastructureEvernoteError, "notebooks error / class:#{e.class} code:#{e.errorCode}"
end
post_note(title, content) click to toggle source
# File lib/everlog/inf/api/evernote.rb, line 22
def post_note(title, content)
  note.title = title
  note.content = content
  client.note_store.createNote(@config.access_secret, note)
rescue => e
  raise InfrastructureEvernoteError, "post note error / class:#{e.class} code:#{e.errorCode}"
end