class SemaphoreClient::Api::Secret

Public Class Methods

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

Public Instance Methods

attach_to_project(secret_id, project_id, params = nil, options = {}) click to toggle source
# File lib/semaphore_client/api/secret.rb, line 88
def attach_to_project(secret_id, project_id, params = nil, options = {})
  attach_to_project!(secret_id, project_id, params, options)
rescue SemaphoreClient::Exceptions::ResponseError
end
attach_to_project!(secret_id, project_id, params = nil, options = {}) click to toggle source
# File lib/semaphore_client/api/secret.rb, line 93
def attach_to_project!(secret_id, project_id, params = nil, options = {})
  path = "/projects/#{project_id}/secrets/#{secret_id}"

  @http_client.post(path, params, options)
end
attach_to_team(secret_id, team_id, params = nil, options = {}) click to toggle source
# File lib/semaphore_client/api/secret.rb, line 49
def attach_to_team(secret_id, team_id, params = nil, options = {})
  attach_to_team!(secret_id, team_id, params, options)
rescue SemaphoreClient::Exceptions::ResponseError
end
attach_to_team!(secret_id, team_id, params = nil, options = {}) click to toggle source
# File lib/semaphore_client/api/secret.rb, line 54
def attach_to_team!(secret_id, team_id, params = nil, options = {})
  path = "/teams/#{team_id}/secrets/#{secret_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/secret.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/secret.rb, line 27
def create_for_org!(org_id, params = nil, options = {})
  path = "/orgs/#{org_id}/secrets"
  response = @http_client.post(path, params, options)

  SemaphoreClient::Model::Secret.load(response.body)
end
delete(id, params = nil, options = {}) click to toggle source
# File lib/semaphore_client/api/secret.rb, line 128
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/secret.rb, line 133
def delete!(id, params = nil, options = {})
  path = "/secrets/#{id}"

  @http_client.delete(path, params)
end
detach_from_project(secret_id, project_id, params = nil, options = {}) click to toggle source
# File lib/semaphore_client/api/secret.rb, line 101
def detach_from_project(secret_id, project_id, params = nil, options = {})
  detach_from_project!(secret_id, project_id, params, options)
rescue SemaphoreClient::Exceptions::ResponseError
end
detach_from_project!(secret_id, project_id, params = nil, options = {}) click to toggle source
# File lib/semaphore_client/api/secret.rb, line 106
def detach_from_project!(secret_id, project_id, params = nil, options = {})
  path = "/projects/#{project_id}/secrets/#{secret_id}"

  @http_client.delete(path, params, options)
end
detach_from_team(secret_id, team_id, params = nil, options = {}) click to toggle source
# File lib/semaphore_client/api/secret.rb, line 62
def detach_from_team(secret_id, team_id, params = nil, options = {})
  detach_from_team!(secret_id, team_id, params, options)
rescue SemaphoreClient::Exceptions::ResponseError
end
detach_from_team!(secret_id, team_id, params = nil, options = {}) click to toggle source
# File lib/semaphore_client/api/secret.rb, line 67
def detach_from_team!(secret_id, team_id, params = nil, options = {})
  path = "/teams/#{team_id}/secrets/#{secret_id}"

  @http_client.delete(path, params, options)
end
get(id, params = nil, options = {}) click to toggle source
# File lib/semaphore_client/api/secret.rb, line 114
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/secret.rb, line 119
def get!(id, params = nil, options = {})
  path = "/secrets/#{id}"
  response = @http_client.get(path, params = {})

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

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

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

  @http_client.get(path, params, options = {}).body.map { |e| SemaphoreClient::Model::Secret.load(e) }
end
update(id, params = nil, options = {}) click to toggle source
# File lib/semaphore_client/api/secret.rb, line 141
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/secret.rb, line 146
def update!(id, params = nil, options = {})
  path = "/secrets/#{id}"
  response = @http_client.patch(path, params)

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