Module: QQQ::API

Defined in:
lib/qqq/api.rb

Class Method Summary collapse

Class Method Details

.publish(event) ⇒ Object

desc :send, “Sends message to a remote server” def send

QQQ.subscribe do |event|
  puts "Remotely publishing: #{event.message}"
  API.publish(event)
end

end



14
15
16
17
18
# File 'lib/qqq/api.rb', line 14

def self.publish(event)
  conn = Faraday.new(:url => "http://localhost:3600")
  resp = conn.post '/events', { :event => event.as_json }
  puts resp.status, resp.body
end