module Octokit::Client::Deployments

Methods for the Deployments API

@see developer.github.com/v3/repos/commits/deployments/

Public Instance Methods

create_deployment(repo, ref, options = {}) click to toggle source

Create a deployment for a ref

@param repo [Integer, String, Repository, Hash] A GitHub repository @param ref [String] The ref to deploy @option options [String] :task Used by the deployment system to allow different execution paths. Defaults to “deploy”. @option options [String] :payload Meta info about the deployment @option options [Boolean] :auto_merge Optional parameter to merge the default branch into the requested deployment branch if necessary. Default: true @option options [Array<String>] :required_contexts Optional array of status contexts verified against commit status checks. @option options [String] :environment Optional name for the target deployment environment (e.g., production, staging, qa). Default: “production” @option options [String] :description Optional short description. @return [Sawyer::Resource] A deployment @see developer.github.com/v3/repos/deployments/#create-a-deployment

# File lib/octokit/client/deployments.rb, line 41
def create_deployment(repo, ref, options = {})
  options[:ref] = ref
  post("#{Repository.path repo}/deployments", options)
end
create_deployment_status(deployment_url, state, options = {}) click to toggle source

Create a deployment status for a Deployment

@param deployment_url [String] A URL for a deployment resource @param state [String] The state: pending, success, failure, error @option options [String] :target_url The target URL to associate with this status. Default: “” @option options [String] :description A short description of the status. Maximum length of 140 characters. Default: “” @return [Sawyer::Resource] A deployment status @see developer.github.com/v3/repos/deployments/#create-a-deployment-status

# File lib/octokit/client/deployments.rb, line 65
def create_deployment_status(deployment_url, state, options = {})
  deployment = get(deployment_url, :accept => options[:accept])
  options[:state] = state.to_s.downcase
  post(deployment.rels[:statuses].href, options)
end
deployment(repo, deployment_id, options = {}) click to toggle source

Fetch a single deployment for a repository

@param repo [Integer, String, Repository, Hash] A GitHub repository @param deployment_id [Integer, String, Repository, Hash] A GitHub repository @return <Sawyer::Resource> A single deployment @see developer.github.com/v3/repos/deployments/#get-a-single-deployment

# File lib/octokit/client/deployments.rb, line 15
def deployment(repo, deployment_id, options = {})
  get("#{Repository.path repo}/deployments/#{deployment_id}", options)
end
deployment_statuses(deployment_url, options = {}) click to toggle source

List all statuses for a Deployment

@param deployment_url [String] A URL for a deployment resource @return [Array<Sawyer::Resource>] A list of deployment statuses @see developer.github.com/v3/repos/deployments/#list-deployment-statuses

# File lib/octokit/client/deployments.rb, line 51
def deployment_statuses(deployment_url, options = {})
  deployment = get(deployment_url, :accept => options[:accept])
  get(deployment.rels[:statuses].href, options)
end
Also aliased as: list_deployment_statuses
deployments(repo, options = {}) click to toggle source

List all deployments for a repository

@param repo [Integer, String, Repository, Hash] A GitHub repository @return [Array<Sawyer::Resource>] A list of deployments @see developer.github.com/v3/repos/deployments/#list-deployments

# File lib/octokit/client/deployments.rb, line 24
def deployments(repo, options = {})
  get("#{Repository.path repo}/deployments", options)
end
Also aliased as: list_deployments
list_deployment_statuses(deployment_url, options = {})
Alias for: deployment_statuses
list_deployments(repo, options = {})
Alias for: deployments