lib/pubsubstub/publish_action.rb in pubsubstub-0.1.1 vs lib/pubsubstub/publish_action.rb in pubsubstub-0.1.2

- old
+ new

@@ -1,10 +1,14 @@ module Pubsubstub - class PublishAction < Pubsubstub::Action - post '/' do - (params[:channels] || [:default]).each do |channel_name| - Pubsubstub.publish(channel_name, params[:data], name: params[:event]) + class PublishAction + def initialize(*) + end + + def call(env) + request = Rack::Request.new(env) + channels = (request.params['channels'] || [:default]).each do |channel_name| + Pubsubstub.publish(channel_name, request.params['data'], name: request.params['event']) end - "" + [200, {}, ['']] end end end