ruboty-toggl_team 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -0
- data/lib/ruboty/handlers/toggl_team.rb +11 -0
- data/lib/ruboty/toggl_team/actions/toggl_team.rb +20 -0
- data/lib/ruboty/toggl_team/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d16ae0a27e1c79ebc3e64251dcb911f4e961c8a68543bc79d4034a7bba325c7
|
4
|
+
data.tar.gz: 520664ee511f8b960d8156c0b8e830949e010054f86c9493fc78ebb8c9a77f57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1406f87467a50ca0510fc5e3ac1022cb585312ca660fb72cc9524dbf5dfc6dea45e198a3e73e4213c0291fc49c96ace0d865670283aa01672a255563f58e830e
|
7
|
+
data.tar.gz: 170716da0cf675b7de6fe502dc568bb49c1c0630bf1f36249c1b996be2393dd705ff6dc17bfe34695515f5e85daf5640d81d060a7d6d06fc992f26b8fbb8aaa6
|
data/README.md
CHANGED
@@ -42,6 +42,12 @@ start <task> <project-name>
|
|
42
42
|
stop
|
43
43
|
```
|
44
44
|
|
45
|
+
### Get report
|
46
|
+
|
47
|
+
```
|
48
|
+
today
|
49
|
+
```
|
50
|
+
|
45
51
|
## Contributing
|
46
52
|
|
47
53
|
Bug reports and pull requests are welcome on GitHub at https://github.com/kimromi/ruboty-toggl_team. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
@@ -36,6 +36,13 @@ module Ruboty
|
|
36
36
|
all: true
|
37
37
|
)
|
38
38
|
|
39
|
+
on(
|
40
|
+
/^today$/,
|
41
|
+
name: 'today',
|
42
|
+
description: 'get today time report',
|
43
|
+
all: true
|
44
|
+
)
|
45
|
+
|
39
46
|
def set_token(message)
|
40
47
|
action(message).set_token
|
41
48
|
end
|
@@ -56,6 +63,10 @@ module Ruboty
|
|
56
63
|
action(message).stop
|
57
64
|
end
|
58
65
|
|
66
|
+
def today(message)
|
67
|
+
action(message).today
|
68
|
+
end
|
69
|
+
|
59
70
|
private
|
60
71
|
|
61
72
|
def action(message)
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'togglv8'
|
2
2
|
require 'active_support/core_ext/hash/keys'
|
3
|
+
require 'active_support/core_ext/time/calculations'
|
3
4
|
|
4
5
|
module Ruboty
|
5
6
|
module TogglTeam
|
@@ -84,6 +85,25 @@ module Ruboty
|
|
84
85
|
message.reply("error! #{e}")
|
85
86
|
end
|
86
87
|
|
88
|
+
def today
|
89
|
+
unless user_token && user_workspace
|
90
|
+
message.reply("please set #{user}'s toggl token and workspace!") and return
|
91
|
+
end
|
92
|
+
|
93
|
+
entries = toggl.get_time_entries(
|
94
|
+
start_date: DateTime.parse(Time.now.beginning_of_day.to_s),
|
95
|
+
end_date: DateTime.parse(Time.now.end_of_day.to_s)
|
96
|
+
)
|
97
|
+
|
98
|
+
report = entries.map do |e|
|
99
|
+
start_at = Time.parse(e['start']).localtime.strftime('%R')
|
100
|
+
end_at = Time.parse(e['stop']).localtime.strftime('%R')
|
101
|
+
"#{start_at}-#{end_at} : #{e['description']}"
|
102
|
+
end.join("\n")
|
103
|
+
|
104
|
+
message.reply(report)
|
105
|
+
end
|
106
|
+
|
87
107
|
private
|
88
108
|
|
89
109
|
def brain
|