Sha256: fe65bdaace56648eb07295a2a49e71b42e6a14dd3c83173a6dfeda8c83ad6624

Contents?: true

Size: 931 Bytes

Versions: 5

Compression:

Stored size: 931 Bytes

Contents

module Bushido
  class DataController < ApplicationController
    
    # POST /bushido/data/
    def index
      @key = params.delete("key")
      if ENV["BUSHIDO_APP_KEY"] != @key
        respond_to do |format|
          format.html { render :layout => false, :text => true, :status => :forbidden }
          format.json { render :status => 401 }
          return
        end
      end
      
      puts "Bushibus Data rec'd"
      puts params.inspect
      puts params["category"].inspect

      hook_data             = {}
      hook_data["category"] = params["category"]
      hook_data["event"]    = params["event"]
      hook_data["data"]     = params["data"]

      puts "Firing with: #{hook_data.inspect}"

      Bushido::Data.fire(hook_data, "#{params['category']}.#{params['event']}")

      respond_to do |format|
        format.json {render :json => {'acknowledged' => true}, :status => 200}
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
bushido-0.0.35 app/controllers/bushido/data_controller.rb
bushido-0.0.34 app/controllers/bushido/data_controller.rb
bushido-0.0.33 app/controllers/bushido/data_controller.rb
bushido-0.0.32 app/controllers/bushido/data_controller.rb
bushido-0.0.31 app/controllers/bushido/data_controller.rb