Class: DoTime

Inherits:
Object
  • Object
show all
Includes:
HighLine::SystemExtensions
Defined in:
lib/do_time.rb

Constant Summary collapse

VERSION =
'0.1.0'
ENTER_KEY =
RUBY_PLATFORM !~ /mswin32|mingw|cygwin|bccwin32|darwin/ ? "\n" : "\r"
SPACE_KEY =
" "
BASIC_ACTIONS =
[
  ['p', 'Select a different project','Select from a list of the active projects belonging to owner'],
  ['l', 'Select a different list','Select a different todo list from those available in the current projects'],
  ['r', 'Refresh list','Restart session and refresh status of todos in current list'],
  ['q', 'Quit DoTime', 'Just exit this app']
]
ACTIVE_LIST_ACTIONS =
[
  ['1-9/01-99', 'Start/Stop todo timer','Press the number of the todo to start/stop timing it. If more than 9 items in list use 01-09.'],
  ['c', 'Complete todo','Complete a running todo e.g. type c3 to complete todo no 3.'],
  [ENTER_KEY, 'Complete running todo','Completes the only running todo. Otherwise starts next available todo'],
  [SPACE_KEY, 'Stop running todo','Stop timing the only running todo. Otherwise starts next available todo']
]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ DoTime

Returns a new instance of DoTime.



43
44
45
46
47
48
49
# File 'lib/do_time.rb', line 43

def initialize(args)
  @login, @password, @use_ssl, @bc_url = *args
  @bc_url ||= 'webtypes.projectpath.com'
  init_bc_session
  @valid_lists = []
  @running_todos = {}
end

Instance Attribute Details

#bc_urlObject

Returns the value of attribute bc_url.



41
42
43
# File 'lib/do_time.rb', line 41

def bc_url
  @bc_url
end

#current_listObject

Returns the value of attribute current_list.



41
42
43
# File 'lib/do_time.rb', line 41

def current_list
  @current_list
end

#current_ownerObject

Returns the value of attribute current_owner.



41
42
43
# File 'lib/do_time.rb', line 41

def current_owner
  @current_owner
end

#current_projectObject

Returns the value of attribute current_project.



41
42
43
# File 'lib/do_time.rb', line 41

def current_project
  @current_project
end

#loginObject

Returns the value of attribute login.



41
42
43
# File 'lib/do_time.rb', line 41

def 
  @login
end

#passwordObject

Returns the value of attribute password.



41
42
43
# File 'lib/do_time.rb', line 41

def password
  @password
end

#running_todos=(value) ⇒ Object

Sets the attribute running_todos

Parameters:

  • value

    the value to set the attribute running_todos to.



41
42
43
# File 'lib/do_time.rb', line 41

def running_todos=(value)
  @running_todos = value
end

#sessionObject

Returns the value of attribute session.



41
42
43
# File 'lib/do_time.rb', line 41

def session
  @session
end

#use_sslObject

Returns the value of attribute use_ssl.



41
42
43
# File 'lib/do_time.rb', line 41

def use_ssl
  @use_ssl
end

#valid_listsObject

Returns the value of attribute valid_lists.



41
42
43
# File 'lib/do_time.rb', line 41

def valid_lists
  @valid_lists
end

Instance Method Details

#runObject

Entry point to DoTime



52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/do_time.rb', line 52

def run
  clear_screen
  unless @current_project
    select_project
  end

  if !@current_list
    select_list
  end

  make_selections
end