Update customer.rb

This commit is contained in:
2016-05-24 12:33:19 -04:00
parent c5296e7c5f
commit 3e0b327ea7

View File

@@ -109,12 +109,10 @@ class Customer < ActiveRecord::Base
query << " Where Metadata.LastUpdatedTime >= '#{last.iso8601}' " if last query << " Where Metadata.LastUpdatedTime >= '#{last.iso8601}' " if last
Qbo.get_base(:customer).service.query(query).each do |customer| Qbo.get_base(:customer).service.query(query).each do |customer|
Customer.transaction do qbo_customer = Customer.find_or_create_by(id: customer.id)
qbo_customer = Customer.find_or_create_by(id: customer.id) qbo_customer.name = customer.display_name
qbo_customer.name = customer.display_name qbo_customer.id = customer.id
qbo_customer.id = customer.id qbo_customer.save_without_push
qbo_customer.save_without_push
end
end end
# remove deleted customers # remove deleted customers
@@ -128,8 +126,8 @@ class Customer < ActiveRecord::Base
end end
# Push the updates # Push the updates
def save_with_push def self.save_with_push
save_without_push self.save_without_push
begin begin
#tries ||= 3 #tries ||= 3
@details = Qbo.get_base(:customer).service.update(@details) @details = Qbo.get_base(:customer).service.update(@details)