Class: Google::Auth::Extras::StaticCredential
- Inherits:
-
Signet::OAuth2::Client
- Object
- Signet::OAuth2::Client
- Google::Auth::Extras::StaticCredential
- Defined in:
- lib/google/auth/extras/static_credential.rb
Overview
This credential uses a static access token.
Defined Under Namespace
Classes: AuthorizationExpired
Instance Attribute Summary collapse
-
#quota_project_id ⇒ Object
readonly
Returns the value of attribute quota_project_id.
Instance Method Summary collapse
- #fetch_access_token ⇒ Object
-
#initialize(access_token:, quota_project_id: nil, universe_domain: 'googleapis.com') ⇒ StaticCredential
constructor
A credential using a static access token.
- #inspect ⇒ Object
Constructor Details
#initialize(access_token:, quota_project_id: nil, universe_domain: 'googleapis.com') ⇒ StaticCredential
A credential using a static access token.
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/google/auth/extras/static_credential.rb', line 25 def initialize(access_token:, quota_project_id: nil, universe_domain: 'googleapis.com') super( access_token: access_token, expires_at: TokenInfo.lookup_access_token(access_token).fetch('exp'), issued_at: nil, universe_domain: universe_domain, ) @quota_project_id = quota_project_id end |
Instance Attribute Details
#quota_project_id ⇒ Object (readonly)
Returns the value of attribute quota_project_id.
10 11 12 |
# File 'lib/google/auth/extras/static_credential.rb', line 10 def quota_project_id @quota_project_id end |
Instance Method Details
#fetch_access_token ⇒ Object
36 37 38 39 40 41 |
# File 'lib/google/auth/extras/static_credential.rb', line 36 def fetch_access_token(*) raise RefreshNotSupported rescue RefreshNotSupported # This is a simple trick for getting the cause to be set. raise Signet::AuthorizationError, 'Refresh not supported' end |
#inspect ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/google/auth/extras/static_credential.rb', line 43 def inspect "#<#{self.class.name}" \ ' @access_token=[REDACTED]' \ " @expires_at=#{expires_at.inspect}" \ " @quota_project_id=#{@quota_project_id.inspect}" \ '>' end |