labclient 0.1.2 → 0.2.1
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/labclient.rb +16 -6
- data/lib/labclient/access_levels.rb +24 -30
- data/lib/labclient/branches/branch.rb +25 -0
- data/lib/labclient/branches/create.rb +33 -0
- data/lib/labclient/client.rb +47 -7
- data/lib/labclient/commits/project_helpers.rb +4 -0
- data/lib/labclient/commits/show.rb +11 -2
- data/lib/labclient/docs.rb +9 -5
- data/lib/labclient/epics/epic.rb +13 -0
- data/lib/labclient/error.rb +1 -0
- data/lib/labclient/files/create.rb +14 -8
- data/lib/labclient/files/update.rb +1 -1
- data/lib/labclient/generator/generator.rb +9 -21
- data/lib/labclient/generator/names.rb +17 -3
- data/lib/labclient/generator/template_helper.rb +81 -0
- data/lib/labclient/generator/templates/environments.rb +98 -0
- data/lib/labclient/generator/templates/pages.rb +24 -30
- data/lib/labclient/generator/templates/pipeline_trigger.rb +82 -0
- data/lib/labclient/generator/wizard.rb +29 -9
- data/lib/labclient/groups/group.rb +1 -1
- data/lib/labclient/http.rb +3 -2
- data/lib/labclient/issues/issue.rb +23 -1
- 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 -3
- data/lib/labclient/lab_struct.rb +21 -0
- data/lib/labclient/license/list.rb +2 -2
- data/lib/labclient/members/member.rb +1 -0
- data/lib/labclient/merge_requests/accept.rb +15 -6
- data/lib/labclient/merge_requests/create.rb +12 -0
- data/lib/labclient/merge_requests/merge_request.rb +49 -4
- data/lib/labclient/notes/epics/create.rb +12 -4
- data/lib/labclient/notes/epics/delete.rb +3 -3
- data/lib/labclient/notes/epics/list.rb +21 -4
- data/lib/labclient/notes/epics/show.rb +4 -4
- data/lib/labclient/notes/epics/update.rb +4 -4
- data/lib/labclient/notes/issues/create.rb +11 -1
- data/lib/labclient/notes/issues/list.rb +18 -3
- data/lib/labclient/notes/issues/show.rb +1 -1
- data/lib/labclient/notes/merge_requests/create.rb +8 -0
- data/lib/labclient/notes/merge_requests/list.rb +20 -2
- data/lib/labclient/notes/snippets/create.rb +1 -1
- data/lib/labclient/notes/snippets/list.rb +20 -3
- data/lib/labclient/notes/snippets/show.rb +1 -1
- data/lib/labclient/notifications/update.rb +1 -1
- data/lib/labclient/overview.rb +79 -11
- data/lib/labclient/paginated_response.rb +3 -1
- data/lib/labclient/pipelines/pipeline.rb +41 -0
- data/lib/labclient/projects/environments/project_environment.rb +10 -0
- data/lib/labclient/projects/methods.rb +49 -2
- data/lib/labclient/projects/reference.rb +12 -0
- data/lib/labclient/projects/snippets/project_snippet.rb +12 -0
- 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/snippets/snippet.rb +2 -2
- data/lib/labclient/users/membership.rb +62 -0
- data/lib/labclient/users/memberships.rb +8 -3
- data/lib/labclient/users/user.rb +7 -1
- data/lib/labclient/version.rb +1 -1
- metadata +16 -7
- data/lib/labclient/generator/templates/template.rb +0 -23
- data/lib/labclient/open_struct.rb +0 -14
@@ -32,8 +32,8 @@ module LabClient
|
|
32
32
|
subtitle 'Snippet'
|
33
33
|
option 'raw', 'Retrieves the raw snippet content.'
|
34
34
|
option 'agent_detail', 'Hash of user agent details.'
|
35
|
-
option 'delete', 'Delete this
|
36
|
-
option 'update', 'Update this this
|
35
|
+
option 'delete', 'Delete this snippet.'
|
36
|
+
option 'update', 'Update this this snippet.'
|
37
37
|
end
|
38
38
|
end
|
39
39
|
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
@@ -101,10 +101,15 @@ module LabClient
|
|
101
101
|
client.impersonation_tokens.show(id, token_id)
|
102
102
|
end
|
103
103
|
|
104
|
-
def memberships(type =
|
104
|
+
def memberships(type = nil)
|
105
105
|
client.users.memberships(id, type)
|
106
106
|
end
|
107
107
|
|
108
|
+
# Events
|
109
|
+
def events(query = {})
|
110
|
+
client.events.user(id, query)
|
111
|
+
end
|
112
|
+
|
108
113
|
# Reload Helper
|
109
114
|
def reload
|
110
115
|
update_self client.users.show(id)
|
@@ -133,6 +138,7 @@ module LabClient
|
|
133
138
|
option 'emails', 'List user emails'
|
134
139
|
option 'email_create', 'Create email for user [Email Address]'
|
135
140
|
option 'email_delete', 'Delete email for user [Email ID]'
|
141
|
+
option 'events', 'List user events [Hash]'
|
136
142
|
option 'impersonation_tokens', 'List impersonation tokesn for user [Filter(Optional)]'
|
137
143
|
option 'impersonation_token_create', 'Create impersonation tokesn [Hash]'
|
138
144
|
option 'impersonation_token_revoke', 'Revoke impersonation tokesn [Token ID]'
|
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.1
|
4
|
+
version: 0.2.1
|
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-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -25,19 +25,19 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '6.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: amazing_print
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '1.
|
33
|
+
version: '1.2'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '1.
|
40
|
+
version: '1.2'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: gitlab_chronic_duration
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -309,6 +309,7 @@ files:
|
|
309
309
|
- lib/labclient/awards/snippets/list.rb
|
310
310
|
- lib/labclient/awards/snippets/show.rb
|
311
311
|
- lib/labclient/branches/branch.rb
|
312
|
+
- lib/labclient/branches/create.rb
|
312
313
|
- lib/labclient/branches/delete.rb
|
313
314
|
- lib/labclient/branches/delete_merged.rb
|
314
315
|
- lib/labclient/branches/list.rb
|
@@ -403,8 +404,10 @@ files:
|
|
403
404
|
- lib/labclient/files/update.rb
|
404
405
|
- lib/labclient/generator/generator.rb
|
405
406
|
- lib/labclient/generator/names.rb
|
407
|
+
- lib/labclient/generator/template_helper.rb
|
408
|
+
- lib/labclient/generator/templates/environments.rb
|
406
409
|
- lib/labclient/generator/templates/pages.rb
|
407
|
-
- lib/labclient/generator/templates/
|
410
|
+
- lib/labclient/generator/templates/pipeline_trigger.rb
|
408
411
|
- lib/labclient/generator/wizard.rb
|
409
412
|
- lib/labclient/groups/access_requests/access_request.rb
|
410
413
|
- lib/labclient/groups/access_requests/approve.rb
|
@@ -509,6 +512,7 @@ files:
|
|
509
512
|
- lib/labclient/keys/show.rb
|
510
513
|
- lib/labclient/keys/user.rb
|
511
514
|
- lib/labclient/klass.rb
|
515
|
+
- lib/labclient/lab_struct.rb
|
512
516
|
- lib/labclient/license/add.rb
|
513
517
|
- lib/labclient/license/delete.rb
|
514
518
|
- lib/labclient/license/license.rb
|
@@ -579,7 +583,6 @@ files:
|
|
579
583
|
- lib/labclient/notes/snippets/update.rb
|
580
584
|
- lib/labclient/notifications/list.rb
|
581
585
|
- lib/labclient/notifications/update.rb
|
582
|
-
- lib/labclient/open_struct.rb
|
583
586
|
- lib/labclient/overview.rb
|
584
587
|
- lib/labclient/paginated_response.rb
|
585
588
|
- lib/labclient/pipelines/cancel.rb
|
@@ -763,6 +766,11 @@ files:
|
|
763
766
|
- lib/labclient/protected_branches/protect.rb
|
764
767
|
- lib/labclient/protected_branches/show.rb
|
765
768
|
- lib/labclient/protected_branches/unprotect.rb
|
769
|
+
- lib/labclient/protected_environments/list.rb
|
770
|
+
- lib/labclient/protected_environments/protect.rb
|
771
|
+
- lib/labclient/protected_environments/protected_environment.rb
|
772
|
+
- lib/labclient/protected_environments/show.rb
|
773
|
+
- lib/labclient/protected_environments/unprotect.rb
|
766
774
|
- lib/labclient/protected_tags/list.rb
|
767
775
|
- lib/labclient/protected_tags/protect.rb
|
768
776
|
- lib/labclient/protected_tags/show.rb
|
@@ -857,6 +865,7 @@ files:
|
|
857
865
|
- lib/labclient/users/keys/list.rb
|
858
866
|
- lib/labclient/users/keys/show.rb
|
859
867
|
- lib/labclient/users/list.rb
|
868
|
+
- lib/labclient/users/membership.rb
|
860
869
|
- lib/labclient/users/memberships.rb
|
861
870
|
- lib/labclient/users/search.rb
|
862
871
|
- lib/labclient/users/show.rb
|
@@ -1,23 +0,0 @@
|
|
1
|
-
module LabClient
|
2
|
-
module Generator
|
3
|
-
# Common Helper Class
|
4
|
-
class TemplateHelper
|
5
|
-
attr_reader :client
|
6
|
-
attr_accessor :opts
|
7
|
-
|
8
|
-
def inspect
|
9
|
-
"#<LabClient::Template #{self.class.to_s.demodulize}>"
|
10
|
-
end
|
11
|
-
|
12
|
-
def initialize(client, opts = {})
|
13
|
-
@client = client
|
14
|
-
self.opts = opts
|
15
|
-
setup
|
16
|
-
end
|
17
|
-
|
18
|
-
def setup
|
19
|
-
# Blank Place Holder
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|