Added sync functionality to Item and Employee

This commit is contained in:
2016-01-07 15:52:52 -05:00
parent fa230a400e
commit c666f41d68
4 changed files with 34 additions and 2 deletions

View File

@@ -1,3 +1,17 @@
class QboEmployee < ActiveRecord::Base
unloadable
attr_accessible :name
def self.update_all
qbo = Qbo.first
service = Quickbooks::Service::Employee.new(:company_id => qbo.realmId, :access_token => Qbo.get_auth_token)
# Update the item table
service.all.each { |employee|
qbo_employee = QboEmployee.find_or_create_by(id: employee.id)
qbo_employee.name = employee.display_name
qbo_employee.save!
}
end
end