class CC::Service::HipChat

Constants

BASE_URL

Public Instance Methods

receive_coverage() click to toggle source
# File lib/cc/services/hipchat.rb, line 26
def receive_coverage
  speak(formatter.format_coverage, color)
end
receive_quality() click to toggle source
# File lib/cc/services/hipchat.rb, line 30
def receive_quality
  speak(formatter.format_quality, color)
end
receive_test() click to toggle source
# File lib/cc/services/hipchat.rb, line 20
def receive_test
  speak(formatter.format_test, "green").merge(
    message: "Test message sent",
  )
end
receive_vulnerability() click to toggle source
# File lib/cc/services/hipchat.rb, line 34
def receive_vulnerability
  speak(formatter.format_vulnerability, "red")
end

Private Instance Methods

formatter() click to toggle source
# File lib/cc/services/hipchat.rb, line 40
def formatter
  CC::Formatters::LinkedFormatter.new(self, prefix: nil, link_style: :html)
end
speak(message, color) click to toggle source
# File lib/cc/services/hipchat.rb, line 44
def speak(message, color)
  url = "#{BASE_URL}/rooms/message"
  params = {
    from:       "Code Climate",
    message:    message,
    auth_token: config.auth_token,
    room_id:    config.room_id,
    notify:     !!config.notify,
    color:      color,
  }
  service_post(url, params)
end