From 01e5415074dd95d734540ed6b767aef82bb4c975 Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Mon, 1 Aug 2016 20:57:51 -0400 Subject: [PATCH] Update qbo_controller.rb --- app/controllers/qbo_controller.rb | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/app/controllers/qbo_controller.rb b/app/controllers/qbo_controller.rb index 03f13c7..ffeefcd 100644 --- a/app/controllers/qbo_controller.rb +++ b/app/controllers/qbo_controller.rb @@ -70,18 +70,16 @@ class QboController < ApplicationController # application/x-www-form-urlencoded data = params.as_json end - + # Process the information entities = data['eventNotifications'][0]['dataChangeEvent']['entities'] - entities.each do |entity| - id = entity['id'].to_i - name = entity['name'] # TODO rename all other models! name.prepend("Qbo") if not name.eql? "Customer" + # Magicly initialize the correct class obj = name.constantize # for merge events @@ -94,7 +92,6 @@ class QboController < ApplicationController else obj.sync_by_id(id) end - end # Record that last time we updated