mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2025-11-08 17:04:23 -05:00
Update get_base
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user