abt-cli 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/abt/providers/harvest/commands/current.rb +11 -9
- data/lib/abt/providers/harvest/commands/init.rb +7 -1
- data/lib/abt/providers/harvest/commands/pick.rb +9 -7
- data/lib/abt/providers/harvest/commands/projects.rb +7 -1
- data/lib/abt/providers/harvest/commands/start.rb +14 -2
- data/lib/abt/providers/harvest/commands/tasks.rb +16 -9
- data/lib/abt/providers/harvest/configuration.rb +6 -7
- data/lib/abt/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: 48f55dc71fb2babaa1b1b6ce4aa99dfdc3eea8a31f0cdc8bd43eecd94cd220f0
|
4
|
+
data.tar.gz: 94ece036845a7375e434bde005f388bf7e8e9a7f0f1b89c6b19ecfa7bbb8bb7a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56ab38ab3607b95f420cb8178250d6bb83f338a92695011d753b9218a462292f2a0c95cb06d32a7b316142ace8def6a20be441df0e01f1dbb214384af239cf99
|
7
|
+
data.tar.gz: 96927e87f95be0cb844dbabbceb855ee26f5d77ef0f44e3728166f3e9e84123a71d4a71f5eb38f9c8ebb099be7ba3eda46dd7ed8fd1e5e41ddf5bcc0f71c2061
|
@@ -58,22 +58,24 @@ module Abt
|
|
58
58
|
end
|
59
59
|
|
60
60
|
def project
|
61
|
-
@project ||=
|
61
|
+
@project ||= project_assignment['project'].merge('client' => project_assignment['client'])
|
62
62
|
end
|
63
63
|
|
64
64
|
def task
|
65
|
-
|
66
|
-
|
67
|
-
|
65
|
+
@task ||= project_assignment['task_assignments'].map { |ta| ta['task'] }.find do |task|
|
66
|
+
task['id'].to_s == task_id
|
67
|
+
end
|
68
68
|
end
|
69
69
|
|
70
|
-
def
|
71
|
-
@
|
72
|
-
|
73
|
-
rescue Abt::HttpError::HttpError # rubocop:disable Layout/RescueEnsureAlignment
|
74
|
-
[]
|
70
|
+
def project_assignment
|
71
|
+
@project_assignment ||= begin
|
72
|
+
project_assignments.find { |pa| pa['project']['id'].to_s == project_id }
|
75
73
|
end
|
76
74
|
end
|
75
|
+
|
76
|
+
def project_assignments
|
77
|
+
@project_assignments ||= api.get_paged('users/me/project_assignments')
|
78
|
+
end
|
77
79
|
end
|
78
80
|
end
|
79
81
|
end
|
@@ -58,9 +58,15 @@ module Abt
|
|
58
58
|
def projects
|
59
59
|
@projects ||= begin
|
60
60
|
cli.warn 'Fetching projects...'
|
61
|
-
|
61
|
+
project_assignments.map do |project_assignment|
|
62
|
+
project_assignment['project'].merge('client' => project_assignment['client'])
|
63
|
+
end
|
62
64
|
end
|
63
65
|
end
|
66
|
+
|
67
|
+
def project_assignments
|
68
|
+
@project_assignments ||= api.get_paged('users/me/project_assignments')
|
69
|
+
end
|
64
70
|
end
|
65
71
|
end
|
66
72
|
end
|
@@ -28,20 +28,22 @@ module Abt
|
|
28
28
|
private
|
29
29
|
|
30
30
|
def project
|
31
|
-
|
31
|
+
project_assignment['project']
|
32
32
|
end
|
33
33
|
|
34
34
|
def tasks
|
35
|
-
|
35
|
+
@tasks ||= project_assignment['task_assignments'].map { |ta| ta['task'] }
|
36
36
|
end
|
37
37
|
|
38
|
-
def
|
39
|
-
@
|
40
|
-
|
41
|
-
rescue Abt::HttpError::HttpError # rubocop:disable Layout/RescueEnsureAlignment
|
42
|
-
[]
|
38
|
+
def project_assignment
|
39
|
+
@project_assignment ||= begin
|
40
|
+
project_assignments.find { |pa| pa['project']['id'].to_s == project_id }
|
43
41
|
end
|
44
42
|
end
|
43
|
+
|
44
|
+
def project_assignments
|
45
|
+
@project_assignments ||= api.get_paged('users/me/project_assignments')
|
46
|
+
end
|
45
47
|
end
|
46
48
|
end
|
47
49
|
end
|
@@ -24,9 +24,15 @@ module Abt
|
|
24
24
|
def projects
|
25
25
|
@projects ||= begin
|
26
26
|
cli.warn 'Fetching projects...'
|
27
|
-
|
27
|
+
project_assignments.map do |project_assignment|
|
28
|
+
project_assignment['project'].merge('client' => project_assignment['client'])
|
29
|
+
end
|
28
30
|
end
|
29
31
|
end
|
32
|
+
|
33
|
+
def project_assignments
|
34
|
+
@project_assignments ||= api.get_paged('users/me/project_assignments')
|
35
|
+
end
|
30
36
|
end
|
31
37
|
end
|
32
38
|
end
|
@@ -52,11 +52,23 @@ module Abt
|
|
52
52
|
end
|
53
53
|
|
54
54
|
def project
|
55
|
-
|
55
|
+
project_assignment['project']
|
56
56
|
end
|
57
57
|
|
58
58
|
def task
|
59
|
-
@task ||=
|
59
|
+
@task ||= project_assignment['task_assignments'].map { |ta| ta['task'] }.find do |task|
|
60
|
+
task['id'].to_s == task_id
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def project_assignment
|
65
|
+
@project_assignment ||= begin
|
66
|
+
project_assignments.find { |pa| pa['project']['id'].to_s == project_id }
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def project_assignments
|
71
|
+
@project_assignments ||= api.get_paged('users/me/project_assignments')
|
60
72
|
end
|
61
73
|
|
62
74
|
def external_link_data
|
@@ -14,23 +14,30 @@ module Abt
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def call
|
17
|
-
|
18
|
-
project = a['project']
|
19
|
-
task = a['task']
|
20
|
-
|
17
|
+
tasks.each do |task|
|
21
18
|
print_task(project, task)
|
22
19
|
end
|
23
20
|
end
|
24
21
|
|
25
22
|
private
|
26
23
|
|
27
|
-
def
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
24
|
+
def project
|
25
|
+
project_assignment['project']
|
26
|
+
end
|
27
|
+
|
28
|
+
def tasks
|
29
|
+
@tasks ||= project_assignment['task_assignments'].map { |ta| ta['task'] }
|
30
|
+
end
|
31
|
+
|
32
|
+
def project_assignment
|
33
|
+
@project_assignment ||= begin
|
34
|
+
project_assignments.find { |pa| pa['project']['id'].to_s == project_id }
|
32
35
|
end
|
33
36
|
end
|
37
|
+
|
38
|
+
def project_assignments
|
39
|
+
@project_assignments ||= api.get_paged('users/me/project_assignments')
|
40
|
+
end
|
34
41
|
end
|
35
42
|
end
|
36
43
|
end
|
@@ -74,18 +74,17 @@ module Abt
|
|
74
74
|
def user_id
|
75
75
|
return git.global['userId'] unless git.global['userId'].nil?
|
76
76
|
|
77
|
-
git.global['userId'] =
|
78
|
-
'Please provide your harvest User ID.',
|
79
|
-
'To find it open "My profile" inside the harvest web UI.',
|
80
|
-
'The ID is the number part of the URL for that page.',
|
81
|
-
'',
|
82
|
-
'Enter user id'
|
83
|
-
].join("\n"))
|
77
|
+
git.global['userId'] = api.get('users/me')['id'].to_s
|
84
78
|
end
|
85
79
|
|
86
80
|
private
|
87
81
|
|
88
82
|
attr_reader :git
|
83
|
+
|
84
|
+
def api
|
85
|
+
@api ||=
|
86
|
+
Abt::Providers::Harvest::Api.new(access_token: access_token, account_id: account_id)
|
87
|
+
end
|
89
88
|
end
|
90
89
|
end
|
91
90
|
end
|
data/lib/abt/version.rb
CHANGED