class SemaphoreClient::Api::Project

Public Class Methods

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

Public Instance Methods

attach_to_team(project_id, team_id, params = nil, options = {}) click to toggle source
# File lib/semaphore_client/api/project.rb, line 49
def attach_to_team(project_id, team_id, params = nil, options = {})
  attach_to_team!(project_id, team_id, params, options)
rescue SemaphoreClient::Exceptions::ResponseError
end
attach_to_team!(project_id, team_id, params = nil, options = {}) click to toggle source
# File lib/semaphore_client/api/project.rb, line 54
def attach_to_team!(project_id, team_id, params = nil, options = {})
  path = "/teams/#{team_id}/projects/#{project_id}"

  @http_client.post(path, params, options)
end
create_for_org(org_id, params = nil, options = {}) click to toggle source
# File lib/semaphore_client/api/project.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/project.rb, line 27
def create_for_org!(org_id, params = nil, options = {})
  path = "/orgs/#{org_id}/projects"
  response = @http_client.post(path, params, options)

  SemaphoreClient::Model::Project.load(response.body)
end
detach_from_team(project_id, team_id, params = nil, options = {}) click to toggle source
# File lib/semaphore_client/api/project.rb, line 62
def detach_from_team(project_id, team_id, params = nil, options = {})
  detach_from_team!(project_id, team_id, params, options)
rescue SemaphoreClient::Exceptions::ResponseError
end
detach_from_team!(project_id, team_id, params = nil, options = {}) click to toggle source
# File lib/semaphore_client/api/project.rb, line 67
def detach_from_team!(project_id, team_id, params = nil, options = {})
  path = "/teams/#{team_id}/projects/#{project_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/project.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/project.rb, line 14
def list_for_org!(org_id, params = nil, options = {})
  path = "/orgs/#{org_id}/projects"

  @http_client.get(path, params, options = {}).body.map { |e| SemaphoreClient::Model::Project.load(e) }
end
list_for_secret(secret_id, params = nil, options = {}) click to toggle source
# File lib/semaphore_client/api/project.rb, line 75
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/project.rb, line 80
def list_for_secret!(secret_id, params = nil, options = {})
  path = "/secrets/#{secret_id}/projects"

  @http_client.get(path, params, options = {}).body.map { |e| SemaphoreClient::Model::Project.load(e) }
end
list_for_team(team_id, params = nil, options = {}) click to toggle source
# File lib/semaphore_client/api/project.rb, line 36
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/project.rb, line 41
def list_for_team!(team_id, params = nil, options = {})
  path = "/teams/#{team_id}/projects"

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