class OpsDeploy::CLI::GitHub
Attributes
deployment_info[RW]
token[RW]
Public Class Methods
new(token, deployment_info)
click to toggle source
# File lib/ops_deploy/cli/github.rb, line 4 def initialize(token, deployment_info) self.token = token self.deployment_info = deployment_info end
Public Instance Methods
create_deployment_status(state)
click to toggle source
# File lib/ops_deploy/cli/github.rb, line 9 def create_deployment_status(state) return unless valid? owner, repo = deployment_info[:owner], deployment_info[:repo] deployment_id = deployment_info[:deployment_id] url = "https://api.github.com/repos/#{owner}/#{repo}/deployments/#{deployment_id}" client = Octokit::Client.new(access_token: token) client.create_deployment_status(url, state, deployment_info[:options]) self.deployment_info = nil end
valid?()
click to toggle source
# File lib/ops_deploy/cli/github.rb, line 22 def valid? token && deployment_info && deployment_info[:owner] && deployment_info[:repo] && deployment_info[:deployment_id] end