Class: Luxafor::Toggl::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/luxafor/toggl/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(toggl: Luxafor::Toggl.toggl_client, luxafor: Luxafor::Toggl.luxafor_client, state: Luxafor::Toggl::state_file) ⇒ Client

Returns a new instance of Client.



4
5
6
7
8
# File 'lib/luxafor/toggl/client.rb', line 4

def initialize(toggl: Luxafor::Toggl.toggl_client, luxafor: Luxafor::Toggl.luxafor_client, state: Luxafor::Toggl::state_file)
  @toggl      = toggl
  @luxafor    = luxafor
  @state_file = state
end

Instance Method Details

#execute!Object



10
11
12
13
14
15
16
17
18
# File 'lib/luxafor/toggl/client.rb', line 10

def execute!
  return false unless current_state.sufficiently_different_from?(stored_state)

  luxafor.on(current_state.colour)

  current_state.store!(state_file)

  true
end