Class: SimpleSlack::Toggl

Inherits:
Object
  • Object
show all
Includes:
TogglDailyreport, TogglParameter
Defined in:
lib/simple_slack/toggl.rb

Constant Summary collapse

URL =
"https://toggl.com/"
TIMER_URL =
"#{URL}app/timer"

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from TogglDailyreport

#dailyreport, #today_entry_reports

Methods included from TogglParameter

#project, #projects, #tag, #tags, #user, #workspace, #workspaces

Methods included from TogglSendParameter

#send_after_noon_message, #send_dailyreport_message, #send_morning_message, #send_night_message, #send_noon_message, #send_regular_message

Methods included from TogglEntriesParameter

#day_entries, #entries, #entry_info, #entry_info_hash, #latest_entry, #working_entry

Constructor Details

#initialize(toggl_api_token, simple_slack_client) ⇒ Toggl

Returns a new instance of Toggl.



14
15
16
17
18
19
20
21
# File 'lib/simple_slack/toggl.rb', line 14

def initialize(toggl_api_token, simple_slack_client)
  @toggl_client   = TogglV8::API.new(toggl_api_token)
  @simple_client  = simple_slack_client
  @post_bot_name  = "slacker"
  @post_bot_image = ":joy:"
  @post_channels  = []
  @post_ims       = []
end

Instance Attribute Details

#post_bot_imageObject

Returns the value of attribute post_bot_image.



9
10
11
# File 'lib/simple_slack/toggl.rb', line 9

def post_bot_image
  @post_bot_image
end

#post_bot_nameObject

Returns the value of attribute post_bot_name.



9
10
11
# File 'lib/simple_slack/toggl.rb', line 9

def post_bot_name
  @post_bot_name
end

#post_channelsObject

Returns the value of attribute post_channels.



9
10
11
# File 'lib/simple_slack/toggl.rb', line 9

def post_channels
  @post_channels
end

#post_imsObject

Returns the value of attribute post_ims.



9
10
11
# File 'lib/simple_slack/toggl.rb', line 9

def post_ims
  @post_ims
end

#simple_clientObject

Returns the value of attribute simple_client.



9
10
11
# File 'lib/simple_slack/toggl.rb', line 9

def simple_client
  @simple_client
end

#toggl_clientObject

Returns the value of attribute toggl_client.



9
10
11
# File 'lib/simple_slack/toggl.rb', line 9

def toggl_client
  @toggl_client
end

Instance Method Details

#configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



23
24
25
# File 'lib/simple_slack/toggl.rb', line 23

def configure
  yield self
end

#post_message(type = :regular) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/simple_slack/toggl.rb', line 27

def post_message(type = :regular)
  case type.to_s
  when "morning"
    post_message_by(send_morning_message)
  when "regular"
    post_message_by(send_regular_message)
  when "noon"
    post_message_by(send_noon_message)
  when "after_noon"
    post_message_by(send_after_noon_message)
  when "night"
    post_message_by(send_night_message)
  when "dailyreport"
    post_message_by(send_dailyreport_message)
  end
end