Module: G5AuthenticationClient::AuthTokenHelper
- Defined in:
- lib/g5_authentication_client/auth_token_helper.rb
Instance Method Summary collapse
- #cached_username_pw_access_token ⇒ Object
-
#do_with_username_pw_access_token ⇒ Object
Return response to ‘yield’ Yield response should have a ‘code’ method for the http status code.
Instance Method Details
#cached_username_pw_access_token ⇒ Object
19 20 21 |
# File 'lib/g5_authentication_client/auth_token_helper.rb', line 19 def cached_username_pw_access_token @cached_username_pw_access_token ||= G5AuthenticationClient::Client.new.username_pw_access_token.token end |
#do_with_username_pw_access_token ⇒ Object
Return response to ‘yield’ Yield response should have a ‘code’ method for the http status code
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/g5_authentication_client/auth_token_helper.rb', line 6 def do_with_username_pw_access_token begin response = yield cached_username_pw_access_token rescue RestClient::ExceptionWithResponse => e response = e.response end if response.code.to_i == 401 @cached_username_pw_access_token = nil response = yield cached_username_pw_access_token end response end |