labclient 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/lib/labclient.rb +42 -39
  3. data/lib/labclient/common.rb +5 -0
  4. data/lib/labclient/groups/group.rb +9 -0
  5. data/lib/labclient/groups/stub.rb +8 -0
  6. data/lib/labclient/http.rb +5 -1
  7. data/lib/labclient/issues/agent_detail.rb +1 -1
  8. data/lib/labclient/issues/closed_by.rb +1 -1
  9. data/lib/labclient/issues/create.rb +15 -5
  10. data/lib/labclient/issues/delete.rb +1 -1
  11. data/lib/labclient/issues/move.rb +1 -1
  12. data/lib/labclient/issues/participants.rb +1 -1
  13. data/lib/labclient/issues/related_merge_requests.rb +1 -1
  14. data/lib/labclient/issues/show.rb +1 -1
  15. data/lib/labclient/issues/subscribe.rb +1 -1
  16. data/lib/labclient/issues/time_stats.rb +5 -5
  17. data/lib/labclient/issues/todo.rb +1 -1
  18. data/lib/labclient/issues/unsubscribe.rb +1 -1
  19. data/lib/labclient/issues/update.rb +1 -1
  20. data/lib/labclient/klass.rb +4 -0
  21. data/lib/labclient/merge_requests/accept.rb +1 -1
  22. data/lib/labclient/merge_requests/cancel_auto_merge.rb +1 -1
  23. data/lib/labclient/merge_requests/changes.rb +1 -1
  24. data/lib/labclient/merge_requests/closes_issues.rb +1 -1
  25. data/lib/labclient/merge_requests/commits.rb +1 -1
  26. data/lib/labclient/merge_requests/delete.rb +1 -1
  27. data/lib/labclient/merge_requests/diff_versions.rb +1 -1
  28. data/lib/labclient/merge_requests/participants.rb +1 -1
  29. data/lib/labclient/merge_requests/pipelines.rb +2 -2
  30. data/lib/labclient/merge_requests/rebase.rb +1 -1
  31. data/lib/labclient/merge_requests/show.rb +1 -1
  32. data/lib/labclient/merge_requests/subscribe.rb +1 -1
  33. data/lib/labclient/merge_requests/time_stats.rb +5 -5
  34. data/lib/labclient/merge_requests/todo.rb +1 -1
  35. data/lib/labclient/merge_requests/unsubscribe.rb +1 -1
  36. data/lib/labclient/merge_requests/update.rb +1 -1
  37. data/lib/labclient/overview.rb +18 -0
  38. data/lib/labclient/projects/access_requests/access_request.rb +0 -1
  39. data/lib/labclient/projects/badges/project_badge.rb +0 -1
  40. data/lib/labclient/projects/clusters/project_cluster.rb +0 -1
  41. data/lib/labclient/projects/create.rb +13 -0
  42. data/lib/labclient/projects/deployments/project_deployment.rb +1 -3
  43. data/lib/labclient/projects/environments/project_environment.rb +0 -1
  44. data/lib/labclient/projects/forks/existing.rb +0 -2
  45. data/lib/labclient/projects/forks/fork.rb +1 -1
  46. data/lib/labclient/projects/forks/list.rb +0 -1
  47. data/lib/labclient/projects/forks/remove.rb +0 -1
  48. data/lib/labclient/projects/hooks/project_hook.rb +0 -1
  49. data/lib/labclient/projects/labels/project_label.rb +0 -1
  50. data/lib/labclient/projects/methods.rb +5 -0
  51. data/lib/labclient/projects/mirrors/project_mirror.rb +0 -1
  52. data/lib/labclient/projects/reference.rb +3 -0
  53. data/lib/labclient/projects/release_links/project_release_link.rb +0 -1
  54. data/lib/labclient/projects/releases/project_release.rb +0 -1
  55. data/lib/labclient/projects/services/project_service.rb +0 -1
  56. data/lib/labclient/projects/stars/star.rb +0 -2
  57. data/lib/labclient/projects/stars/starred_projects.rb +0 -2
  58. data/lib/labclient/projects/stars/starrers.rb +1 -1
  59. data/lib/labclient/projects/triggers/project_trigger.rb +0 -1
  60. data/lib/labclient/projects/variables/project_variable.rb +0 -1
  61. data/lib/labclient/version.rb +1 -1
  62. metadata +3 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 79977702325d9d9a7df2569a8e1e948db351fc35deea828a832a548048efa7b3
4
- data.tar.gz: 1febe4b7a2eab857c37fc814b299678a35c86be61c8d346806c5d8092ea154af
3
+ metadata.gz: 0cfc44546096a710f5e2a8ed0b500b202825150b03a029738d8b870cf4258e94
4
+ data.tar.gz: c965712946b26eef38ae7546a483688eae0ae20cc82480dad59262aa050ba18c
5
5
  SHA512:
6
- metadata.gz: 14eabf457805cece5387012fcd28ae9922ce554a6981aa21653d98404b274e6438b49686e0b6a7f8f3dbd14f16520089c58141ff08f2310c5314b52d31facc6c
7
- data.tar.gz: 93b298936e970390a1886e03ddb4473d57df7adcfe75be983770fe09d5674cd5544776abd239c02c11a9ab93445aeee10c77fcb7cd2236e884174d844eec4e9b
6
+ metadata.gz: 77a79ac90bfa375a488633c9aa530581a8235c3b5c0d00fd24644ccb962fd39152facc298e77a016cffb200f65b301e6d2c7a1ed883f2dfd2ea0dc6d96ea185d
7
+ data.tar.gz: cc4cb427458a49007775e063fc065df0623c76f4abe05f0b93279e3ca1638b9b0c024074cb8ac57e7ab732543c39da7cb9f436f2ca85263995c72bbf083d1df9
@@ -49,45 +49,6 @@ require 'labclient/users/delete'
49
49
  require 'labclient/users/delete_identity'
