Module: Luxafor::Toggl

Extended by:
Toggl
Included in:
Toggl
Defined in:
lib/luxafor/toggl.rb,
lib/luxafor/toggl/state.rb,
lib/luxafor/toggl/client.rb,
lib/luxafor/toggl/version.rb

Defined Under Namespace

Classes: Client, Error, State

Constant Summary collapse

EXPECTED_ERRORS =
[
  # Filelock::ExecTimeout,
  # Filelock::WaitTimeout,
  # KeyError,
  # Oj::Error,
  # Oj::ParseError,
  # Oj::DepthError,
  # Oj::LoadError,
  # ValueSemantics::MissingAttributes,
].freeze
VERSION =
'1.0.3'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#idle_timeObject



51
52
53
# File 'lib/luxafor/toggl.rb', line 51

def idle_time
  @idle_time ||= ENV.fetch('LUXAFOR_TOGGL_IDLE_TIME', 60 * 60 * 2).to_i # Default is 2 hours before you're idle
end

#luxafor_keyObject



43
44
45
# File 'lib/luxafor/toggl.rb', line 43

def luxafor_key
  @luxafor_key || ENV.fetch('LUXAFOR_KEY')
end

#state_fileObject



47
48
49
# File 'lib/luxafor/toggl.rb', line 47

def state_file
  @state ||= ENV.fetch('LUXAFOR_TOGGL_STATE_FILE', "/tmp/#{Etc.getpwuid(Process.euid).name}-luxafor-toggl-state.json")
end

#toggl_keyObject



39
40
41
# File 'lib/luxafor/toggl.rb', line 39

def toggl_key
  @toggl_key || ENV.fetch('TOGGL_KEY')
end

Instance Method Details

#luxafor_clientObject



59
60
61
# File 'lib/luxafor/toggl.rb', line 59

def luxafor_client
  @luxafor_client ||= Luxafor::Client.new(luxafor_key)
end

#toggl_clientObject



55
56
57
# File 'lib/luxafor/toggl.rb', line 55

def toggl_client
  @toggl_client ||= TogglV8::API.new(toggl_key)
end