lib/zoho_hub/connection.rb in zoho_hub-0.1.8 vs lib/zoho_hub/connection.rb in zoho_hub-0.1.9
- old
+ new
@@ -46,15 +46,15 @@
response = with_refresh { adapter.put(path, params) }
response.body
end
def access_token?
- @access_token.present?
+ @access_token
end
def refresh_token?
- @refresh_token.present?
+ @refresh_token
end
def log(text)
return unless ZohoHub.configuration.debug?
@@ -71,10 +71,10 @@
# Try to refresh the token and try again
if response.invalid_token? && refresh_token?
log "Refreshing outdated token... #{@access_token}"
params = ZohoHub::Auth.refresh_token(@refresh_token)
- @on_refresh_cb.call(params) if @on_refresh_cb.present?
+ @on_refresh_cb&.call(params)
@access_token = params[:access_token]
http_response = yield
elsif response.authentication_failure?