class EnClient::ListNotebookCommand

Public Instance Methods

exec_impl() click to toggle source
# File usr/lib/evernote-mode/enclient.rb, line 768
def exec_impl
  check_auth
  if dm.during_full_sync? && !@@issued_before
    get_result_from_server
  else
    get_result_from_local_cache
  end
end

Private Instance Methods

get_result_from_local_cache() click to toggle source
# File usr/lib/evernote-mode/enclient.rb, line 779
def get_result_from_local_cache
  LOG.debug "return notebooks from cache"
  notebooks = DBUtils.get_all_notebooks dm
  notebooks.sort! do |a, b|
    a.name <=> b.name
  end
  reply = ListNotebookReply.new
  reply.notebooks = notebooks
  shell.reply self, reply
end
get_result_from_server() click to toggle source
# File usr/lib/evernote-mode/enclient.rb, line 790
def get_result_from_server
  server_task do
    LOG.debug "return notebooks from server"
    notebooks = sm.note_store.listNotebooks sm.auth_token
    DBUtils.sync_updated_notebooks dm, notebooks
    reply = ListNotebookReply.new
    reply.notebooks = notebooks
    @@issued_before = true
    shell.reply self, reply
  end
end