Added removal for deleted entery while syncing

Added Invoices & Estimates to QBO#Index
This commit is contained in:
2016-02-28 12:07:58 -05:00
parent 82a273c0c2
commit ad4ce232b5
7 changed files with 78 additions and 9 deletions

View File

@@ -24,12 +24,24 @@ class QboCustomer < ActiveRecord::Base
end
def self.update_all
service = get_base.service
# Update the customer table
get_base.service.all.each { |customer|
service.all.each { |customer|
qbo_customer = QboCustomer.find_or_create_by(id: customer.id)
qbo_customer.id = customer.id
qbo_customer.name = customer.display_name
qbo_customer.save!
}
#remove deleted customers
all.each { |customer|
begin
service.fetch_by_id(customer.id)
rescue
delete_all(id: customer.id)
end
}
end
end