50
50
  require 'labclient/users/user'
51
51
 
52
- # User Keys
53
- require 'labclient/users/keys/client'
54
- require 'labclient/users/keys/list'
55
- require 'labclient/users/keys/show'
56
- require 'labclient/users/keys/create'
57
- require 'labclient/users/keys/delete'
58
-
59
- # Notifications
60
- require 'labclient/notifications/list'
61
- require 'labclient/notifications/update'
62
-
63
- # User GPG Keys
64
- require 'labclient/users/gpg/client'
65
- require 'labclient/users/gpg/list'
66
- require 'labclient/users/gpg/show'
67
- require 'labclient/users/gpg/create'
68
- require 'labclient/users/gpg/delete'
69
- require 'labclient/users/gpg/gpg_key'
70
-
71
- # User Emails
72
- require 'labclient/users/email/client'
73
- require 'labclient/users/email/list'
74
- require 'labclient/users/email/show'
75
- require 'labclient/users/email/create'
76
- require 'labclient/users/email/delete'
77
- require 'labclient/users/email/email'
78
-
79
- # Impersonation Tokens
80
- require 'labclient/impersonation_tokens/impersonation_token'
81
- require 'labclient/impersonation_tokens/list'
82
- require 'labclient/impersonation_tokens/show'
83
- require 'labclient/impersonation_tokens/create'
84
- require 'labclient/impersonation_tokens/revoke'
85
-
86
- # Namespaces
87
- require 'labclient/namespaces/namespace'
88
- require 'labclient/namespaces/list'
89
- require 'labclient/namespaces/show'
90
-
91
52
  # ===============================================
92
53
  # Projects
93
54
  # ===============================================
@@ -116,6 +77,9 @@ require 'labclient/projects/restore'
116
77
  require 'labclient/projects/snapshot'
117
78
  require 'labclient/projects/github_import'
118
79
 
80
+ # Group Stub / Docs ORder
81
+ require 'labclient/groups/stub'
82
+
119
83
  # Project Forks
120
84
  require 'labclient/projects/forks/list'
121
85
  require 'labclient/projects/forks/fork'
@@ -684,6 +648,45 @@ require 'labclient/notes/epics/delete'
684
648
  require 'labclient/notes/note'
685
649
  # -----------------------------------
686
650
 
651
+ # User Keys
652
+ require 'labclient/users/keys/client'
653
+ require 'labclient/users/keys/list'
654
+ require 'labclient/users/keys/show'
655
+ require 'labclient/users/keys/create'
656
+ require 'labclient/users/keys/delete'
657
+
658
+ # Notifications
659
+ require 'labclient/notifications/list'
660
+ require 'labclient/notifications/update'
661
+
662
+ # User GPG Keys
663
+ require 'labclient/users/gpg/client'
664
+ require 'labclient/users/gpg/list'
665
+ require 'labclient/users/gpg/show'
666
+ require 'labclient/users/gpg/create'
667
+ require 'labclient/users/gpg/delete'
668
+ require 'labclient/users/gpg/gpg_key'
669
+
670
+ # User Emails
671
+ require 'labclient/users/email/client'
672
+ require 'labclient/users/email/list'
673
+ require 'labclient/users/email/show'
674
+ require 'labclient/users/email/create'
675
+ require 'labclient/users/email/delete'
676
+ require 'labclient/users/email/email'
677
+
678
+ # Impersonation Tokens
679
+ require 'labclient/impersonation_tokens/impersonation_token'
680
+ require 'labclient/impersonation_tokens/list'
681
+ require 'labclient/impersonation_tokens/show'
682
+ require 'labclient/impersonation_tokens/create'
683
+ require 'labclient/impersonation_tokens/revoke'
684
+
685
+ # Namespaces
686
+ require 'labclient/namespaces/namespace'
687
+ require 'labclient/namespaces/list'
688
+ require 'labclient/namespaces/show'
689
+
687
690
  # Runners
688
691
  require 'labclient/runners/list'
689
692
  require 'labclient/runners/all'
@@ -72,6 +72,11 @@ module LabClient
72
72
  CGI.escape obj_id.to_s
73
73
  end
74
74
 
75
+ def format_query_id(key, query)
76
+ query[key] = format_id(query[key]) if query.key? key
77
+ query[key.to_s] = format_id(query[key.to_s]) if query.key? key.to_s
78
+ end
79
+
75
80
  def format_query_ids(key, query)
76
81
  query[key] = query[key].map { |x| format_id(x) } if query.key? key
77
82
 
@@ -49,10 +49,17 @@ module LabClient
49
49
  end
50
50
  end
51
51
 
52
+ def project_create(query)
53
+ query[:namespace_id] = id
54
+ client.projects.create(query)
55
+ end
56
+
52
57
  def ldap_list
53
58
  client.groups.ldap.list(id)
54
59
  end
55
60
 
61
+ alias ldap_links ldap_list
62
+
56
63
  def ldap_sync
57
64
  client.groups.ldap.sync(id)
58
65
  end
@@ -247,12 +254,14 @@ module LabClient
247
254
  option 'audit_events', "List this group's AuditEvents"
248
255
  option 'audit_event', 'Show a specific AuditEvents [Audit Event ID]'
