Class: LoadRunner::GitHubAPI

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/load_runner/git_hub_api.rb

Overview

Communicate with GitHub

Instance Method Summary collapse

Instance Method Details

#status(repo, sha, opts = {}) ⇒ Object

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



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/load_runner/git_hub_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