Class: BuildBuddy::Gitter

Inherits:
Object
  • Object
show all
Includes:
Celluloid, Celluloid::Internals::Logger
Defined in:
lib/build_buddy/gitter.rb

Instance Method Summary collapse

Constructor Details

#initializeGitter

Returns a new instance of Gitter.



12
13
14
15
# File 'lib/build_buddy/gitter.rb', line 12

def initialize()
  @gh_client ||= Octokit::Client.new(:access_token => Config.github_api_token)
  info "Connected to Github"
end

Instance Method Details

#set_status(repo_full_name, repo_sha, state, description, target_url) ⇒ Object

state is one of :pending, :killed, :failure, :error, :success



18
19
20
21
22
23
24
25
# File 'lib/build_buddy/gitter.rb', line 18

def set_status(repo_full_name, repo_sha, state, description, target_url)
  options = {
    :description => description.length > 140 ? "#{description[0..136]}..." : description,
    :context => 'build-buddy',
    :target_url => target_url || ''
  }
  @gh_client.create_status(repo_full_name, repo_sha, state.to_s, options)
end