Class: LabClient::Groups

Inherits:
Common
  • Object
show all
Defined in:
lib/labclient/groups/list.rb,
lib/labclient/groups/show.rb,
lib/labclient/groups/stub.rb,
lib/labclient/groups/create.rb,
lib/labclient/groups/delete.rb,
lib/labclient/groups/search.rb,
lib/labclient/groups/update.rb,
lib/labclient/groups/restore.rb,
lib/labclient/groups/runners.rb,
lib/labclient/groups/projects.rb,
lib/labclient/groups/transfer.rb,
lib/labclient/groups/subgroups.rb,
lib/labclient/groups/ldap/client.rb,
lib/labclient/groups/hooks/client.rb,
lib/labclient/groups/badges/client.rb,
lib/labclient/groups/labels/client.rb,
lib/labclient/groups/clusters/client.rb,
lib/labclient/groups/milestones/client.rb,
lib/labclient/groups/access_requests/client.rb

Overview

Specifics

Constant Summary

Constants included from AccessLevel

AccessLevel::HUMAN_ACCESS_LEVELS, AccessLevel::MACHINE_ACCESS_LEVELS

Instance Attribute Summary

Attributes inherited from Common

#client

Instance Method Summary collapse

Methods inherited from Common

#api_methods, #api_methods_help, #format_id, #format_query_id, #format_query_ids, #format_time?, #group_name, #help, #initialize, #inspect, #klass, #protected_query_access_level, #query_access_level, #query_format_time

Methods included from Docs

#demo, #desc, #doc, docs, #example, #group_name, #help, json, #markdown, #navigation, #option, #result, #subtitle, #title

Methods included from AccessLevel

#human_access_level, #human_protected_access_level, #machine_access_level, #machine_protected_access_level

Constructor Details

This class inherits a constructor from LabClient::Common

Instance Method Details

#access_requestsObject



13
14
15
# File 'lib/labclient/groups/access_requests/client.rb', line 13

def access_requests
  GroupAccessRequests.new(client)
end

#badgesObject



13
14
15
# File 'lib/labclient/groups/badges/client.rb', line 13

def badges
  GroupBadges.new(client)
end

#clustersObject



13
14
15
# File 'lib/labclient/groups/clusters/client.rb', line 13

def clusters
  GroupClusters.new(client)
end

#create(query = {}) ⇒ Object



27
28
29
# File 'lib/labclient/groups/create.rb', line 27

def create(query = {})
  client.request(:post, 'groups', Group, query)
end

#delete(group_id) ⇒ Object



19
20
21
22
23
# File 'lib/labclient/groups/delete.rb', line 19

def delete(group_id)
  group_id = format_id(group_id)

  client.request(:delete, "groups/#{group_id}", nil)
end

#hooksObject



13
14
15
# File 'lib/labclient/groups/hooks/client.rb', line 13

def hooks
  GroupHooks.new(client)
end

#labelsObject



13
14
15
# File 'lib/labclient/groups/labels/client.rb', line 13

def labels
  GroupLabels.new(client)
end

#ldapObject



14
15
16
# File 'lib/labclient/groups/ldap/client.rb', line 14

def ldap
  GroupLdap.new(client)
end

#list(query = {}) ⇒ Object



70
71
72
73
74
# File 'lib/labclient/groups/list.rb', line 70

def list(query = {})
  query_access_level(query, :min_access_level)

  client.request(:get, 'groups', Group, query)
end

#milestonesObject



13
14
15
# File 'lib/labclient/groups/milestones/client.rb', line 13

def milestones
  GroupMilestones.new(client)
end

#projects(group_id, query = {}) ⇒ Object



43
44
45
46
47
48
49
50
51
52
# File 'lib/labclient/groups/projects.rb', line 43

def projects(group_id, query = {})
  group_id = format_id(group_id)

  # Map Skip Groups
  format_query_ids(:skip_groups, query)

  query_access_level(query, :min_access_level)

  client.request(:get, "groups/#{group_id}/projects", Project, query)
end

#restore(group_id) ⇒ Object



20
21
22
23
24
# File 'lib/labclient/groups/restore.rb', line 20

def restore(group_id)
  group_id = format_id(group_id)

  client.request(:post, "groups/#{group_id}/restore", Group)
end

#runners(group_id, query = {}) ⇒ Object



28
29
30
31
# File 'lib/labclient/groups/runners.rb', line 28

def runners(group_id, query = {})
  group_id = format_id(group_id)
  client.request(:get, "groups/#{group_id}/runners", Runner, query)
end

#search(search_string = '') ⇒ Object

Search Groups



63
64
65
66
67
68
69
# File 'lib/labclient/groups/search.rb', line 63

def search(search_string = '')
  query = {
    search: search_string
  }

  client.request(:get, 'groups', Group, query)
end

#search_within(group_id, scope, search_string = '') ⇒ Object

Search All Projects



51
52
53
54
55
56
57
58
59
60
# File 'lib/labclient/groups/search.rb', line 51

def search_within(group_id, scope, search_string = '')
  group_id = format_id(group_id)

  scope = scope.to_sym # Case Simplicity
  query = { scope: scope, search: search_string }

  klass = klass_type(scope)

  client.request(:get, "groups/#{group_id}/search", klass, query)
end

#show(group_id, query = {}) ⇒ Object



31
32
33
34
35
# File 'lib/labclient/groups/show.rb', line 31

def show(group_id, query = {})
  group_id = format_id(group_id)

  client.request(:get, "groups/#{group_id}", Group, query)
end

#subgroups(group_id, query = {}) ⇒ Object



36
37
38
39
40
41
42
43
44
45
# File 'lib/labclient/groups/subgroups.rb', line 36

def subgroups(group_id, query = {})
  group_id = format_id(group_id)

  # Map Skip Groups
  format_query_ids(:skip_groups, query)

  query_access_level(query, :min_access_level)

  client.request(:get, "groups/#{group_id}/subgroups", Group, query)
end

#transfer(group_id, project_id) ⇒ Object



20
21
22
23
24
25
# File 'lib/labclient/groups/transfer.rb', line 20

def transfer(group_id, project_id)
  group_id = format_id(group_id)
  project_id = format_id(project_id)

  client.request(:post, "groups/#{group_id}/projects/#{project_id}", Project)
end

#update(group_id, query = {}) ⇒ Object



28
29
30
31
32
# File 'lib/labclient/groups/update.rb', line 28

def update(group_id, query = {})
  group_id = format_id(group_id)

  client.request(:put, "groups/#{group_id}", Group, query)
end