Method: Supply::AbstractGoogleServiceClient#initialize
- Defined in:
- supply/lib/supply/client.rb
#initialize(service_account_json: nil, params: nil) ⇒ AbstractGoogleServiceClient
Initializes the service and its auth_client using the specified information
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'supply/lib/supply/client.rb', line 48 def initialize(service_account_json: nil, params: nil) auth_client = Google::Auth::ServiceAccountCredentials.make_creds(json_key_io: service_account_json, scope: self.class::SCOPE) UI.verbose("Fetching a new access token from Google...") auth_client.fetch_access_token! if FastlaneCore::Env.truthy?("DEBUG") Google::Apis.logger.level = Logger::DEBUG end Google::Apis::ClientOptions.default.application_name = "fastlane (supply client)" Google::Apis::ClientOptions.default.application_version = Fastlane::VERSION Google::Apis::ClientOptions.default.read_timeout_sec = params[:timeout] Google::Apis::ClientOptions.default.open_timeout_sec = params[:timeout] Google::Apis::ClientOptions.default.send_timeout_sec = params[:timeout] Google::Apis::RequestOptions.default.retries = 5 service = self.class::SERVICE.new service. = auth_client if params[:root_url] # Google's client expects the root_url string to end with "/". params[:root_url] << '/' unless params[:root_url].end_with?('/') service.root_url = params[:root_url] end self.client = service end |