class Ruboty::Toggl::Actions::Workspace

Public Instance Methods

call() click to toggle source
# File lib/ruboty/toggl/actions/workspace.rb, line 5
def call
  if access_token?
    set_workspace
  else
    require_access_token
  end
rescue => exception
  message.reply("Failed by #{exception.class}")
end

Private Instance Methods

given_workspace() click to toggle source
# File lib/ruboty/toggl/actions/workspace.rb, line 25
def given_workspace
  message[:workspace_id]
end
set_workspace() click to toggle source
# File lib/ruboty/toggl/actions/workspace.rb, line 16
def set_workspace
  unless valid_workspace
    message.reply("Invalid workspace id #{given_workspace}")
    return reply_my_workspaces
  end
  workspaces[sender_name] = given_workspace
  message.reply("Remembered #{sender_name}'s workspace")
end
valid_workspace() click to toggle source
# File lib/ruboty/toggl/actions/workspace.rb, line 29
def valid_workspace
  return toggl.projects given_workspace
rescue => _
  return false
end