Class: Fastlane::FirebaseTestLab::Credential
- Inherits:
-
Object
- Object
- Fastlane::FirebaseTestLab::Credential
- Defined in:
- lib/fastlane/plugin/firebase_test_lab/helper/credential.rb
Instance Method Summary collapse
- #get_google_credential(scopes) ⇒ Object
-
#initialize(key_file_path: nil) ⇒ Credential
constructor
A new instance of Credential.
Constructor Details
#initialize(key_file_path: nil) ⇒ Credential
Returns a new instance of Credential.
6 7 8 |
# File 'lib/fastlane/plugin/firebase_test_lab/helper/credential.rb', line 6 def initialize(key_file_path: nil) @key_file_path = key_file_path end |
Instance Method Details
#get_google_credential(scopes) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/fastlane/plugin/firebase_test_lab/helper/credential.rb', line 10 def get_google_credential(scopes) unless @key_file_path begin return Google::Auth.get_application_default(scopes) rescue => ex UI.("Failed reading application default credential. Either the Oauth credential should be provided or Google Application Default Credential should be configured: #{ex.}") end end File.open(File.(@key_file_path), "r") do |file| = { json_key_io: file, scope: scopes } begin return Google::Auth::ServiceAccountCredentials.make_creds() rescue => ex UI.("Failed reading OAuth credential: #{ex.}") end end end |