class Loadrunner::GithubAPI
Communicate with GitHub
Public Instance Methods
status(repo, sha, opts={})
click to toggle source
Send status update to a pull request. Supported options:
-
state
: :pending, :success, :failure or :error -
context
: any string -
description
: any string -
target_url
: any valid URL
# File lib/loadrunner/github_api.rb, line 15 def status(repo, sha, opts={}) # sha = '018b0ac55dbf0d8e1eef6df46e04dfef8bea9b96' message = { body: { state: (opts[:state] ? opts[:state].to_s : 'pending'), context: (opts[:context] || 'Loadrunner'), description: opts[:description], target_url: opts[:target_url] }.to_json } self.class.post "/repos/#{repo}/statuses/#{sha}", message.merge(request_options) end
Private Instance Methods
headers()
click to toggle source
# File lib/loadrunner/github_api.rb, line 36 def headers { "Authorization" => "token #{secret_token}", "User-Agent" => "Loadrunner" } end
request_options()
click to toggle source
# File lib/loadrunner/github_api.rb, line 30 def request_options { headers: headers } end
secret_token()
click to toggle source
# File lib/loadrunner/github_api.rb, line 43 def secret_token ENV['GITHUB_ACCESS_TOKEN'] end