Class: FlashFlow::Notifier::Hipchat

Inherits:
Object
  • Object
show all
Defined in:
lib/flash_flow/notifier/hipchat.rb

Instance Method Summary collapse

Constructor Details

#initialize(config = {}) ⇒ Hipchat

Returns a new instance of Hipchat.



7
8
9
10
# File 'lib/flash_flow/notifier/hipchat.rb', line 7

def initialize(config={})
  @client = initialize_connection!(config['token'])
  @room = config['room']
end

Instance Method Details

#merge_conflict(branch) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/flash_flow/notifier/hipchat.rb', line 12

def merge_conflict(branch)
  begin
    user_name = branch.['user_url'].split('/').last
    user_url_link = %{<a href="#{branch.['user_url']}">#{user_name}</a>}
    ref_link = %{<a href="#{branch.['repo_url']}/tree/#{branch.ref}">#{branch.ref}</a>}

    message = %{#{user_url_link}'s branch (#{ref_link}) did not merge successfully}
    @client[@room].send("FlashFlow", message)
  rescue HipChat::UnknownResponseCode => e
    puts e.message
  end
end