Class: LabClient::ProjectAccessRequests

Inherits:
Common
  • Object
show all
Includes:
ClassHelpers
Defined in:
lib/labclient/projects/access_requests/deny.rb,
lib/labclient/projects/access_requests/list.rb,
lib/labclient/projects/access_requests/client.rb,
lib/labclient/projects/access_requests/create.rb,
lib/labclient/projects/access_requests/approve.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 included from ClassHelpers

#has?, #keys, #raw

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

#approve(project_id, user_id, access_level = :developer) ⇒ Object



28
29
30
31
32
33
34
35
36
# File 'lib/labclient/projects/access_requests/approve.rb', line 28

def approve(project_id, user_id, access_level = :developer)
  project_id = format_id(project_id)
  user_id = format_id(user_id)

  query = { access_level: access_level }
  query_access_level(query, :access_level)

  client.request(:put, "projects/#{project_id}/access_requests/#{user_id}/approve", ProjectAccessRequest, query)
end

#create(project_id) ⇒ Object



20
21
22
23
# File 'lib/labclient/projects/access_requests/create.rb', line 20

def create(project_id)
  project_id = format_id(project_id)
  client.request(:post, "projects/#{project_id}/access_requests", ProjectAccessRequest)
end

#deny(project_id, user_id) ⇒ Object



18
19
20
21
22
23
# File 'lib/labclient/projects/access_requests/deny.rb', line 18

def deny(project_id, user_id)
  project_id = format_id(project_id)
  user_id = format_id(user_id)

  client.request(:delete, "projects/#{project_id}/access_requests/#{user_id}/deny")
end

#list(project_id) ⇒ Object



18
19
20
21
22
# File 'lib/labclient/projects/access_requests/list.rb', line 18

def list(project_id)
  project_id = format_id(project_id)

  client.request(:get, "projects/#{project_id}/access_requests", ProjectAccessRequest)
end