labclient 0.1.3 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/labclient.rb +19 -3
- data/lib/labclient/access_levels.rb +24 -30
- data/lib/labclient/client.rb +54 -7
- data/lib/labclient/commits/project_helpers.rb +4 -0
- data/lib/labclient/commits/show.rb +11 -2
- data/lib/labclient/common.rb +15 -6
- data/lib/labclient/docs.rb +9 -5
- data/lib/labclient/files/update.rb +1 -1
- data/lib/labclient/generator/generator.rb +7 -7
- data/lib/labclient/generator/template_helper.rb +0 -1
- data/lib/labclient/generator/wizard.rb +6 -2
- data/lib/labclient/groups/clusters/add.rb +46 -0
- data/lib/labclient/groups/clusters/client.rb +17 -0
- data/lib/labclient/groups/clusters/delete.rb +36 -0
- data/lib/labclient/groups/clusters/group_cluster.rb +37 -0
- data/lib/labclient/groups/clusters/list.rb +28 -0
- data/lib/labclient/groups/clusters/show.rb +29 -0
- data/lib/labclient/groups/clusters/update.rb +44 -0
- data/lib/labclient/groups/group.rb +14 -1
- data/lib/labclient/http.rb +1 -1
- data/lib/labclient/issues/issue.rb +17 -0
- data/lib/labclient/issues/update.rb +20 -2
- data/lib/labclient/jobs/delete.rb +1 -1
- data/lib/labclient/jobs/keep.rb +1 -1
- data/lib/labclient/jobs/play.rb +1 -1
- data/lib/labclient/jobs/trace.rb +2 -2
- data/lib/labclient/klass.rb +6 -6
- data/lib/labclient/lab_struct.rb +4 -0
- data/lib/labclient/members/member.rb +1 -0
- data/lib/labclient/notes/epics/create.rb +8 -0
- data/lib/labclient/notes/issues/create.rb +8 -0
- data/lib/labclient/notes/merge_requests/create.rb +8 -0
- data/lib/labclient/overview.rb +104 -12
- data/lib/labclient/paginated_response.rb +2 -0
- data/lib/labclient/projects/clusters/add.rb +1 -1
- data/lib/labclient/projects/clusters/delete.rb +5 -6
- data/lib/labclient/projects/clusters/show.rb +2 -2
- data/lib/labclient/projects/clusters/update.rb +13 -5
- data/lib/labclient/projects/environments/project_environment.rb +10 -0
- data/lib/labclient/projects/forks/fork.rb +0 -2
- data/lib/labclient/projects/methods.rb +23 -0
- data/lib/labclient/projects/reference.rb +7 -0
- data/lib/labclient/projects/stars/starrers.rb +0 -2
- data/lib/labclient/protected_branches/protect.rb +6 -5
- data/lib/labclient/protected_environments/list.rb +29 -0
- data/lib/labclient/protected_environments/protect.rb +53 -0
- data/lib/labclient/protected_environments/protected_environment.rb +22 -0
- data/lib/labclient/protected_environments/show.rb +24 -0
- data/lib/labclient/protected_environments/unprotect.rb +31 -0
- data/lib/labclient/users/membership.rb +62 -0
- data/lib/labclient/users/memberships.rb +8 -3
- data/lib/labclient/users/user.rb +1 -1
- data/lib/labclient/version.rb +1 -1
- metadata +19 -6
@@ -0,0 +1,22 @@
|
|
1
|
+
# Top namespace
|
2
|
+
module LabClient
|
3
|
+
# Inspect Helper
|
4
|
+
class ProtectedEnvironment < Klass
|
5
|
+
include ClassHelpers
|
6
|
+
def inspect
|
7
|
+
"#<ProtectedEnvironment name: #{name}>"
|
8
|
+
end
|
9
|
+
|
10
|
+
def unprotect
|
11
|
+
project_id = collect_project_id
|
12
|
+
|
13
|
+
client.protected_environments.unprotect(project_id, name)
|
14
|
+
end
|
15
|
+
|
16
|
+
help do
|
17
|
+
subtitle 'ProjectEnvironment'
|
18
|
+
option 'project', 'Show Project'
|
19
|
+
option 'unprotect', 'Remove protected environment'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# Top namespace
|
2
|
+
module LabClient
|
3
|
+
# Specifics
|
4
|
+
class ProtectedEnvironments < Common
|
5
|
+
doc 'Show' do
|
6
|
+
desc 'Gets a single protected environment [Project ID, ProtectedEnvironment]'
|
7
|
+
example 'client.protected_environments.show(36, :prod)'
|
8
|
+
result '#<ProtectedEnvironment name: prod>'
|
9
|
+
end
|
10
|
+
|
11
|
+
doc 'Show' do
|
12
|
+
desc 'via Project'
|
13
|
+
example <<~DOC
|
14
|
+
project = client.projects.show(264)
|
15
|
+
project.protected_environment(:master)
|
16
|
+
DOC
|
17
|
+
end
|
18
|
+
|
19
|
+
def show(project_id, environment_id)
|
20
|
+
project_id = format_id(project_id)
|
21
|
+
client.request(:get, "projects/#{project_id}/protected_environments/#{environment_id}", ProtectedEnvironment)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# Top namespace
|
2
|
+
module LabClient
|
3
|
+
# Specifics
|
4
|
+
class ProtectedEnvironments < Common
|
5
|
+
doc 'Unprotect' do
|
6
|
+
desc 'Unprotects the given protected environment [Project ID, ProtectedEnvironment]'
|
7
|
+
example 'client.protected_environments.unprotect(264, :prod)'
|
8
|
+
end
|
9
|
+
|
10
|
+
doc 'Unprotect' do
|
11
|
+
desc 'via Project'
|
12
|
+
example <<~DOC
|
13
|
+
project = client.projects.show(264)
|
14
|
+
project.unprotect_environment(:other)
|
15
|
+
DOC
|
16
|
+
end
|
17
|
+
|
18
|
+
doc 'Unprotect' do
|
19
|
+
desc 'via ProtectedEnvironment'
|
20
|
+
example <<~DOC
|
21
|
+
protected_env = client.protected_environments.show(36, :prod)
|
22
|
+
protected_env.unprotect
|
23
|
+
DOC
|
24
|
+
end
|
25
|
+
|
26
|
+
def unprotect(project_id, environment_id)
|
27
|
+
project_id = format_id(project_id)
|
28
|
+
client.request(:delete, "projects/#{project_id}/protected_environments/#{environment_id}")
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# Top namespace
|
2
|
+
module LabClient
|
3
|
+
# Inspect Helper
|
4
|
+
class Membership < Klass
|
5
|
+
include ClassHelpers
|
6
|
+
include AccessLevel
|
7
|
+
|
8
|
+
def inspect
|
9
|
+
"#<Membership name: #{source_name}, access: #{level}>"
|
10
|
+
end
|
11
|
+
|
12
|
+
def parent
|
13
|
+
case source_type
|
14
|
+
when 'Project'
|
15
|
+
client.projects.show(source_id)
|
16
|
+
when 'Namespace'
|
17
|
+
client.groups.show(source_id)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def level
|
22
|
+
human_access_level(access_level)
|
23
|
+
end
|
24
|
+
|
25
|
+
def guest?
|
26
|
+
level == :guest
|
27
|
+
end
|
28
|
+
|
29
|
+
def reporter?
|
30
|
+
level == :reporter
|
31
|
+
end
|
32
|
+
|
33
|
+
def developer?
|
34
|
+
level == :developer
|
35
|
+
end
|
36
|
+
|
37
|
+
def maintainer?
|
38
|
+
level == :maintainer
|
39
|
+
end
|
40
|
+
|
41
|
+
def owner?
|
42
|
+
level == :owner
|
43
|
+
end
|
44
|
+
|
45
|
+
def greater_than(leveler)
|
46
|
+
case leveler
|
47
|
+
when Symbol
|
48
|
+
access_level > machine_access_level(leveler)
|
49
|
+
when Integer
|
50
|
+
access_level > leveler
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
help do
|
55
|
+
subtitle 'Membership'
|
56
|
+
option 'level', 'Humanized symbol of access level. e.g. :developer'
|
57
|
+
option 'parent', 'Collect project/namespace for this membership'
|
58
|
+
option '<permission>?', 'True/False evaluation each guest?, developer? etc'
|
59
|
+
option 'greater_than', 'True/False if user has greater than [Permission Name]'
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -7,7 +7,9 @@ module LabClient
|
|
7
7
|
desc 'Lists all projects and groups a user is a member of. [User ID, Type]'
|
8
8
|
|
9
9
|
markdown <<~DOC
|
10
|
-
|
10
|
+
| Attribute | Type | Required | Description |
|
11
|
+
| --------- | ------ | -------- | -------------------------------------------------------------- |
|
12
|
+
| type | string | no | Filter memberships by type. Can be either Project or Namespace |
|
11
13
|
DOC
|
12
14
|
|
13
15
|
example 'client.users.memberships(1)'
|
@@ -26,9 +28,12 @@ module LabClient
|
|
26
28
|
DOC
|
27
29
|
end
|
28
30
|
|
29
|
-
def memberships(user_id, type =
|
31
|
+
def memberships(user_id, type = nil)
|
30
32
|
user_id = format_id(user_id)
|
31
|
-
|
33
|
+
|
34
|
+
query = nil
|
35
|
+
query = { type: type } if type
|
36
|
+
client.request(:get, "users/#{user_id}/memberships", Membership, query)
|
32
37
|
end
|
33
38
|
end
|
34
39
|
end
|
data/lib/labclient/users/user.rb
CHANGED
data/lib/labclient/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: labclient
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Davin Walker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -210,16 +210,16 @@ dependencies:
|
|
210
210
|
name: rubocop
|
211
211
|
requirement: !ruby/object:Gem::Requirement
|
212
212
|
requirements:
|
213
|
-
- - "
|
213
|
+
- - "<"
|
214
214
|
- !ruby/object:Gem::Version
|
215
|
-
version:
|
215
|
+
version: 0.91.0
|
216
216
|
type: :development
|
217
217
|
prerelease: false
|
218
218
|
version_requirements: !ruby/object:Gem::Requirement
|
219
219
|
requirements:
|
220
|
-
- - "
|
220
|
+
- - "<"
|
221
221
|
- !ruby/object:Gem::Version
|
222
|
-
version:
|
222
|
+
version: 0.91.0
|
223
223
|
- !ruby/object:Gem::Dependency
|
224
224
|
name: simplecov
|
225
225
|
requirement: !ruby/object:Gem::Requirement
|
@@ -423,6 +423,13 @@ files:
|
|
423
423
|
- lib/labclient/groups/badges/preview.rb
|
424
424
|
- lib/labclient/groups/badges/show.rb
|
425
425
|
- lib/labclient/groups/badges/update.rb
|
426
|
+
- lib/labclient/groups/clusters/add.rb
|
427
|
+
- lib/labclient/groups/clusters/client.rb
|
428
|
+
- lib/labclient/groups/clusters/delete.rb
|
429
|
+
- lib/labclient/groups/clusters/group_cluster.rb
|
430
|
+
- lib/labclient/groups/clusters/list.rb
|
431
|
+
- lib/labclient/groups/clusters/show.rb
|
432
|
+
- lib/labclient/groups/clusters/update.rb
|
426
433
|
- lib/labclient/groups/create.rb
|
427
434
|
- lib/labclient/groups/delete.rb
|
428
435
|
- lib/labclient/groups/group.rb
|
@@ -766,6 +773,11 @@ files:
|
|
766
773
|
- lib/labclient/protected_branches/protect.rb
|
767
774
|
- lib/labclient/protected_branches/show.rb
|
768
775
|
- lib/labclient/protected_branches/unprotect.rb
|
776
|
+
- lib/labclient/protected_environments/list.rb
|
777
|
+
- lib/labclient/protected_environments/protect.rb
|
778
|
+
- lib/labclient/protected_environments/protected_environment.rb
|
779
|
+
- lib/labclient/protected_environments/show.rb
|
780
|
+
- lib/labclient/protected_environments/unprotect.rb
|
769
781
|
- lib/labclient/protected_tags/list.rb
|
770
782
|
- lib/labclient/protected_tags/protect.rb
|
771
783
|
- lib/labclient/protected_tags/show.rb
|
@@ -860,6 +872,7 @@ files:
|
|
860
872
|
- lib/labclient/users/keys/list.rb
|
861
873
|
- lib/labclient/users/keys/show.rb
|
862
874
|
- lib/labclient/users/list.rb
|
875
|
+
- lib/labclient/users/membership.rb
|
863
876
|
- lib/labclient/users/memberships.rb
|
864
877
|
- lib/labclient/users/search.rb
|
865
878
|
- lib/labclient/users/show.rb
|