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) ⇒ StaticCredential
constructor
A credential using a static access token.
- #inspect ⇒ Object
Constructor Details
#initialize(access_token:, quota_project_id: nil) ⇒ StaticCredential
A credential using a static access token.
21 22 23 24 25 26 27 28 29 |
# File 'lib/google/auth/extras/static_credential.rb', line 21 def initialize(access_token:, quota_project_id: nil) super( access_token: access_token, expires_at: TokenInfo.lookup_access_token(access_token).fetch('exp'), issued_at: nil, ) @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
31 32 33 34 35 36 |
# File 'lib/google/auth/extras/static_credential.rb', line 31 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
38 39 40 41 42 43 44 |
# File 'lib/google/auth/extras/static_credential.rb', line 38 def inspect "#<#{self.class.name}" \ ' @access_token=[REDACTED]' \ " @expires_at=#{expires_at.inspect}" \ " @quota_project_id=#{@quota_project_id.inspect}" \ '>' end |