Class: Teems::Commands::Status

Inherits:
Base
  • Object
show all
Includes:
StatusActions, StatusDisplay
Defined in:
lib/teems/commands/status.rb

Overview

View and manage your presence status

Constant Summary collapse

PRESENCE_MAP =
{
  'available' => %w[Available Available],
  'busy' => %w[Busy Busy],
  'dnd' => %w[DoNotDisturb DoNotDisturb],
  'away' => %w[Away Away],
  'brb' => %w[BeRightBack BeRightBack],
  'offline' => %w[Offline OffWork]
}.freeze
DEFAULT_PRESENCE_DURATION =
'PT4H'
STATUS_OPTIONS =
{
  '-p' => ->(opts, args) { opts[:presence] = args.shift },
  '--presence' => ->(opts, args) { opts[:presence] = args.shift }
}.freeze

Constants included from StatusDisplay

Teems::Commands::StatusDisplay::AVAILABILITY_LABELS

Instance Attribute Summary

Attributes inherited from Base

#options, #positional_args, #runner

Instance Method Summary collapse

Constructor Details

#initialize(args, runner:) ⇒ Status

Returns a new instance of Status.



149
150
151
152
# File 'lib/teems/commands/status.rb', line 149

def initialize(args, runner:)
  @options = {}
  super
end

Instance Method Details

#executeObject



154
155
156
157
158
159
160
161
162
# File 'lib/teems/commands/status.rb', line 154

def execute
  result = validate_options
  return result if result

  auth_result = require_auth
  return auth_result if auth_result

  dispatch
end