Class: Failbot::JSONBackend

Inherits:
Object
  • Object
show all
Defined in:
lib/failbot/json_backend.rb

Instance Method Summary collapse

Constructor Details

#initialize(host, port) ⇒ JSONBackend

Returns a new instance of JSONBackend.



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/failbot/json_backend.rb', line 5

def initialize(host, port)
  if host.to_s.empty?
    raise ArgumentError, "FAILBOT_BACKEND_JSON_HOST setting required."
  end
  if port.to_s.empty?
    raise ArgumentError, "FAILBOT_BACKEND_JSON_PORT setting required."
  end

  @host = host
  @port = port
end

Instance Method Details

#report(data) ⇒ Object



17
18
19
20
21
22
# File 'lib/failbot/json_backend.rb', line 17

def report(data)
  @socket = TCPSocket.new @host, @port
  payload = Yajl.dump(data)
  @socket.send(payload, 0)
  @socket.close
end

#reportsObject

Raises:

  • (NotImplementedError)


24
25
26
# File 'lib/failbot/json_backend.rb', line 24

def reports
  raise NotImplementedError
end