class EnClient::ListTagCommand

Public Instance Methods

exec_impl() click to toggle source
# File usr/lib/evernote-mode/enclient.rb, line 870
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 881
def get_result_from_local_cache
  LOG.debug "return tags from cache"
  tags = DBUtils.get_all_tags dm
  tags.sort! do |a, b|
    a.name <=> b.name
  end
  reply = ListTagReply.new
  reply.tags = tags
  shell.reply self, reply
end
get_result_from_server() click to toggle source
# File usr/lib/evernote-mode/enclient.rb, line 892
def get_result_from_server
  server_task do
    LOG.debug "return tags from server"
    tags = sm.note_store.listTags sm.auth_token
    DBUtils.sync_updated_tags dm, tags
    tags.sort! do |a, b|
      a.name <=> b.name
    end
    reply = ListTagReply.new
    reply.tags = tags
    @@issued_before = true
    shell.reply self, reply
  end
end