class Crow
Public Class Methods
croack(user_id, message_body, message_type=nil)
click to toggle source
# File lib/crow.rb, line 6 def self.croack(user_id, message_body, message_type=nil) uri = URI.parse("#{ENV.fetch('CROW_HOST')}:#{ENV.fetch('CROW_PORT')}/notifications") header = {'Content-Type': 'application/json'} notification = { user_id: user_id, body: message_body, type: message_type } http = Net::HTTP.new(uri.host, uri.port) request = Net::HTTP::Post.new(uri.request_uri, header) request.body = notification.to_json response = http.request(request) end