249
256
  option 'projects', 'List direct Projects [Hash]'
257
+ option 'project_create', 'Create a project in this Group [Hash]'
250
258
  option 'details', 'Get all details [Hash]'
251
259
  option 'search', 'Search by scope within group [scope, search_string]'
252
260
  option 'delete', 'Delete this Group'
253
261
  option 'restore', 'Restore if marked for deletion'
254
262
  option 'transfer', 'Transfer project to this group [Project ID]'
255
263
  option 'ldap_list', 'Lists LDAP group links'
264
+ option 'ldap_links', 'Alias for ldap_list'
256
265
  option 'ldap_sync', 'Syncs the group with its linked LDAP group'
257
266
  option 'ldap_create', 'Adds an LDAP group link. [Hash]'
258
267
  option 'ldap_delete', 'Deletes an LDAP group link. [CN, Provider(optional)]'
@@ -0,0 +1,8 @@
1
+ # Top namespace
2
+ module LabClient
3
+ # Ugly Hack, but Makes Docs Easy
4
+ class Groups < Common
5
+ doc '' do
6
+ end
7
+ end
8
+ end
@@ -80,7 +80,11 @@ module Typhoeus
80
80
  end
81
81
 
82
82
  def friendly_error
83
- message = data[:message] || data[:error] || data
83
+ message = if data
84
+ data[:message] || data[:error] || data
85
+ else
86
+ return_message
87
+ end
84
88
  "#{code} - #{message}"
85
89
  end
86
90
  end
@@ -4,7 +4,7 @@ module LabClient
4
4
  class Issues < Common
5
5
  doc 'Show' do
6
6
  title 'Agent Detail'
7
- desc 'Get user agent details [project id, issue iid]'
7
+ desc 'Get user agent details [Project ID, Issue IID]'
8
8
  example 'client.issues.agent_detail(30, 1)'
9
9
  result <<~DOC
10
10
  => {:user_agent=>"Mozilla/5.0 (X11; Linux x86_64; rv:72.0) Gecko/20100101 Firefox/72.0", :ip_address=>"10.0.0.14", :akismet_submitted=>false}
@@ -4,7 +4,7 @@ module LabClient
4
4
  class Issues < Common
5
5
  doc 'Show' do
6
6
  subtitle 'Closed By'
7
- desc 'Get all the merge requests that will close issue when merged. [project id, issue iid]'
7
+ desc 'Get all the merge requests that will close issue when merged. [Project ID, Issue IID]'
8
8
  example 'client.issues.closed_by(5, 1)'
9
9
  result <<~DOC
