class Net::SMTP::Authenticator

属性

smtp[R]

公共类方法

auth_class(type) 点击切换源码
# File net-smtp-0.5.0/lib/net/smtp/authenticator.rb, line 13
def self.auth_class(type)
  type = type.to_s.upcase.tr(?_, ?-).to_sym
  Authenticator.auth_classes[type]
end
auth_classes() 点击切换源码
# File net-smtp-0.5.0/lib/net/smtp/authenticator.rb, line 4
def self.auth_classes
  @classes ||= {}
end
auth_type(type) 点击切换源码
# File net-smtp-0.5.0/lib/net/smtp/authenticator.rb, line 8
def self.auth_type(type)
  type = type.to_s.upcase.tr(?_, ?-).to_sym
  Authenticator.auth_classes[type] = self
end
check_args(user_arg = nil, secret_arg = nil, *, **) 点击切换源码
# File net-smtp-0.5.0/lib/net/smtp/authenticator.rb, line 18
def self.check_args(user_arg = nil, secret_arg = nil, *, **)
  unless user_arg
    raise ArgumentError, 'SMTP-AUTH requested but missing user name'
  end
  unless secret_arg
    raise ArgumentError, 'SMTP-AUTH requested but missing secret phrase'
  end
end
new(smtp) 点击切换源码
# File net-smtp-0.5.0/lib/net/smtp/authenticator.rb, line 29
def initialize(smtp)
  @smtp = smtp
end

公共实例方法

base64_encode(str) 点击切换源码

@param str [String] @return [String] Base64 编码的字符串

# File net-smtp-0.5.0/lib/net/smtp/authenticator.rb, line 51
def base64_encode(str)
  # expects "str" may not become too long
  [str].pack('m0')
end
continue(arg) 点击切换源码

@param arg [String] 发送到服务器的消息 @return [String] 来自服务器的消息

# File net-smtp-0.5.0/lib/net/smtp/authenticator.rb, line 35
def continue(arg)
  res = smtp.get_response arg
  raise res.exception_class.new(res) unless res.continue?
  res.string.split[1]
end
finish(arg) 点击切换源码

@param arg [String] 发送到服务器的消息 @return [Net::SMTP::Response] 来自服务器的响应

# File net-smtp-0.5.0/lib/net/smtp/authenticator.rb, line 43
def finish(arg)
  res = smtp.get_response arg
  raise SMTPAuthenticationError.new(res) unless res.success?
  res
end