class Ruboty::Toggl::Actions::Start

Public Instance Methods

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

Private Instance Methods

start() click to toggle source
# File lib/ruboty/toggl/actions/start.rb, line 20
def start
  unless project
    return message.reply("project #{message[:project]} not found.")
  end
  message.reply("Start `#{time_entity['description']}` in project `#{project['name']}` !")
end
time_entity() click to toggle source
# File lib/ruboty/toggl/actions/start.rb, line 27
def time_entity
  params= {
      'billable' => false,
      'description' => message[:description],
      'pid' => project['id'],
      'wid' => workspace,
  }
  toggl.start_time_entry(params)
end