time_log_robot 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/lib/time_log_robot/jira/work_logger.rb +7 -6
- data/lib/time_log_robot/reporter.rb +5 -5
- data/lib/time_log_robot/version.rb +1 -1
- data/lib/time_log_robot.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c1d47ec2825a3f0fce407eeaaf2c7517fa47e80
|
4
|
+
data.tar.gz: 3734f3657d12136454d35cc13c49e696a2e097d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0daa1337ab3cf7eb1ce204dd7ffc1b4fdcd636ed8d6d8a81ea4a8d16f0acbd62c4ee6fb12a729f1be892b233748da6f54d566d1394084be2b95a903dbb335755
|
7
|
+
data.tar.gz: 0343c30c49bfa09d73fb2addade436b6951f7747827e2d340134e8bbb8ecac7380f7fa022517b9e3349d170c7886123eda81791ea54c6c037c500dda1337a5f4
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -108,7 +108,7 @@ Here are some notes about how to find the appropriate values for those environme
|
|
108
108
|
|
109
109
|
* **TOGGL_USER_AGENT**: This is your Toggl username, usually your email.
|
110
110
|
* **TOGGL_DEFAULT_LOG_TAG**: This is the tag name you would like to use for tagging your Toggl time entries as they are logged to JIRA.
|
111
|
-
* **JIRA_USERNAME**: This is your JIRA username, which
|
111
|
+
* **JIRA_USERNAME**: This is your JIRA username, which can be found in your JIRA user profile.
|
112
112
|
* **JIRA_PASSWORD**: I know there's a lot of jargon, but some of these are pretty self-explanatory. :trollface:
|
113
113
|
|
114
114
|
### Mapping keys
|
@@ -5,12 +5,12 @@ module TimeLogRobot
|
|
5
5
|
|
6
6
|
base_uri 'https://hranswerlink.atlassian.net/rest/api/2'
|
7
7
|
|
8
|
+
@successes = []
|
8
9
|
@errors = []
|
9
|
-
@logged_count = 0
|
10
10
|
@issue_key = nil
|
11
11
|
|
12
12
|
class << self
|
13
|
-
attr_accessor :errors, :
|
13
|
+
attr_accessor :errors, :successes, :issue_key
|
14
14
|
|
15
15
|
def log_all(service:, time_entries:)
|
16
16
|
time_entries.each do |raw_entry|
|
@@ -45,10 +45,10 @@ module TimeLogRobot
|
|
45
45
|
if response.success?
|
46
46
|
print "\e[32m.\e[0m"
|
47
47
|
tag!(entry) if should_tag?(entry)
|
48
|
-
@
|
48
|
+
@successes << [entry, issue_key, response]
|
49
49
|
else
|
50
50
|
print "\e[31mF\e[0m"
|
51
|
-
@errors << [entry, response]
|
51
|
+
@errors << [entry, issue_key, response]
|
52
52
|
if response.code == 401
|
53
53
|
raise UnauthorizedError, "Please check your username and password and try again"
|
54
54
|
end
|
@@ -57,7 +57,7 @@ module TimeLogRobot
|
|
57
57
|
class UnauthorizedError < Exception; end
|
58
58
|
|
59
59
|
def report!
|
60
|
-
Reporter.report(errors,
|
60
|
+
Reporter.report(errors, successes)
|
61
61
|
end
|
62
62
|
|
63
63
|
def tag!(entry)
|
@@ -83,7 +83,8 @@ module TimeLogRobot
|
|
83
83
|
def build_payload(entry)
|
84
84
|
PayloadBuilder.build(
|
85
85
|
start: entry.start,
|
86
|
-
|
86
|
+
# Add an extra 30 seconds for rounding to nearest minute instead of always rounding down
|
87
|
+
duration_in_seconds: entry.duration_in_seconds + 30,
|
87
88
|
comment: entry.comment
|
88
89
|
)
|
89
90
|
end
|
@@ -3,19 +3,19 @@ module TimeLogRobot
|
|
3
3
|
class << self
|
4
4
|
attr_accessor :errors
|
5
5
|
|
6
|
-
def report(errors,
|
6
|
+
def report(errors, successes)
|
7
7
|
@errors = errors
|
8
8
|
print_errors if errors.any?
|
9
|
-
puts "\n\t#{
|
9
|
+
puts "\n\t#{successes.size} entries logged, #{errors.size} failed.\n\n"
|
10
10
|
end
|
11
11
|
|
12
12
|
def print_errors
|
13
13
|
puts "\n\t\e[1;31m Failed to log the following entries:\e[0m"
|
14
|
-
errors.each_with_index do |(entry, response), index|
|
14
|
+
errors.each_with_index do |(entry, issue_key, response), index|
|
15
15
|
puts "\e[31m"
|
16
16
|
puts "\t#{index + 1})\tDescription: #{entry.description}"
|
17
|
-
if
|
18
|
-
puts "\t\tIssue Key: #{
|
17
|
+
if issue_key
|
18
|
+
puts "\t\tIssue Key: #{issue_key}"
|
19
19
|
else
|
20
20
|
puts "\t\tIssue Key: Missing"
|
21
21
|
end
|
data/lib/time_log_robot.rb
CHANGED
@@ -48,7 +48,7 @@ module TimeLogRobot
|
|
48
48
|
"This is the tag name you would like to use for tagging your Toggl time entries as they are logged to JIRA.\n\n",
|
49
49
|
|
50
50
|
'JIRA_USERNAME' =>
|
51
|
-
"This is your JIRA username, which
|
51
|
+
"This is your JIRA username, which can be found in your JIRA user profile.\n\n",
|
52
52
|
|
53
53
|
'JIRA_PASSWORD' =>
|
54
54
|
"I know there's a lot of jargon, but some of these are pretty self-explanatory\n"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: time_log_robot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark J. Lehman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06-
|
11
|
+
date: 2016-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|