Class: Cloudfuji::DataController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Cloudfuji::DataController
- Defined in:
- app/controllers/cloudfuji/data_controller.rb
Instance Method Summary collapse
-
#index ⇒ Object
POST /cloudfuji/data/.
Instance Method Details
#index ⇒ Object
POST /cloudfuji/data/
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/controllers/cloudfuji/data_controller.rb', line 5 def index @key = params.delete("key") if ENV["CLOUDFUJI_APP_KEY"] != @key respond_to do |format| format.html { render :layout => false, :text => true, :status => :forbidden } format.json { render :json => {:error => "Not authorized to submit data to this app" }, :status => 401 } end return end puts "Idobus Data rec'd: #{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}" event = "#{params['category']}.#{params['event']}".gsub('.', '_').to_sym Cloudfuji::Data.fire(hook_data, event) respond_to do |format| format.json {render :json => {'acknowledged' => true}, :status => 200} end end |