Update get_base

This commit is contained in:
2023-12-30 18:53:01 -05:00
parent d6ec34cef9
commit 7a6b6882d2

View File

@@ -18,28 +18,27 @@ class Qbo < ActiveRecord::Base
# @params type of base # @params type of base
# #
def self.get_base(type) def self.get_base(type)
# lets getnourbold access token from the database
oauth2_client = construct_oauth2_client
qbo = self.first qbo = self.first
qbo.perform_authenticated_request do |access_token| qbo.perform_authenticated_request do |access_token|
# build the reqiested service # build the reqiested service
case type case type
when :time_activity when :time_activity
return Quickbooks::Service::TimeActivity.new(:company_id => qbo.company_id, :access_token => access_token) base = Quickbooks::Service::TimeActivity.new(:company_id => qbo.company_id, :access_token => access_token)
when :customer when :customer
return Quickbooks::Service::Customer.new(:company_id => qbo.company_id, :access_token => access_token) return Quickbooks::Service::Customer.new(:company_id => qbo.company_id, :access_token => access_token)
when :invoice when :invoice
return Quickbooks::Service::Invoice.new(:company_id => qbo.company_id, :access_token => access_token) base = Quickbooks::Service::Invoice.new(:company_id => qbo.company_id, :access_token => access_token)
when :estimate when :estimate
return Quickbooks::Service::Estimate.new(:company_id => qbo.company_id, :access_token => access_token) base = Quickbooks::Service::Estimate.new(:company_id => qbo.company_id, :access_token => access_token)
when :employee when :employee
return Quickbooks::Service::Employee.new(:company_id => qbo.company_id, :access_token => access_token) base = Quickbooks::Service::Employee.new(:company_id => qbo.company_id, :access_token => access_token)
else else
return access_token base = access_token
end end
end end
return base
end end
# Updates last sync time stamp # Updates last sync time stamp