class CC::Service::Campfire

Public Instance Methods

receive_coverage() click to toggle source
# File lib/cc/services/campfire.rb, line 23
def receive_coverage
  speak(formatter.format_coverage)
end
receive_quality() click to toggle source
# File lib/cc/services/campfire.rb, line 27
def receive_quality
  speak(formatter.format_quality)
end
receive_test() click to toggle source
# File lib/cc/services/campfire.rb, line 17
def receive_test
  speak(formatter.format_test).merge(
    message: "Test message sent",
  )
end
receive_vulnerability() click to toggle source
# File lib/cc/services/campfire.rb, line 31
def receive_vulnerability
  speak(formatter.format_vulnerability)
end

Private Instance Methods

formatter() click to toggle source
# File lib/cc/services/campfire.rb, line 37
def formatter
  CC::Formatters::PlainFormatter.new(self)
end
speak(line) click to toggle source
# File lib/cc/services/campfire.rb, line 41
def speak(line)
  http.headers["Content-Type"] = "application/json"
  params = { message: { body: line } }

  http.basic_auth(config.token, "X")
  service_post(speak_uri, params.to_json)
end
speak_uri() click to toggle source
# File lib/cc/services/campfire.rb, line 49
def speak_uri
  subdomain = config.subdomain
  room_id = config.room_id
  "https://#{subdomain}.campfirenow.com/room/#{room_id}/speak.json"
end