bl 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bl/category.rb +13 -4
- data/lib/bl/cli.rb +0 -63
- data/lib/bl/command.rb +162 -0
- data/lib/bl/file.rb +12 -6
- data/lib/bl/formatting.rb +0 -23
- data/lib/bl/gitrepo.rb +9 -15
- data/lib/bl/groups.rb +1 -1
- data/lib/bl/milestone.rb +14 -12
- data/lib/bl/project.rb +3 -12
- data/lib/bl/space.rb +2 -1
- data/lib/bl/type.rb +13 -17
- data/lib/bl/users.rb +12 -21
- data/lib/bl/version.rb +1 -1
- data/lib/bl/watchings.rb +0 -9
- data/lib/bl/webhooks.rb +11 -13
- data/lib/bl/wiki.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 55f1e902cbc7a85e120ad076f71f125c5228eb4b
|
4
|
+
data.tar.gz: 1e65288f69871539a379a1b8edf6bd92f99def0b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a564cf036ac05442c1f882b949ae14f7760e7ddf7891b892233c9f2534ff7a5264c10dba12ec4daaeefe6673abf2b7b4ee808df4e0f8382b2618ce80c6b3aa5b
|
7
|
+
data.tar.gz: d506a364760865d6c0d3388fac93c34c8ee1bc0e5da0c97b31af9d2db9716d67c039c557f7ffbd6795a6b41bf5577aa8afda9f894f0425c159ddef8b7318667f
|
data/lib/bl/category.rb
CHANGED
@@ -10,14 +10,15 @@ module Bl
|
|
10
10
|
desc 'list', 'list categories'
|
11
11
|
def list
|
12
12
|
res = client.get(@url)
|
13
|
-
|
13
|
+
print_response(res)
|
14
14
|
end
|
15
15
|
|
16
16
|
desc 'add [NAME...]', 'add categories'
|
17
17
|
def add(*names)
|
18
18
|
names.each do |name|
|
19
19
|
res = client.post(@url, name: name)
|
20
|
-
puts
|
20
|
+
puts 'category added'
|
21
|
+
print_response(res)
|
21
22
|
end
|
22
23
|
end
|
23
24
|
|
@@ -26,7 +27,8 @@ module Bl
|
|
26
27
|
def update(*ids)
|
27
28
|
ids.each do |id|
|
28
29
|
res = client.patch("#{@url}/#{id}", delete_class_options(options))
|
29
|
-
puts
|
30
|
+
puts 'category updated'
|
31
|
+
print_response(res)
|
30
32
|
end
|
31
33
|
end
|
32
34
|
|
@@ -34,8 +36,15 @@ module Bl
|
|
34
36
|
def delete(*ids)
|
35
37
|
ids.each do |id|
|
36
38
|
res = client.delete("#{@url}/#{id}")
|
37
|
-
puts
|
39
|
+
puts 'category deleted'
|
40
|
+
print_response(res)
|
38
41
|
end
|
39
42
|
end
|
43
|
+
|
44
|
+
private
|
45
|
+
|
46
|
+
def print_response(res)
|
47
|
+
puts formatter.render(res.body, fields: CATEGORY_FIELDS)
|
48
|
+
end
|
40
49
|
end
|
41
50
|
end
|
data/lib/bl/cli.rb
CHANGED
@@ -2,69 +2,6 @@ module Bl
|
|
2
2
|
|
3
3
|
class CLI < Command
|
4
4
|
|
5
|
-
ISSUES_PARAMS = {
|
6
|
-
projectId: :array,
|
7
|
-
issueTypeId: :array,
|
8
|
-
categoryId: :array,
|
9
|
-
versionId: :array,
|
10
|
-
milestoneId: :array,
|
11
|
-
statusId: :array,
|
12
|
-
priorityId: :array,
|
13
|
-
assigneeId: :array,
|
14
|
-
createdUserId: :array,
|
15
|
-
resolutionId: :array,
|
16
|
-
parentChild: :numeric,
|
17
|
-
attachment: :boolean,
|
18
|
-
sharedFile: :boolean,
|
19
|
-
sort: :string,
|
20
|
-
order: :string,
|
21
|
-
offset: :numeric,
|
22
|
-
count: :numeric,
|
23
|
-
createdSince: :string,
|
24
|
-
createUntil: :string,
|
25
|
-
updatedSince: :string,
|
26
|
-
updatedUntil: :string,
|
27
|
-
startDateSince: :string,
|
28
|
-
startDateUntil: :string,
|
29
|
-
dueDateSince: :string,
|
30
|
-
dueDateUntil: :string,
|
31
|
-
id: :array,
|
32
|
-
parentIssueId: :array,
|
33
|
-
keyword: :string
|
34
|
-
}
|
35
|
-
|
36
|
-
ISSUE_BASE_ATTRIBUTES = {
|
37
|
-
summary: :string,
|
38
|
-
description: :string,
|
39
|
-
statusId: :numeric,
|
40
|
-
resolutionId: :numeric,
|
41
|
-
dueDate: :string,
|
42
|
-
issueTypeId: :numeric,
|
43
|
-
categoryId: :array,
|
44
|
-
versionId: :array,
|
45
|
-
milestoneId: :array,
|
46
|
-
priorityId: :numeric,
|
47
|
-
assigneeId: :numeric
|
48
|
-
}
|
49
|
-
|
50
|
-
ISSUE_FIELDS = %i(
|
51
|
-
issueKey
|
52
|
-
summary
|
53
|
-
startDate
|
54
|
-
dueDate
|
55
|
-
created
|
56
|
-
updated
|
57
|
-
)
|
58
|
-
|
59
|
-
ROLES = [
|
60
|
-
{id: 1, name: 'Administrator'},
|
61
|
-
{id: 2, name: 'Normal User'},
|
62
|
-
{id: 3, name: 'Reporter'},
|
63
|
-
{id: 4, name: 'Viewer'},
|
64
|
-
{id: 5, name: 'Guest Reporter'},
|
65
|
-
{id: 6, name: 'Guest Viewer'}
|
66
|
-
]
|
67
|
-
|
68
5
|
def initialize(*)
|
69
6
|
@config = Bl::Config.instance
|
70
7
|
super
|
data/lib/bl/command.rb
CHANGED
@@ -4,7 +4,169 @@ module Bl
|
|
4
4
|
include Bl::Formatting
|
5
5
|
class_option :format, type: :string, default: 'table', desc: 'set output format'
|
6
6
|
|
7
|
+
ACTIVITY_TYPES = {
|
8
|
+
1 => 'Issue Created',
|
9
|
+
2 => 'Issue Updated',
|
10
|
+
3 => 'Issue Commented',
|
11
|
+
4 => 'Issue Deleted',
|
12
|
+
5 => 'Wiki Created',
|
13
|
+
6 => 'Wiki Updated',
|
14
|
+
7 => 'Wiki Deleted',
|
15
|
+
8 => 'File Added',
|
16
|
+
9 => 'File Updated',
|
17
|
+
10 => 'File Deleted',
|
18
|
+
11 => 'SVN Committed',
|
19
|
+
12 => 'Git Pushed',
|
20
|
+
13 => 'Git Repository Created',
|
21
|
+
14 => 'Issue Multi Updated',
|
22
|
+
15 => 'Project User Added',
|
23
|
+
16 => 'Project User Deleted',
|
24
|
+
17 => 'Comment Notification Added',
|
25
|
+
18 => 'Pull Request Added',
|
26
|
+
19 => 'Pull Request Updated',
|
27
|
+
20 => 'Comment Added on Pull Request'
|
28
|
+
}
|
29
|
+
CATEGORY_FIELDS = %i(id name displayOrder)
|
30
|
+
FILE_FIELDS = %i(id type dir name size created updated)
|
31
|
+
GIT_REPO_FIELDS = %i(
|
32
|
+
id
|
33
|
+
projectId
|
34
|
+
name
|
35
|
+
sshUrl
|
36
|
+
pushedAt
|
37
|
+
created
|
38
|
+
updated
|
39
|
+
)
|
40
|
+
ISSUE_BASE_ATTRIBUTES = {
|
41
|
+
summary: :string,
|
42
|
+
description: :string,
|
43
|
+
statusId: :numeric,
|
44
|
+
resolutionId: :numeric,
|
45
|
+
dueDate: :string,
|
46
|
+
issueTypeId: :numeric,
|
47
|
+
categoryId: :array,
|
48
|
+
versionId: :array,
|
49
|
+
milestoneId: :array,
|
50
|
+
priorityId: :numeric,
|
51
|
+
assigneeId: :numeric
|
52
|
+
}
|
53
|
+
ISSUE_FIELDS = %i(
|
54
|
+
issueKey
|
55
|
+
summary
|
56
|
+
startDate
|
57
|
+
dueDate
|
58
|
+
created
|
59
|
+
updated
|
60
|
+
)
|
61
|
+
ISSUES_PARAMS = {
|
62
|
+
projectId: :array,
|
63
|
+
issueTypeId: :array,
|
64
|
+
categoryId: :array,
|
65
|
+
versionId: :array,
|
66
|
+
milestoneId: :array,
|
67
|
+
statusId: :array,
|
68
|
+
priorityId: :array,
|
69
|
+
assigneeId: :array,
|
70
|
+
createdUserId: :array,
|
71
|
+
resolutionId: :array,
|
72
|
+
parentChild: :numeric,
|
73
|
+
attachment: :boolean,
|
74
|
+
sharedFile: :boolean,
|
75
|
+
sort: :string,
|
76
|
+
order: :string,
|
77
|
+
offset: :numeric,
|
78
|
+
count: :numeric,
|
79
|
+
createdSince: :string,
|
80
|
+
createUntil: :string,
|
81
|
+
updatedSince: :string,
|
82
|
+
updatedUntil: :string,
|
83
|
+
startDateSince: :string,
|
84
|
+
startDateUntil: :string,
|
85
|
+
dueDateSince: :string,
|
86
|
+
dueDateUntil: :string,
|
87
|
+
id: :array,
|
88
|
+
parentIssueId: :array,
|
89
|
+
keyword: :string
|
90
|
+
}
|
91
|
+
MILESTONE_FIELDS = %i(id projectId name description startDate releaseDueDate archived)
|
92
|
+
MILESTONE_PARAMS = {
|
93
|
+
description: :string,
|
94
|
+
startDate: :string,
|
95
|
+
releaseDueDate: :string
|
96
|
+
}
|
97
|
+
PROJECT_FIELDS = %i(
|
98
|
+
id
|
99
|
+
projectKey
|
100
|
+
name
|
101
|
+
chartEnabled
|
102
|
+
subtaskingEnabled
|
103
|
+
projectLeaderCanEditProjectLeader
|
104
|
+
textFormattingRule
|
105
|
+
archived
|
106
|
+
)
|
107
|
+
ROLES = [
|
108
|
+
{id: 1, name: 'Administrator'},
|
109
|
+
{id: 2, name: 'Normal User'},
|
110
|
+
{id: 3, name: 'Reporter'},
|
111
|
+
{id: 4, name: 'Viewer'},
|
112
|
+
{id: 5, name: 'Guest Reporter'},
|
113
|
+
{id: 6, name: 'Guest Viewer'}
|
114
|
+
]
|
115
|
+
SPACE_FIELDS = %i(
|
116
|
+
spaceKey
|
117
|
+
name
|
118
|
+
ownerId
|
119
|
+
lang
|
120
|
+
timezone
|
121
|
+
reportSendTime
|
122
|
+
textFormattingRule
|
123
|
+
created
|
124
|
+
updated
|
125
|
+
)
|
7
126
|
TPUT_COLS = `tput cols`.to_i
|
127
|
+
TYPE_COLORS = %w(
|
128
|
+
#e30000
|
129
|
+
#934981
|
130
|
+
#814fbc
|
131
|
+
#007e9a
|
132
|
+
#ff3265
|
133
|
+
#666665
|
134
|
+
#990000
|
135
|
+
#2779ca
|
136
|
+
#7ea800
|
137
|
+
#ff9200
|
138
|
+
)
|
139
|
+
USER_FIELDS = %i(
|
140
|
+
id
|
141
|
+
userId
|
142
|
+
name
|
143
|
+
roleType
|
144
|
+
lang
|
145
|
+
mailAddress
|
146
|
+
)
|
147
|
+
USER_PARAMS = {
|
148
|
+
password: :string,
|
149
|
+
name: :string,
|
150
|
+
mailAddress: :string,
|
151
|
+
roleType: :numeric
|
152
|
+
}
|
153
|
+
WATCHINGS_PARAMS = {
|
154
|
+
order: :string,
|
155
|
+
sort: :string,
|
156
|
+
count: :numeric,
|
157
|
+
offset: :numeric,
|
158
|
+
resourceAlreadyRead: :boolean,
|
159
|
+
issueId: :array
|
160
|
+
}
|
161
|
+
WEBHOOK_FIELDS = %i(id name description created updated)
|
162
|
+
WEBHOOK_PARAMS = {
|
163
|
+
name: :string,
|
164
|
+
description: :string,
|
165
|
+
hookUrl: :string,
|
166
|
+
allEvent: :boolean,
|
167
|
+
activityTypeIds: :array
|
168
|
+
}
|
169
|
+
WIKI_FIELDS = %i(id projectId name created updated)
|
8
170
|
|
9
171
|
protected
|
10
172
|
|
data/lib/bl/file.rb
CHANGED
@@ -1,26 +1,32 @@
|
|
1
1
|
module Bl
|
2
2
|
class File < Command
|
3
|
-
|
4
3
|
def initialize(*)
|
5
4
|
@config = Bl::Config.instance
|
5
|
+
@url = "projects/#{@config[:project_key]}"
|
6
6
|
super
|
7
7
|
end
|
8
8
|
|
9
9
|
desc 'list PATH', 'list files on PATH'
|
10
|
-
def list(path='')
|
11
|
-
res = client.get("
|
12
|
-
|
10
|
+
def list(path = '')
|
11
|
+
res = client.get("#{@url}/files/metadata/#{path}")
|
12
|
+
print_response(res)
|
13
13
|
end
|
14
14
|
|
15
15
|
desc 'get [ID...]', 'get files'
|
16
16
|
def get(*ids)
|
17
17
|
ids.each do |id|
|
18
|
-
res = client.get("
|
19
|
-
f = ::File.new(res.body.filename,
|
18
|
+
res = client.get("#{@url}/files/#{id}")
|
19
|
+
f = ::File.new(res.body.filename, 'w')
|
20
20
|
f.write(res.body.content)
|
21
21
|
f.close
|
22
22
|
puts "file #{id} #{res.body.filename} downloaded."
|
23
23
|
end
|
24
24
|
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def print_response(res)
|
29
|
+
puts formatter.render(res.body, fields: FILE_FIELDS)
|
30
|
+
end
|
25
31
|
end
|
26
32
|
end
|
data/lib/bl/formatting.rb
CHANGED
@@ -2,29 +2,6 @@ module Bl
|
|
2
2
|
module Formatting
|
3
3
|
module_function
|
4
4
|
|
5
|
-
ACTIVITY_TYPES = {
|
6
|
-
1 => 'Issue Created',
|
7
|
-
2 => 'Issue Updated',
|
8
|
-
3 => 'Issue Commented',
|
9
|
-
4 => 'Issue Deleted',
|
10
|
-
5 => 'Wiki Created',
|
11
|
-
6 => 'Wiki Updated',
|
12
|
-
7 => 'Wiki Deleted',
|
13
|
-
8 => 'File Added',
|
14
|
-
9 => 'File Updated',
|
15
|
-
10 => 'File Deleted',
|
16
|
-
11 => 'SVN Committed',
|
17
|
-
12 => 'Git Pushed',
|
18
|
-
13 => 'Git Repository Created',
|
19
|
-
14 => 'Issue Multi Updated',
|
20
|
-
15 => 'Project User Added',
|
21
|
-
16 => 'Project User Deleted',
|
22
|
-
17 => 'Comment Notification Added',
|
23
|
-
18 => 'Pull Request Added',
|
24
|
-
19 => 'Pull Request Updated',
|
25
|
-
20 => 'Comment Added on Pull Request'
|
26
|
-
}
|
27
|
-
|
28
5
|
def colorize_type(name, color)
|
29
6
|
Paint[name, :white, color]
|
30
7
|
end
|
data/lib/bl/gitrepo.rb
CHANGED
@@ -10,25 +10,19 @@ module Bl
|
|
10
10
|
desc 'list', 'list git repositories'
|
11
11
|
def list
|
12
12
|
res = client.get(@url)
|
13
|
-
|
13
|
+
print_response(res)
|
14
14
|
end
|
15
15
|
|
16
16
|
desc 'show ID', 'show a git repository'
|
17
17
|
def show(id)
|
18
|
-
|
19
|
-
puts
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
puts
|
26
|
-
puts "displayOrder: #{body.displayOrder}"
|
27
|
-
puts "pushedAt: #{body.pushedAt}"
|
28
|
-
puts "createdUser: #{body.createdUser.name}"
|
29
|
-
puts "created: #{body.created}"
|
30
|
-
puts "updatedUser: #{body.updatedUser.name}"
|
31
|
-
puts "updated: #{body.updated}"
|
18
|
+
res = client.get("#{@url}/#{id}")
|
19
|
+
puts formatter.render(res.body, fields: GIT_REPO_FIELDS, vertical: true)
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def print_response(res)
|
25
|
+
puts formatter.render(res.body, fields: GIT_REPO_FIELDS)
|
32
26
|
end
|
33
27
|
end
|
34
28
|
end
|
data/lib/bl/groups.rb
CHANGED
@@ -17,7 +17,7 @@ module Bl
|
|
17
17
|
desc 'show GROUP_ID', ''
|
18
18
|
def show(id)
|
19
19
|
res = client.get("#{@url}/#{id}")
|
20
|
-
puts formatter.render(res.body.members, fields:
|
20
|
+
puts formatter.render(res.body.members, fields: USER_FIELDS)
|
21
21
|
end
|
22
22
|
|
23
23
|
desc 'add GROUP_NAME', ''
|
data/lib/bl/milestone.rb
CHANGED
@@ -1,12 +1,6 @@
|
|
1
1
|
module Bl
|
2
2
|
class Milestone < Command
|
3
3
|
|
4
|
-
MILESTONE_PARAMS = {
|
5
|
-
description: :string,
|
6
|
-
startDate: :string,
|
7
|
-
releaseDueDate: :string
|
8
|
-
}
|
9
|
-
|
10
4
|
def initialize(*)
|
11
5
|
@config = Bl::Config.instance
|
12
6
|
@url = "projects/#{@config[:project_key]}/versions"
|
@@ -18,11 +12,10 @@ module Bl
|
|
18
12
|
def list
|
19
13
|
res = client.get(@url)
|
20
14
|
if options[:all]
|
21
|
-
body = res.body
|
22
15
|
else
|
23
|
-
|
16
|
+
res.body.select! { |m| m.archived == false } unless options[:all]
|
24
17
|
end
|
25
|
-
|
18
|
+
print_response(res)
|
26
19
|
end
|
27
20
|
|
28
21
|
desc 'add [NAME...]', 'add milestones'
|
@@ -36,7 +29,8 @@ module Bl
|
|
36
29
|
startDate: options[:startDate],
|
37
30
|
releaseDueDate: options[:releaseDueDate]
|
38
31
|
)
|
39
|
-
puts
|
32
|
+
puts 'milestone added'
|
33
|
+
print_response(res)
|
40
34
|
end
|
41
35
|
end
|
42
36
|
|
@@ -46,7 +40,8 @@ module Bl
|
|
46
40
|
def update(*ids)
|
47
41
|
ids.each do |id|
|
48
42
|
res = client.patch("#{@url}/#{id}", delete_class_options(options))
|
49
|
-
puts
|
43
|
+
puts 'milestone updated'
|
44
|
+
print_response(res)
|
50
45
|
end
|
51
46
|
end
|
52
47
|
|
@@ -54,8 +49,15 @@ module Bl
|
|
54
49
|
def delete(*ids)
|
55
50
|
ids.each do |id|
|
56
51
|
res = client.delete("#{@url}/#{id}")
|
57
|
-
puts
|
52
|
+
puts 'milestone deleted'
|
53
|
+
print_response(res)
|
58
54
|
end
|
59
55
|
end
|
56
|
+
|
57
|
+
private
|
58
|
+
|
59
|
+
def print_response(res)
|
60
|
+
puts formatter.render(res.body, fields: MILESTONE_FIELDS)
|
61
|
+
end
|
60
62
|
end
|
61
63
|
end
|
data/lib/bl/project.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
module Bl
|
2
2
|
class Project < Command
|
3
|
-
|
4
3
|
def initialize(*)
|
5
4
|
@config = Bl::Config.instance
|
6
5
|
@url = 'projects'
|
@@ -10,7 +9,7 @@ module Bl
|
|
10
9
|
desc 'list', 'list projects'
|
11
10
|
def list
|
12
11
|
res = client.get(@url)
|
13
|
-
puts formatter.render(res.body, fields:
|
12
|
+
puts formatter.render(res.body, fields: PROJECT_FIELDS)
|
14
13
|
end
|
15
14
|
|
16
15
|
desc 'status ID', 'show project status'
|
@@ -51,16 +50,8 @@ module Bl
|
|
51
50
|
|
52
51
|
desc 'users ID', 'show project users'
|
53
52
|
def users(id)
|
54
|
-
client.get("#{@url}/#{id}/users")
|
55
|
-
|
56
|
-
u.id,
|
57
|
-
u.userId,
|
58
|
-
u.name,
|
59
|
-
u.roleType,
|
60
|
-
u.lang,
|
61
|
-
u.mailAddress
|
62
|
-
].join("\t")
|
63
|
-
end
|
53
|
+
res = client.get("#{@url}/#{id}/users")
|
54
|
+
puts formatter.render(res.body, fields: USER_FIELDS)
|
64
55
|
end
|
65
56
|
|
66
57
|
private
|
data/lib/bl/space.rb
CHANGED
data/lib/bl/type.rb
CHANGED
@@ -1,19 +1,6 @@
|
|
1
1
|
module Bl
|
2
2
|
class Type < Command
|
3
3
|
|
4
|
-
TYPE_COLORS = %w(
|
5
|
-
#e30000
|
6
|
-
#934981
|
7
|
-
#814fbc
|
8
|
-
#007e9a
|
9
|
-
#ff3265
|
10
|
-
#666665
|
11
|
-
#990000
|
12
|
-
#2779ca
|
13
|
-
#7ea800
|
14
|
-
#ff9200
|
15
|
-
)
|
16
|
-
|
17
4
|
def initialize(*)
|
18
5
|
@config = Bl::Config.instance
|
19
6
|
@url = "projects/#{@config[:project_key]}/issueTypes"
|
@@ -23,7 +10,7 @@ module Bl
|
|
23
10
|
desc 'list', 'list issue types'
|
24
11
|
def list
|
25
12
|
res = client.get(@url)
|
26
|
-
|
13
|
+
print_response(res)
|
27
14
|
end
|
28
15
|
|
29
16
|
desc 'add [NAME...]', 'add types'
|
@@ -31,7 +18,8 @@ module Bl
|
|
31
18
|
def add(*names)
|
32
19
|
names.each do |name|
|
33
20
|
res = client.post(@url, name: name, color: options[:color])
|
34
|
-
puts
|
21
|
+
puts 'type added'
|
22
|
+
print_response(res)
|
35
23
|
end
|
36
24
|
end
|
37
25
|
|
@@ -41,7 +29,8 @@ module Bl
|
|
41
29
|
def update(*ids)
|
42
30
|
ids.each do |id|
|
43
31
|
res = client.patch("#{@url}/#{id}", options)
|
44
|
-
puts
|
32
|
+
puts 'type updated'
|
33
|
+
print_response(res)
|
45
34
|
end
|
46
35
|
end
|
47
36
|
|
@@ -50,7 +39,8 @@ module Bl
|
|
50
39
|
def delete(*ids)
|
51
40
|
ids.each do |id|
|
52
41
|
res = client.delete("#{@url}/#{id}", options)
|
53
|
-
puts
|
42
|
+
puts 'type deleted'
|
43
|
+
print_response
|
54
44
|
end
|
55
45
|
end
|
56
46
|
|
@@ -60,5 +50,11 @@ module Bl
|
|
60
50
|
puts Paint[color, '#ffffff', color]
|
61
51
|
end
|
62
52
|
end
|
53
|
+
|
54
|
+
private
|
55
|
+
|
56
|
+
def print_response(res)
|
57
|
+
puts formatter.render(res.body, fields: %i(id name color))
|
58
|
+
end
|
63
59
|
end
|
64
60
|
end
|
data/lib/bl/users.rb
CHANGED
@@ -1,22 +1,6 @@
|
|
1
1
|
module Bl
|
2
2
|
class Users < Command
|
3
3
|
|
4
|
-
USER_FIELDS = %i(
|
5
|
-
id
|
6
|
-
userId
|
7
|
-
name
|
8
|
-
roleType
|
9
|
-
lang
|
10
|
-
mailAddress
|
11
|
-
)
|
12
|
-
|
13
|
-
USER_PARAMS = {
|
14
|
-
password: :string,
|
15
|
-
name: :string,
|
16
|
-
mailAddress: :string,
|
17
|
-
roleType: :numeric
|
18
|
-
}
|
19
|
-
|
20
4
|
def initialize(*)
|
21
5
|
@config = Bl::Config.instance
|
22
6
|
@url = 'users'
|
@@ -26,7 +10,7 @@ module Bl
|
|
26
10
|
desc 'list', 'list users'
|
27
11
|
def list
|
28
12
|
res = client.get('users')
|
29
|
-
|
13
|
+
print_response(res)
|
30
14
|
end
|
31
15
|
|
32
16
|
desc 'show USER_ID', ''
|
@@ -38,7 +22,8 @@ module Bl
|
|
38
22
|
desc 'add USER_ID PASSWORD NAME MAIL_ADDRESS ROLE_TYPE', ''
|
39
23
|
def add(id, pass, name, mail_address, role_type)
|
40
24
|
res = client.post("#{@url}", userId: id, password: pass, name: name, mailAddress: mail_address, roleType: role_type)
|
41
|
-
puts
|
25
|
+
puts 'user added'
|
26
|
+
print_response(res)
|
42
27
|
end
|
43
28
|
|
44
29
|
desc 'update USER_ID', ''
|
@@ -46,20 +31,20 @@ module Bl
|
|
46
31
|
def update(id)
|
47
32
|
res = client.patch("#{@url}/#{id}", delete_class_options(options.to_h))
|
48
33
|
puts 'user updated:'
|
49
|
-
|
34
|
+
print_response(res)
|
50
35
|
end
|
51
36
|
|
52
37
|
desc 'delete', ''
|
53
38
|
def delete(id)
|
54
39
|
res = client.delete("#{@url}/#{id}")
|
55
40
|
puts 'user deleted'
|
56
|
-
|
41
|
+
print_response(res)
|
57
42
|
end
|
58
43
|
|
59
44
|
desc 'myself', ''
|
60
45
|
def myself
|
61
46
|
res = client.get("#{@url}/myself")
|
62
|
-
|
47
|
+
print_response(res)
|
63
48
|
end
|
64
49
|
|
65
50
|
desc 'icon ID', ''
|
@@ -91,5 +76,11 @@ module Bl
|
|
91
76
|
p client.get("/users/#{user_id}/stars/count", options.to_h).body.count
|
92
77
|
end
|
93
78
|
end
|
79
|
+
|
80
|
+
private
|
81
|
+
|
82
|
+
def print_response(res)
|
83
|
+
formatter.render(res.body, fields: USER_FIELDS)
|
84
|
+
end
|
94
85
|
end
|
95
86
|
end
|
data/lib/bl/version.rb
CHANGED
data/lib/bl/watchings.rb
CHANGED
@@ -1,15 +1,6 @@
|
|
1
1
|
module Bl
|
2
2
|
class Watchings < Command
|
3
3
|
|
4
|
-
WATCHINGS_PARAMS = {
|
5
|
-
order: :string,
|
6
|
-
sort: :string,
|
7
|
-
count: :numeric,
|
8
|
-
offset: :numeric,
|
9
|
-
resourceAlreadyRead: :boolean,
|
10
|
-
issueId: :array
|
11
|
-
}
|
12
|
-
|
13
4
|
def initialize(*)
|
14
5
|
@config = Bl::Config.instance
|
15
6
|
@url = 'watchings'
|
data/lib/bl/webhooks.rb
CHANGED
@@ -1,14 +1,6 @@
|
|
1
1
|
module Bl
|
2
2
|
class Webhooks < Command
|
3
3
|
|
4
|
-
WEBHOOK_PARAMS = {
|
5
|
-
name: :string,
|
6
|
-
description: :string,
|
7
|
-
hookUrl: :string,
|
8
|
-
allEvent: :boolean,
|
9
|
-
activityTypeIds: :array
|
10
|
-
}
|
11
|
-
|
12
4
|
def initialize(*)
|
13
5
|
@config = Bl::Config.instance
|
14
6
|
@url = "projects/#{@config[:project_key]}/webhooks"
|
@@ -18,13 +10,13 @@ module Bl
|
|
18
10
|
desc 'list', ''
|
19
11
|
def list
|
20
12
|
res = client.get(@url)
|
21
|
-
|
13
|
+
print_response(res)
|
22
14
|
end
|
23
15
|
|
24
16
|
desc 'show WEBHOOK_ID', ''
|
25
17
|
def show(id)
|
26
18
|
res = client.get("#{@url}/#{id}")
|
27
|
-
|
19
|
+
print_response(res)
|
28
20
|
end
|
29
21
|
|
30
22
|
desc 'add', ''
|
@@ -32,7 +24,7 @@ module Bl
|
|
32
24
|
def add
|
33
25
|
res = client.post(@url, options.to_h)
|
34
26
|
puts 'webhook added'
|
35
|
-
|
27
|
+
print_response(res)
|
36
28
|
end
|
37
29
|
|
38
30
|
desc 'update WEBHOOK_ID', ''
|
@@ -40,14 +32,20 @@ module Bl
|
|
40
32
|
def update(id)
|
41
33
|
res = client.patch("#{@url}/#{id}", options.to_h)
|
42
34
|
puts 'webhook updated'
|
43
|
-
|
35
|
+
print_response(res)
|
44
36
|
end
|
45
37
|
|
46
38
|
desc 'delete WEBHOOK_ID', ''
|
47
39
|
def delete(id)
|
48
40
|
res = client.delete("#{@url}/#{id}")
|
49
41
|
puts 'webhook deleted'
|
50
|
-
|
42
|
+
print_response(res)
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
def print_response(res)
|
48
|
+
puts formatter.render(res.body, fields: WEBHOOK_FIELDS)
|
51
49
|
end
|
52
50
|
end
|
53
51
|
end
|
data/lib/bl/wiki.rb
CHANGED
@@ -10,7 +10,7 @@ module Bl
|
|
10
10
|
desc 'list', 'list wikis'
|
11
11
|
def list
|
12
12
|
res = client.get(@url, projectIdOrKey: @config[:project_key])
|
13
|
-
puts formatter.render(res.body, fields:
|
13
|
+
puts formatter.render(res.body, fields: WIKI_FIELDS)
|
14
14
|
end
|
15
15
|
|
16
16
|
desc 'show ID', "show a wiki's content"
|