class SemaphoreClient::Api::User

Public Class Methods

new(http_client) click to toggle source
# File lib/semaphore_client/api/user.rb, line 4
def initialize(http_client)
  @http_client = http_client
end

Public Instance Methods

attach_to_team(user_id, team_id, params = nil, options = {}) click to toggle source
# File lib/semaphore_client/api/user.rb, line 35
def attach_to_team(user_id, team_id, params = nil, options = {})
  attach_to_team!(user_id, team_id, params, options)
rescue SemaphoreClient::Exceptions::ResponseError
end
attach_to_team!(user_id, team_id, params = nil, options = {}) click to toggle source
# File lib/semaphore_client/api/user.rb, line 40
def attach_to_team!(user_id, team_id, params = nil, options = {})
  path = "/teams/#{team_id}/users/#{user_id}"

  @http_client.post(path, params, options)
end
detach_from_team(user_id, team_id, params = nil, options = {}) click to toggle source
# File lib/semaphore_client/api/user.rb, line 48
def detach_from_team(user_id, team_id, params = nil, options = {})
  detach_from_team!(user_id, team_id, params, options)
rescue SemaphoreClient::Exceptions::ResponseError
end
detach_from_team!(user_id, team_id, params = nil, options = {}) click to toggle source
# File lib/semaphore_client/api/user.rb, line 53
def detach_from_team!(user_id, team_id, params = nil, options = {})
  path = "/teams/#{team_id}/users/#{user_id}"

  @http_client.delete(path, params, options)
end
list_for_org(org_id, params = nil, options = {}) click to toggle source
# File lib/semaphore_client/api/user.rb, line 9
def list_for_org(org_id, params = nil, options = {})
  list_for_org!(org_id, params, options)
rescue SemaphoreClient::Exceptions::ResponseError
end
list_for_org!(org_id, params = nil, options = {}) click to toggle source
# File lib/semaphore_client/api/user.rb, line 14
def list_for_org!(org_id, params = nil, options = {})
  path = "/orgs/#{org_id}/users"

  @http_client.get(path, params, options = {}).body.map { |e| SemaphoreClient::Model::User.load(e) }
end
list_for_project(project_id, params = nil, options = {}) click to toggle source
# File lib/semaphore_client/api/user.rb, line 61
def list_for_project(project_id, params = nil, options = {})
  list_for_project!(project_id, params, options)
rescue SemaphoreClient::Exceptions::ResponseError
end
list_for_project!(project_id, params = nil, options = {}) click to toggle source
# File lib/semaphore_client/api/user.rb, line 66
def list_for_project!(project_id, params = nil, options = {})
  path = "/projects/#{project_id}/users"

  @http_client.get(path, params, options = {}).body.map { |e| SemaphoreClient::Model::User.load(e) }
end
list_for_team(team_id, params = nil, options = {}) click to toggle source
# File lib/semaphore_client/api/user.rb, line 22
def list_for_team(team_id, params = nil, options = {})
  list_for_team!(team_id, params, options)
rescue SemaphoreClient::Exceptions::ResponseError
end
list_for_team!(team_id, params = nil, options = {}) click to toggle source
# File lib/semaphore_client/api/user.rb, line 27
def list_for_team!(team_id, params = nil, options = {})
  path = "/teams/#{team_id}/users"

  @http_client.get(path, params, options = {}).body.map { |e| SemaphoreClient::Model::User.load(e) }
end