class SemaphoreClient::Api::Team

Public Class Methods

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

Public Instance Methods

create_for_org(org_id, params = nil, options = {}) click to toggle source
# File lib/semaphore_client/api/team.rb, line 22
def create_for_org(org_id, params = nil, options = {})
  create_for_org!(org_id, params, options)
rescue SemaphoreClient::Exceptions::ResponseError
end
create_for_org!(org_id, params = nil, options = {}) click to toggle source
# File lib/semaphore_client/api/team.rb, line 27
def create_for_org!(org_id, params = nil, options = {})
  path = "/orgs/#{org_id}/teams"
  response = @http_client.post(path, params, options)

  SemaphoreClient::Model::Team.load(response.body)
end
delete(id, params = nil, options = {}) click to toggle source
# File lib/semaphore_client/api/team.rb, line 50
def delete(id, params = nil, options = {})
  delete!(id, params, options)
rescue SemaphoreClient::Exceptions::ResponseError
end
delete!(id, params = nil, options = {}) click to toggle source
# File lib/semaphore_client/api/team.rb, line 55
def delete!(id, params = nil, options = {})
  path = "/teams/#{id}"

  @http_client.delete(path, params)
end
get(id, params = nil, options = {}) click to toggle source
# File lib/semaphore_client/api/team.rb, line 36
def get(id, params = nil, options = {})
  get!(id, params, options)
rescue SemaphoreClient::Exceptions::ResponseError
end
get!(id, params = nil, options = {}) click to toggle source
# File lib/semaphore_client/api/team.rb, line 41
def get!(id, params = nil, options = {})
  path = "/teams/#{id}"
  response = @http_client.get(path, params = {})

  SemaphoreClient::Model::Team.load(response.body)
end
list_for_org(org_id, params = nil, options = {}) click to toggle source
# File lib/semaphore_client/api/team.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/team.rb, line 14
def list_for_org!(org_id, params = nil, options = {})
  path = "/orgs/#{org_id}/teams"

  @http_client.get(path, params, options = {}).body.map { |e| SemaphoreClient::Model::Team.load(e) }
end
list_for_project(project_id, params = nil, options = {}) click to toggle source
# File lib/semaphore_client/api/team.rb, line 77
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/team.rb, line 82
def list_for_project!(project_id, params = nil, options = {})
  path = "/projects/#{project_id}/teams"

  @http_client.get(path, params, options = {}).body.map { |e| SemaphoreClient::Model::Team.load(e) }
end
list_for_secret(secret_id, params = nil, options = {}) click to toggle source
# File lib/semaphore_client/api/team.rb, line 90
def list_for_secret(secret_id, params = nil, options = {})
  list_for_secret!(secret_id, params, options)
rescue SemaphoreClient::Exceptions::ResponseError
end
list_for_secret!(secret_id, params = nil, options = {}) click to toggle source
# File lib/semaphore_client/api/team.rb, line 95
def list_for_secret!(secret_id, params = nil, options = {})
  path = "/secrets/#{secret_id}/teams"

  @http_client.get(path, params, options = {}).body.map { |e| SemaphoreClient::Model::Team.load(e) }
end
update(id, params = nil, options = {}) click to toggle source
# File lib/semaphore_client/api/team.rb, line 63
def update(id, params = nil, options = {})
  update!(id, params, options)
rescue SemaphoreClient::Exceptions::ResponseError
end
update!(id, params = nil, options = {}) click to toggle source
# File lib/semaphore_client/api/team.rb, line 68
def update!(id, params = nil, options = {})
  path = "/teams/#{id}"
  response = @http_client.patch(path, params)

  SemaphoreClient::Model::Team.load(response.body)
end