mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2025-11-08 17:04:23 -05:00
Update qbo_controller.rb
This commit is contained in:
@@ -70,18 +70,16 @@ class QboController < ApplicationController
|
|||||||
# application/x-www-form-urlencoded
|
# application/x-www-form-urlencoded
|
||||||
data = params.as_json
|
data = params.as_json
|
||||||
end
|
end
|
||||||
|
# Process the information
|
||||||
entities = data['eventNotifications'][0]['dataChangeEvent']['entities']
|
entities = data['eventNotifications'][0]['dataChangeEvent']['entities']
|
||||||
|
|
||||||
entities.each do |entity|
|
entities.each do |entity|
|
||||||
|
|
||||||
id = entity['id'].to_i
|
id = entity['id'].to_i
|
||||||
|
|
||||||
name = entity['name']
|
name = entity['name']
|
||||||
|
|
||||||
# TODO rename all other models!
|
# TODO rename all other models!
|
||||||
name.prepend("Qbo") if not name.eql? "Customer"
|
name.prepend("Qbo") if not name.eql? "Customer"
|
||||||
|
|
||||||
|
# Magicly initialize the correct class
|
||||||
obj = name.constantize
|
obj = name.constantize
|
||||||
|
|
||||||
# for merge events
|
# for merge events
|
||||||
@@ -94,7 +92,6 @@ class QboController < ApplicationController
|
|||||||
else
|
else
|
||||||
obj.sync_by_id(id)
|
obj.sync_by_id(id)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Record that last time we updated
|
# Record that last time we updated
|
||||||
|
|||||||
Reference in New Issue
Block a user