def generate_creds_params
      define_singleton_method :creds_params,
        if @service_tokens
          lambda do |options|
            token = options.delete(:service_token)
            service_id = options[:service_id]
            raise ArgumentError, "need to specify a service_token and a service_id" unless token && service_id
            'service_token='.freeze + CGI.escape(token)
          end
        elsif @provider_key
          warn DEPRECATION_MSG_PROVIDER_KEY if @warn_deprecated
          lambda do |_|
            "provider_key=#{CGI.escape @provider_key}".freeze
          end
        else
          raise ArgumentError, 'missing credentials - either use "service_tokens: true" or specify a provider_key value'
        end
    end
def generate_creds_params
      define_singleton_method :creds_params,
        if @service_tokens
          lambda do |options|
            token = options.delete(:service_token)
            service_id = options[:service_id]
            raise ArgumentError, "need to specify a service_token and a service_id" unless token && service_id
            'service_token='.freeze + CGI.escape(token)
          end
        elsif @provider_key
          warn DEPRECATION_MSG_PROVIDER_KEY if @warn_deprecated
          lambda do |_|
            "provider_key=#{CGI.escape @provider_key}".freeze
          end
        else
          raise ArgumentError, 'missing credentials - either use "service_tokens: true" or specify a provider_key value'
        end
    end
helper to generate the creds_params method