10
10
  => [#<MergeRequest id: 5, title: Update README.md, state: opened>]
@@ -3,7 +3,7 @@ module LabClient
3
3
  # Specifics
4
4
  class Issues < Common
5
5
  doc 'Create' do
6
- desc 'Creates a new project issue. [project id]'
6
+ desc 'Creates a new project issue. [Project ID]'
7
7
  example 'client.issues.create(5, title: "Fancy!")'
8
8
  result <<~DOC
9
9
  => #<Issue id: 1, title: Fancy!, state: opened>
@@ -14,10 +14,20 @@ module LabClient
14
14
  markdown <<~DOC
15
15
  See [API docs here](https://docs.gitlab.com/ee/api/issues.html#new-issue) for full list of attributes
16
16
 
17
- | Attribute | Type | Required | Description |
18
- |-------------------------------------------|----------------|----------|--------------|
19
- | title | string | yes | The title of an issue |
20
- | description | string | no | The description of an issue. Limited to 1,048,576 characters. |
17
+ | Attribute | Type | Required | Description |
18
+ |-------------|----------------|----------|--------------|
19
+ | title | string | yes | The title of an issue |
20
+ | description | string | no | The description of an issue. Limited to 1,048,576 characters. |
21
+
22
+ &nbsp;
23
+ DOC
24
+ end
25
+
26
+ doc 'Create' do
27
+ desc 'Via Project [Hash]'
28
+ example <<~DOC
29
+ project = client.projects.show(16)
30
+ project.issue_create(title: "Fancy!")
21
31
  DOC
22
32
  end
23
33
 
@@ -3,7 +3,7 @@ module LabClient
3
3
  # Specifics
4
4
  class Issues < Common
5
5
  doc 'Delete' do
6
- desc 'Updates an existing project issue. This call is also used to mark an issue as closed. [project id, issue iid]'
6
+ desc 'Updates an existing project issue. This call is also used to mark an issue as closed. [Project ID, Issue IID]'
7
7
  example 'client.issues.delete(5, 1)'
8
8
  result <<~DOC
9
9
  => #<Issue id: 1, title: Moar Fancy!, state: opened>
@@ -3,7 +3,7 @@ module LabClient
3
3
  # Specifics
4
4
  class Issues < Common
5
5
  doc 'Move' do
6
- desc 'Moves an issue to a different project. [project id, issue iid, target project id]'
6
+ desc 'Moves an issue to a different project. [Project ID, issue iid, target project id]'
7
7
  example 'client.issues.move(5, 1, 6)'
8
8
  result <<~DOC
9
9
  => #<Issue id: 1, title: Moar Fancy!, state: opened>
@@ -4,7 +4,7 @@ module LabClient
4
4
  class Issues < Common
5
5
  doc 'Show' do
6
6
  title 'Participants'
7
- desc 'Get a list of issue participants. [project id, issue iid]'
7
+ desc 'Get a list of issue participants. [Project ID, Issue IID]'
8
8
  example 'client.issues.participants(30,1)'
9
9
  result <<~DOC
10
10
  => [#<User id: 1, username: braum>, #<User id: 52, username: anivia>]
@@ -5,7 +5,7 @@ module LabClient
5
5
  doc 'Show' do
6
6
  title 'Merge Requests'
7
7
  subtitle 'Related'
8
- desc 'Get all the merge requests that are related to the issue. [project id, issue iid]'
8
+ desc 'Get all the merge requests that are related to the issue. [Project ID, Issue IID]'
9
9
  example 'client.issues.related_merge_requests(5, 1)'
10
10
  result <<~DOC
11
11
  => [#<MergeRequest id: 5, title: Update README.md, state: opened>]
@@ -3,7 +3,7 @@ module LabClient
3
3
  # Specifics
4
4
  class Issues < Common
5
5
  doc 'Show' do
6
- desc 'Get a single project issue. [project, issue iid]'
6
+ desc 'Get a single project issue. [project, Issue IID]'
7
7
  example 'client.issues.show(343, 1)'
8
8
  result <<~DOC
9
9
  => #<Issue id: 1, title: Front-line global approach, state: opened>
@@ -4,7 +4,7 @@ module LabClient
4
4
  class Issues < Common
5
5
  doc 'Update' do
6
6
  title 'Subscribe'
7
- desc 'Subscribes the authenticated user to an issue to receive notifications. [project id, issue iid]'
7
+ desc 'Subscribes the authenticated user to an issue to receive notifications. [Project ID, Issue IID]'
8
8
 
9
9
  example 'client.issues.subscribe(343, 7)'
10
10
 
@@ -4,7 +4,7 @@ module LabClient
4
4
  class Issues < Common
5
5
  doc 'Time Stats' do
6
6
  title 'Show'
7
- desc 'Get time tracking stats. [project id, issue iid]'
7
+ desc 'Get time tracking stats. [Project ID, Issue IID]'
8
8
  example 'client.issues.time_stats(30, 1)'
9
9
  result <<~DOC
10
10
  => {:time_estimate=>0, :total_time_spent=>0, :human_time_estimate=>nil, :human_total_time_spent=>nil}
@@ -28,7 +28,7 @@ module LabClient
28
28
 
29
29
  doc 'Time Stats' do
30
30
  title 'Add'
31
- desc 'Adds spent time for this merge request. [project id, issue iid, duration]'
31
+ desc 'Adds spent time for this merge request. [Project ID, issue iid, duration]'
32
32
  markdown 'Duration accepts Human Format, or ActiveSupport::Duration (e.g. 1.hour)'
33
33
  end
34
34
 
@@ -67,7 +67,7 @@ module LabClient
67
67
 
68
68
  doc 'Time Stats' do
69
69
  title 'Estimate'
70
- desc 'Sets an estimated time of work for this merge request. [project id, issue iid, duration]'
70
+ desc 'Sets an estimated time of work for this merge request. [Project ID, issue iid, duration]'
71
71
  markdown 'Duration accepts Human Format, or ActiveSupport::Duration (e.g. 1.hour)'
72
72
  end
73
73
 
@@ -108,7 +108,7 @@ module LabClient
108
108
  doc 'Time Stats' do
109
109
  title 'Reset'
110
110
  subtitle 'Estimate'
111
- desc 'Resets the estimated time for this merge request to 0 seconds. [project id, issue iid]'
111
+ desc 'Resets the estimated time for this merge request to 0 seconds. [Project ID, Issue IID]'
112
112
  example 'client.issues.reset_time_estimate(30, 1)'
113
113
  result <<~DOC
114
114
  => {:time_estimate=>0, :total_time_spent=>0, :human_time_estimate=>nil, :human_total_time_spent=>nil}
@@ -132,7 +132,7 @@ module LabClient
132
132
 
133
133
  doc 'Time Stats' do
134
134
  subtitle 'Time Spent'
135
- desc 'Resets the estimated time for this merge request to 0 seconds. [project id, issue iid]'
135
+ desc 'Resets the estimated time for this merge request to 0 seconds. [Project ID, Issue IID]'
136
136
  example 'client.issues.reset_spent_time(30, 1)'
137
137
  result <<~DOC
138
138
  => {:time_estimate=>0, :total_time_spent=>0, :human_time_estimate=>nil, :human_total_time_spent=>nil}
@@ -4,7 +4,7 @@ module LabClient
4
4
  class Issues < Common
5
5
  doc 'Update' do
6
6
  title 'Todo'
7
- desc 'Manually creates a todo for the current user on an issue. [project id, merge request iid]'
7
+ desc 'Manually creates a todo for the current user on an issue. [Project ID, merge request iid]'
8
8
 
9
9
  example 'client.issues.todo(30, 1)'
10
10
 
@@ -4,7 +4,7 @@ module LabClient
4
4
  class Issues < Common
5
5
  doc 'Update' do
6
6
  title 'Unsubscribe'
7
- desc 'Unsubscribes the authenticated user from the issue to not receive notifications from it. [project id, issue iid]'
7
+ desc 'Unsubscribes the authenticated user from the issue to not receive notifications from it. [Project ID, Issue IID]'
8
8
 
9
9
  example 'client.issues.unsubscribe(343, 7)'
10
10
 
@@ -3,7 +3,7 @@ module LabClient
3
3
  # Specifics
4
4
  class Issues < Common
5
5
  doc 'Update' do
6
- desc 'Updates an existing project issue. This call is also used to mark an issue as closed. [project id, issue iid]'
6
+ desc 'Updates an existing project issue. This call is also used to mark an issue as closed. [Project ID, Issue IID]'
7
7
  example 'client.issues.update(5, 1, title: "Moar Fancy!")'
8
8
  result <<~DOC
9
9
  => #<Issue id: 1, title: Moar Fancy!, state: opened>
@@ -34,6 +34,10 @@ module LabClient
34
34
  nil
35
35
  end
36
36
 
37
+ def valid_group_project_levels
38
+ %i[guest reporter developer maintainer owner]
39
+ end
40
+
37
41
  # TODO: Combine all of these?
38
42
  def collect_project_id(position = 1)
39
43
  response.path.split('/')[position]
@@ -4,7 +4,7 @@ module LabClient
4
4
  class MergeRequests < Common
5
5
  doc 'Update' do
6
6
  title 'Accept'
7
- desc 'Merge changes submitted with MR. [project id, merge request iid]'
7
+ desc 'Merge changes submitted with MR. [Project ID, merge request iid]'
8
8
 
9
9
  markdown <<~DOC
10
10
  - <small>if merge request is unable to be accepted (ie: Work in Progress, Closed, Pipeline Pending Completion, or Failed while requiring Success) - you'll get a `405` and the error message 'Method Not Allowed'</small>
@@ -4,7 +4,7 @@ module LabClient
4
4
  class MergeRequests < Common
5
5
  doc 'Update' do
6
6
  title 'Cancel Auto Merge'
7
- desc 'Cancel Automatic Merge When Pipeline Succeeds [project id, merge request iid]'
7
+ desc 'Cancel Automatic Merge When Pipeline Succeeds [Project ID, merge request iid]'
8
8
  markdown <<~DOC
9
9
  - If you don't have permissions to accept this merge request - you'll get a `401`
10
10
 
@@ -4,7 +4,7 @@ module LabClient
4
4
  class MergeRequests < Common
5
5
  doc 'Show' do
6
6
  title 'Changes'
7
- desc 'Shows information about the merge request including its files and changes. [project id, mr iid]'
7
+ desc 'Shows information about the merge request including its files and changes. [Project ID, mr iid]'
8
8
  example 'client.merge_requests.changes(333,1)'
9
9
  result <<~DOC
10
10
  => #<Changes MR: 1, title: Update README.md>
@@ -4,7 +4,7 @@ module LabClient
4
4
  class MergeRequests < Common
5
5
  doc 'Show' do
6
6
  title 'Closes Issues'
7
- desc 'Get all the issues that would be closed by merging the provided merge request. [project id, mr iid]'
7
+ desc 'Get all the issues that would be closed by merging the provided merge request. [Project ID, mr iid]'
8
8
  example 'client.merge_requests.closes_issues(343, 1)'
9
9
  result <<~DOC
10
10
  => => [#<Issue id: 1, title: Problem!, state: opened>]
@@ -4,7 +4,7 @@ module LabClient
4
4
  class MergeRequests < Common
5
5
  doc 'Show' do
6
6
  title 'Commits'
7
- desc 'Get a list of merge request commits. [project id, mr iid]'
7
+ desc 'Get a list of merge request commits. [Project ID, mr iid]'
8
8
  example 'client.merge_requests.commits(333,1)'
9
9
  result <<~DOC
10
10
  => [#<Commit title: Update README.md, sha: 50c90734>, #<Commit title: Add new file, sha: 6534a685>]
@@ -3,7 +3,7 @@ module LabClient
3
3
  # Specifics
4
4
  class MergeRequests < Common
5
5
  doc 'Delete' do
6
- desc 'Only for admins and project owners. Deletes the merge request in question. [project id, merge request iid]'
6
+ desc 'Only for admins and project owners. Deletes the merge request in question. [Project ID, merge request iid]'
7
7
 
8
8
  example 'client.merge_requests.delete(343, 2)'
9
9
 
@@ -4,7 +4,7 @@ module LabClient
4
4
  class MergeRequests < Common
5
5
  doc 'Diff' do
6
6
  title 'Versions'
7
- desc 'Get a list of merge request diff versions. [project id, mr iid]'
7
+ desc 'Get a list of merge request diff versions. [Project ID, mr iid]'
8
8
  example 'client.merge_requests.diff_versions(333,1)'
9
9
  result <<~DOC
10
10
  => [#<MergeRequestDiff id: 3, MR: 1, state: collected>, #<MergeRequestDiff id: 2, MR: 1, state: collected>, ..]
@@ -4,7 +4,7 @@ module LabClient
4
4
  class MergeRequests < Common
5
5
  doc 'Show' do
6
6
  title 'Participants'
7
- desc 'Get a list of merge request participants. [project id, mr iid]'
7
+ desc 'Get a list of merge request participants. [Project ID, mr iid]'
8
8
  example 'client.merge_requests.participants(333,1)'
9
9
  result <<~DOC
10
10
  => [#<User id: 1, username: braum>, #<User id: 52, username: anivia>]
@@ -4,7 +4,7 @@ module LabClient
4
4
  class MergeRequests < Common
5
5
  doc 'Pipelines' do
6
6
  title 'List'
7
- desc 'Get a list of merge request pipelines. [project id, mr iid]'
7
+ desc 'Get a list of merge request pipelines. [Project ID, mr iid]'
8
8
  example 'client.merge_requests.pipelines(343,1)'
9
9
  result <<~DOC
10
10
  => [#<Pipeline id: 4, ref: branch, status: success>]
@@ -33,7 +33,7 @@ module LabClient
33
33
 
34
34
  doc 'Pipelines' do
35
35
  title 'Create'
36
- desc 'Create a new pipeline for a merge request. Requires .gitlab-ci.yml to be configured with only: [merge_requests] to create jobs. [project id, mr iid]'
36
+ desc 'Create a new pipeline for a merge request. Requires .gitlab-ci.yml to be configured with only: [merge_requests] to create jobs. [Project ID, mr iid]'
37
37
  example 'client.merge_requests.create_pipeline(343, 1)'
38
38
  result <<~DOC
39
39
  => #<Pipeline id: 7, ref: refs/merge-requests/1/head, status: pending>
@@ -4,7 +4,7 @@ module LabClient
4
4
  class MergeRequests < Common
5
5
  doc 'Update' do
6
6
  title 'Rebase'
7
- desc 'Rebase a merge request [project id, merge request iid, skip_ci (true/false)]'
7
+ desc 'Rebase a merge request [Project ID, merge request iid, skip_ci (true/false)]'
8
8
  markdown <<~DOC
9
9
  - Automatically rebase the `source_branch` of the merge request against its `target_branch`.
10
10
 
@@ -3,7 +3,7 @@ module LabClient
3
3
  # Specifics
4
4
  class MergeRequests < Common
5
5
  doc 'Show' do
6
- desc 'Shows information about a single merge request. [project id, mr iid]'
6
+ desc 'Shows information about a single merge request. [Project ID, mr iid]'
7
7
  example 'client.merge_requests.show(333,1)'
8
8
  result <<~DOC
9
9
  => #<MergeRequest id: 37, title: Add new file>
@@ -4,7 +4,7 @@ module LabClient
4
4
  class MergeRequests < Common
5
5
  doc 'Update' do
6
6
  title 'Subscribe'
7
- desc 'Subscribes the authenticated user to a merge request to receive notification. [project id, merge request iid]'
7
+ desc 'Subscribes the authenticated user to a merge request to receive notification. [Project ID, merge request iid]'
8
8
 
9
9
  example 'client.merge_requests.subscribe(343, 7)'
10
10
 
@@ -4,7 +4,7 @@ module LabClient
4
4
  class MergeRequests < Common
5
5
  doc 'Time Stats' do
6
6
  title 'Show'
7
- desc 'Get time tracking stats. [project id, mr iid]'
7
+ desc 'Get time tracking stats. [Project ID, mr iid]'
8
8
  example 'client.merge_requests.time_stats(333, 1)'
9
9
  result <<~DOC
10
10
  => {:time_estimate=>0, :total_time_spent=>0, :human_time_estimate=>nil, :human_total_time_spent=>nil}
@@ -28,7 +28,7 @@ module LabClient
28
28
 
29
29
  doc 'Time Stats' do
30
30
  title 'Add'
31
- desc 'Adds spent time for this merge request. [project id, mr iid, duration]'
31
+ desc 'Adds spent time for this merge request. [Project ID, mr iid, duration]'
32
32
  markdown 'Duration accepts Human Format, or ActiveSupport::Duration (e.g. 1.hour)'
33
33
  end
34
34
 
@@ -67,7 +67,7 @@ module LabClient
67
67
 
68
68
  doc 'Time Stats' do
69
69
  title 'Estimate'
70
- desc 'Sets an estimated time of work for this merge request. [project id, mr iid, duration]'
70
+ desc 'Sets an estimated time of work for this merge request. [Project ID, mr iid, duration]'
71
71
  markdown 'Duration accepts Human Format, or ActiveSupport::Duration (e.g. 1.hour)'
72
72
  end
73
73
 
@@ -108,7 +108,7 @@ module LabClient
108
108
  doc 'Time Stats' do
109
109
  title 'Reset'
110
110
  subtitle 'Estimate'
111
- desc 'Resets the estimated time for this merge request to 0 seconds. [project id, mr iid]'
111
+ desc 'Resets the estimated time for this merge request to 0 seconds. [Project ID, mr iid]'
112
112
  example 'client.merge_requests.reset_time_estimate(333, 1)'
113
113
  result <<~DOC
114
114
  => {:time_estimate=>0, :total_time_spent=>0, :human_time_estimate=>nil, :human_total_time_spent=>nil}
@@ -132,7 +132,7 @@ module LabClient
132
132
 
133
133
  doc 'Time Stats' do
134
134
  subtitle 'Time Spent'
135
- desc 'Resets the estimated time for this merge request to 0 seconds. [project id, mr iid]'
135
+ desc 'Resets the estimated time for this merge request to 0 seconds. [Project ID, mr iid]'
136
136
  example 'client.merge_requests.reset_spent_time(333, 1)'
137
137
  result <<~DOC
138
138
  => {:time_estimate=>0, :total_time_spent=>0, :human_time_estimate=>nil, :human_total_time_spent=>nil}
@@ -4,7 +4,7 @@ module LabClient
4
4
  class MergeRequests < Common
5
5
  doc 'Update' do
6
6
  title 'Todo'
7
- desc 'Manually creates a todo for the current user on a merge request. [project id, merge request iid]'
7
+ desc 'Manually creates a todo for the current user on a merge request. [Project ID, merge request iid]'
8
8
 
9
9
  example 'client.merge_requests.todo(343, 7)'
10
10
 
@@ -4,7 +4,7 @@ module LabClient
4
4
  class MergeRequests < Common
5
5
  doc 'Update' do
6
6
  title 'Unsubscribe'
7
- desc 'Subscribes the authenticated user to a merge request to receive notification. [project id, merge request iid]'
7
+ desc 'Subscribes the authenticated user to a merge request to receive notification. [Project ID, merge request iid]'
8
8
 
9
9
  example 'client.merge_requests.unsubscribe(343, 7)'
10
10
 
@@ -3,7 +3,7 @@ module LabClient
3
3
  # Specifics
4
4
  class MergeRequests < Common
5
5
  doc 'Update' do
6
- desc 'Updates an existing merge request. You can change the target branch, title, or even close the MR. [project id, merge request iid]'
6
+ desc 'Updates an existing merge request. You can change the target branch, title, or even close the MR. [Project ID, merge request iid]'
7
7
 
8
8
  example <<~DOC
9
9
  client.merge_requests.update(343, 2, {
@@ -173,6 +173,24 @@ module LabClient
173
173
  DOC
174
174
  end
175
175
 
176
+ doc 'Other' do
177
+ title 'Object Helpers'
178
+ markdown <<~DOC
179
+ Each created object will have additional helper methods
180
+ DOC
181
+
182
+ result <<~DOC
183
+ project = client.projects.show(5)
184
+
185
+ # Awesome Print all details
186
+ project.verbose
187
+
188
+ # Awesome Print all details
189
+ project.valid_group_project_levels
190
+ # => [:guest, :reporter, :developer, :maintainer, :owner]
191
+ DOC
192
+ end
193
+
176
194
  doc 'Other' do
177
195
  title 'Object IDs'
178
196
 
@@ -24,7 +24,6 @@ module LabClient
24
24
  date_time_attrs %i[created_at]
25
25
 
26
26
  help do
27
- @group_name = 'Projects'
28
27
  subtitle 'ProjectAccessRequest'
29
28
  option 'user', 'Show user for access request'
30
29
  option 'approve', 'Accept access request [Access Level]'
@@ -36,7 +36,6 @@ module LabClient
36
36
  date_time_attrs %i[created_at]
37
37
 
38
38
  help do
39
- @group_name = 'Projects'
40
39
  subtitle 'ProjectBadge'
41
40
  option 'project', 'Show Project'
42
41
  option 'update', 'Update this badge [Hash]'
@@ -28,7 +28,6 @@ module LabClient
28
28
  user_attrs %i[uster]
29
29
 
30
30
  help do
31
- @group_name = 'Projects'
32
31
  subtitle 'ProjectCluster'
33
32
  option 'project', 'Show Project'
34
33
  option 'update', 'Update this Cluster [Hash]'
@@ -32,6 +32,16 @@ module LabClient
32
32
  example 'client.projects.create(name: "Verbal", description: "hes gone", visibility: :private)'
33
33
  end
34
34
 
35
+ doc 'Create' do
36
+ desc 'Via Group'
37
+ example <<~DOC
38
+ group = client.groups.show(51)
39
+ group.project_create(name: "Hobby", description: "We do have time for your darned hobbies!")
40
+ DOC
41
+
42
+ example 'client.projects.create(name: "Verbal", description: "hes gone", visibility: :private)'
43
+ end
44
+
35
45
  doc 'Create' do
36
46
  title 'For User'
37
47
  desc 'Creates a new project owned by the specified user [user id, params]'
@@ -42,7 +52,10 @@ module LabClient
42
52
  client.request(:post, "projects/user/#{user_id}", Project, query)
43
53
  end
44
54
 
55
+ # TODO: Test Project/Group Creation
56
+ # TODO: Create helper for group
45
57
  def create(query = {})
58
+ format_query_id(:namespace_id, query)
46
59
  client.request(:post, 'projects', Project, query)
47
60
  end
48
61
  end
@@ -28,11 +28,9 @@ module LabClient
28
28
  user_attrs %i[user]
29
29
 
30
30
  help do
31
- @group_name = 'Projects'
32
- subtitle 'ProjectDeployment'
31
+ subtitle 'Project Deployment'
33
32
  option 'project', 'Show Project'
34
33
  option 'update', 'Update this deployment [Hash]'
35
- option 'delete', 'Delete this deployment'
36
34
  option 'stop', 'Stop this deployment'
37
35
  end
38
36
  end
@@ -33,7 +33,6 @@ module LabClient
33
33
  date_time_attrs %i[created_at]
34
34
 
35
35
  help do
36
- @group_name = 'Projects'
37
36
  subtitle 'ProjectEnvironment'
38
37
  option 'project', 'Show Project'
39
38
  option 'update', 'Update this environment [Hash]'
@@ -2,8 +2,6 @@
2
2
  module LabClient
3
3
  # Specifics
4
4
  class Projects < Common
5
- @group_name = 'Forks'
6
-
7
5
  doc 'Associate' do
8
6
  desc 'Create a forked from/to relation between existing projects [Target ID, Source ID]'
9
7
  example 'client.projects.fork_existing(309, 10)'
@@ -2,7 +2,7 @@
2
2
  module LabClient
3
3
  # Specifics
4
4
  class Projects < Common
5
- @group_name = 'Forks'
5
+ @group_name = 'Project Forks'
6
6
 
7
7
  doc 'Create' do
8
8
  desc 'Forks a project into the user namespace of the authenticated user or the one provided.'
@@ -2,7 +2,6 @@
2
2
  module LabClient
3
3
  # Specifics
4
4
  class Projects < Common
5
- @group_name = 'Forks'
6
5
  doc 'List' do
7
6
  desc 'List the projects accessible to the calling user that have an established, forked relationship with the specified project'
8
7
  example 'client.projects.forks(299)'
@@ -2,7 +2,6 @@
2
2
  module LabClient
3
3
  # Specifics
4
4
  class Projects < Common
5
- @group_name = 'Forks'
6
5
  doc 'Remove' do
7
6
  desc 'Delete an existing forked from relationship [Project ID]'
8
7
  example 'client.projects.fork_remove(309)'
@@ -22,7 +22,6 @@ module LabClient
22
22
  date_time_attrs %i[created_at]
23
23
 
24
24
  help do
25
- @group_name = 'Projects'
26
25
  subtitle 'ProjectHook'
27
26
  option 'project', 'Show Project'
28
27
  option 'update', 'Update this hook [Hash]'
@@ -43,7 +43,6 @@ module LabClient
43
43
  end
44
44
 
45
45
  help do
46
- @group_name = 'Projects'
47
46
  subtitle 'ProjectLabel'
48
47
  option 'project', 'Show Project'
49
48
  option 'update', 'Update this label [Hash]'
@@ -75,10 +75,15 @@ module LabClient
75
75
  update_self(client.projects.fork_existing(id, target_id))
76
76
  end
77
77
 
78
+ # Issues
78
79
  def issues(query = {})
79
80
  client.issues.project_issues(id, query)
80
81
  end
81
82
 
83
+ def issue_create(query)
84
+ client.issues.create(id, query)
85
+ end
86
+
82
87
  # Hooks
83
88
  def hooks
84
89
  client.projects.hooks.list(id)
@@ -21,7 +21,6 @@ module LabClient
21
21
  date_time_attrs %i[last_update_started_at last_successful_update_at]
22
22
 
23
23
  help do
24
- @group_name = 'Projects'
25
24
  subtitle 'ProjectMirror'
26
25
  option 'project', 'Show Project'
27
26
  option 'update', 'Update this Mirror [Hash]'
@@ -12,7 +12,10 @@ module LabClient
12
12
  option 'fork_remove', 'Remove Fork Relationshgip'
13
13
  option 'fork', 'Fork this project, accepts hash, [namespace, path, name]'
14
14
  option 'forks', 'List forks of this project'
15
+
16
+ # Issues
15
17
  option 'issues', 'List project issues [Hash]'
18
+ option 'issue_create', 'Create a new issue in this project [Hash]'
16
19
 
17
20
  option 'housekeeping', 'Start the Housekeeping'
18
21
  option 'languages', 'Get percentage value of languages used.'
@@ -32,7 +32,6 @@ module LabClient
32
32
  date_time_attrs %i[created_at release_linkd_at]
33
33
 
34
34
  help do
35
- @group_name = 'Projects'
36
35
  subtitle 'ProjectRelease'
37
36
  option 'project', 'Show Project'
38
37
  option 'update', 'Update this release link [Hash]'
@@ -46,7 +46,6 @@ module LabClient
46
46
  date_time_attrs %i[created_at released_at]
47
47
 
48
48
  help do
49
- @group_name = 'Projects'
50
49
  subtitle 'ProjectRelease'
51
50
  option 'project', 'Show Project'
52
51
  option 'update', 'Update this release [Hash]'
@@ -27,7 +27,6 @@ module LabClient
27
27
  date_time_attrs %i[created_at updated_at]
28
28
 
29
29
  help do
30
- @group_name = 'Projects'
31
30
  subtitle 'ProjectService'
32
31
  option 'project', 'Show Project'
33
32
  option 'update', 'Update this service [Hash]'
@@ -2,8 +2,6 @@
2
2
  module LabClient
3
3
  # Specifics
4
4
  class Projects < Common
5
- @group_name = 'Stars'
6
-
7
5
  doc 'Star' do
8
6
  desc 'Stars a given project'
9
7
  example 'client.projects.star(10)'
@@ -2,8 +2,6 @@
2
2
  module LabClient
3
3
  # Specifics
4
4
  class Projects < Common
5
- @group_name = 'Stars'
6
-
7
5
  doc 'List' do
8
6
  desc 'Get a list of projects starred by the given user. [user id]'
9
7
  example 'client.projects.starred(5)'
@@ -2,7 +2,7 @@
2
2
  module LabClient
3
3
  # Specifics
4
4
  class Projects < Common
5
- @group_name = 'Stars'
5
+ @group_name = 'Project Stars'
6
6
 
7
7
  doc 'Starrers' do
8
8
  desc 'List the users who starred the specified project. [user id]'
@@ -22,7 +22,6 @@ module LabClient
22
22
  user_attrs %i[owner]
23
23
 
24
24
  help do
25
- @group_name = 'Projects'
26
25
  subtitle 'ProjectTrigger'
27
26
  option 'project', 'Show Project'
28
27
  option 'update', 'Update this variable [Hash]'
@@ -31,7 +31,6 @@ module LabClient
31
31
  end
32
32
 
33
33
  help do
34
- @group_name = 'Projects'
35
34
  subtitle 'ProjectVariable'
36
35
  option 'project', 'Show Project'
37
36
  option 'update', 'Update this variable [Hash]'
@@ -1,3 +1,3 @@
1
1
  module LabClient
2
- VERSION = '0.1.0'.freeze
2
+ VERSION = '0.1.1'.freeze
3
3
  end
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.0
4
+ version: 0.1.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-05-23 00:00:00.000000000 Z
11
+ date: 2020-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -442,6 +442,7 @@ files:
442
442
  - lib/labclient/groups/runners.rb
443
443
  - lib/labclient/groups/search.rb
444
444
  - lib/labclient/groups/show.rb
445
+ - lib/labclient/groups/stub.rb
445
446
  - lib/labclient/groups/subgroups.rb
446
447
  - lib/labclient/groups/transfer.rb
447
448
  - lib/labclient/groups/update.rb