lib/ads_common/api.rb
def create_auth_handler()
      auth_method = @config.read('authentication.method', :OAUTH2)
      return case auth_method
        when :CLIENTLOGIN
          @logger.warn("ClientLogin authentication method is now deprecated" +
              " and will be removed in the future. Consider migration to" +
              " OAuth2. See 'https://developers.google.com/accounts/docs/" +
              "AuthForInstalledApps' for more details.")
          AdsCommon::Auth::ClientLoginHandler.new(
              @config,
              api_config.client_login_config(:AUTH_SERVER),
              api_config.client_login_config(:LOGIN_SERVICE_NAME)
          )
        when :OAUTH
          raise AdsCommon::Errors::Error,
              'OAuth authorization method is deprecated, use OAuth2 instead.'
        when :OAUTH2
          environment = @config.read('service.environment',
              api_config.default_environment())
          AdsCommon::Auth::OAuth2Handler.new(
              @config,
              api_config.environment_config(environment, :oauth_scope)
          )
        when :OAUTH2_JWT
          environment = @config.read('service.environment',
              api_config.default_environment())
          AdsCommon::Auth::OAuth2JwtHandler.new(
              @config,
              api_config.environment_config(environment, :oauth_scope)
          )
        else
          raise AdsCommon::Errors::Error,
              "Unknown authentication method '%s'" % auth_method
        end
    end
# Auxiliary method to create an authentication handler.
#
# Returns:
# - auth handler
#
Auxiliary method to create an authentication handler.
Returns:
auth handler
Auxiliary method to create an authentication handler . Returns : auth handler
def create_auth_handler()
      auth_method = @config.read('authentication.method', :OAUTH2)
      return case auth_method
        when :CLIENTLOGIN
          @logger.warn("ClientLogin authentication method is now deprecated" +
              " and will be removed in the future. Consider migration to" +
              " OAuth2. See 'https://developers.google.com/accounts/docs/" +
              "AuthForInstalledApps' for more details.")
          AdsCommon::Auth::ClientLoginHandler.new(
              @config,
              api_config.client_login_config(:AUTH_SERVER),
              api_config.client_login_config(:LOGIN_SERVICE_NAME)
          )
        when :OAUTH
          raise AdsCommon::Errors::Error,
              'OAuth authorization method is deprecated, use OAuth2 instead.'
        when :OAUTH2
          environment = @config.read('service.environment',
              api_config.default_environment())
          AdsCommon::Auth::OAuth2Handler.new(
              @config,
              api_config.environment_config(environment, :oauth_scope)
          )
        when :OAUTH2_JWT
          environment = @config.read('service.environment',
              api_config.default_environment())
          AdsCommon::Auth::OAuth2JwtHandler.new(
              @config,
              api_config.environment_config(environment, :oauth_scope)
          )
        else
          raise AdsCommon::Errors::Error,
              "Unknown authentication method '%s'" % auth_method
        end
    end
def create_auth_handler ( ) auth_method = @config . read ( 'authentication.method' , :OAUTH2 ) return case auth_method when :CLIENTLOGIN @logger . warn ( "ClientLogin authentication method is now deprecated" + " and will be removed in the future. Consider migration to" + " OAuth2. See 'https://developers.google.com/accounts/docs/" + "AuthForInstalledApps' for more details." ) AdsCommon :: Auth :: ClientLoginHandler . new ( @config , api_config . client_login_config ( :AUTH_SERVER ) , api_config . client_login_config ( :LOGIN_SERVICE_NAME ) ) when :OAUTH raise AdsCommon :: Errors :: Error , 'OAuth authorization method is deprecated, use OAuth2 instead.' when :OAUTH2 environment = @config . read ( 'service.environment' , api_config . default_environment ( ) ) AdsCommon :: Auth :: OAuth2Handler . new ( @config , api_config . environment_config ( environment , :oauth_scope ) ) when :OAUTH2_JWT environment = @config . read ( 'service.environment' , api_config . default_environment ( ) ) AdsCommon :: Auth :: OAuth2JwtHandler . new ( @config , api_config . environment_config ( environment , :oauth_scope ) ) else raise AdsCommon :: Errors :: Error , "Unknown authentication method '%s'" % auth_method end end
Auxiliary method to create an authentication handler.
Auxiliary method to create an authentication handler .