Class: Bcome::Driver::Gcp::Authentication::SignetServiceAccountClient
- Inherits:
-
Signet::OAuth2::Client
- Object
- Signet::OAuth2::Client
- Bcome::Driver::Gcp::Authentication::SignetServiceAccountClient
- Defined in:
- lib/objects/driver/gcp/authentication/signet/service_account.rb
Instance Method Summary collapse
- #authorize ⇒ Object
- #authorizer ⇒ Object
- #fetch_access_token(_options = {}) ⇒ Object
-
#initialize(scopes, service_account_json_path) ⇒ SignetServiceAccountClient
constructor
A new instance of SignetServiceAccountClient.
Constructor Details
#initialize(scopes, service_account_json_path) ⇒ SignetServiceAccountClient
Returns a new instance of SignetServiceAccountClient.
5 6 7 8 9 |
# File 'lib/objects/driver/gcp/authentication/signet/service_account.rb', line 5 def initialize(scopes, service_account_json_path) @scopes = scopes @service_account_json_path = service_account_json_path raise ::Bcome::Exception::GcpAuthServiceAccountMissingCredentials, @service_account_json_path unless File.exist?(@service_account_json_path) end |
Instance Method Details
#authorize ⇒ Object
16 17 18 |
# File 'lib/objects/driver/gcp/authentication/signet/service_account.rb', line 16 def @token ||= fetch_access_token end |
#authorizer ⇒ Object
20 21 22 23 24 25 |
# File 'lib/objects/driver/gcp/authentication/signet/service_account.rb', line 20 def = Google::Auth::ServiceAccountCredentials.make_creds( json_key_io: File.open(@service_account_json_path), scope: @scopes ) end |
#fetch_access_token(_options = {}) ⇒ Object
11 12 13 14 |
# File 'lib/objects/driver/gcp/authentication/signet/service_account.rb', line 11 def fetch_access_token( = {}) token = .fetch_access_token! token end |