mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2025-11-08 17:04:23 -05:00
Update qbo.rb
This commit is contained in:
@@ -37,12 +37,12 @@ class Qbo < ActiveRecord::Base
|
|||||||
access_token = OAuth2::AccessToken.new(oauth2_client, account.qb_secret, refresh_token: account.qb_secret)
|
access_token = OAuth2::AccessToken.new(oauth2_client, account.qb_secret, refresh_token: account.qb_secret)
|
||||||
|
|
||||||
#save the access
|
#save the access
|
||||||
if expire.nil?
|
if self.expire.nil?
|
||||||
token = access_token
|
self.token = access_token
|
||||||
expire = 1.hour.from_now.utc
|
self.expire = 1.hour.from_now.utc
|
||||||
save!
|
self.save!
|
||||||
else
|
else
|
||||||
if expire.to_date.past?
|
if self.expire.to_date.past?
|
||||||
new_access_token_object = access_token.refresh!
|
new_access_token_object = access_token.refresh!
|
||||||
self.token = new_access_token_object
|
self.token = new_access_token_object
|
||||||
self.expire = 1.hour.from_now.utc
|
self.expire = 1.hour.from_now.utc
|
||||||
|
|||||||
Reference in New Issue
Block a user