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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f61caa0dc4d6525a101c6ce36384098b0b84d707
4
- data.tar.gz: 946edcfc71a494b8687572411440988dabfb6fc0
3
+ metadata.gz: 3c1d47ec2825a3f0fce407eeaaf2c7517fa47e80
4
+ data.tar.gz: 3734f3657d12136454d35cc13c49e696a2e097d3
5
5
  SHA512:
6
- metadata.gz: 7d9a8d4838ec1f7178e9ee66111d9e13dabd1324ec24de3d634d662b7d389c08739ed797cb4980470dd3144f38d82074c7ccd3ebb74a6821ab834a369f4ce973
7
- data.tar.gz: ce614922c96cdaf8fa142bf4c7fb005d43d1f4cdac73eb421f7dd72f7a920ace010d8ebc606479ccdb89051d62970db1e5047429d98f56f611dbcb842544a6e8
6
+ metadata.gz: 0daa1337ab3cf7eb1ce204dd7ffc1b4fdcd636ed8d6d8a81ea4a8d16f0acbd62c4ee6fb12a729f1be892b233748da6f54d566d1394084be2b95a903dbb335755
7
+ data.tar.gz: 0343c30c49bfa09d73fb2addade436b6951f7747827e2d340134e8bbb8ecac7380f7fa022517b9e3349d170c7886123eda81791ea54c6c037c500dda1337a5f4
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- time_log_robot (0.2.0)
4
+ time_log_robot (0.2.1)
5
5
  activesupport (~> 4.2, >= 4.2.6)
6
6
  commander (~> 4.1, >= 4.1.6)
7
7
  httparty (~> 0.13, >= 0.13.0)
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 is not an email, but usually your email minus the "@domain.com"
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, :logged_count, :issue_key
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
- @logged_count += 1
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, logged_count)
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
- duration_in_seconds: entry.duration_in_seconds,
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, logged_count)
6
+ def report(errors, successes)
7
7
  @errors = errors
8
8
  print_errors if errors.any?
9
- puts "\n\t#{logged_count} entries logged, #{errors.size} failed.\n\n"
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 entry.issue_key
18
- puts "\t\tIssue Key: #{entry.issue_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
@@ -1,3 +1,3 @@
1
1
  module TimeLogRobot
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  end
@@ -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 is not an email, but usually your email minus the '@domain.com'\n\n",
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.0
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-19 00:00:00.000000000 Z
11
+ date: 2016-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry