In Files

  • net/smtp.rb

Net::SMTP::Response

Attributes

status[R]
string[R]

Public Class Methods

new(status, string) click to toggle source
 
               # File net/smtp.rb, line 981
def initialize(status, string)
  @status = status
  @string = string
end
            
parse(str) click to toggle source
 
               # File net/smtp.rb, line 977
def self.parse(str)
  new(str[0,3], str)
end
            

Public Instance Methods

capabilities() click to toggle source
 
               # File net/smtp.rb, line 1009
def capabilities
  return {} unless @string[3, 1] == '-'
  h = {}
  @string.lines.drop(1).each do |line|
    k, *v = line[4..-1].chomp.split(nil)
    h[k] = v
  end
  h
end
            
continue?() click to toggle source
 
               # File net/smtp.rb, line 997
def continue?
  status_type_char() == '3'
end
            
cram_md5_challenge() click to toggle source
 
               # File net/smtp.rb, line 1005
def cram_md5_challenge
  @string.split(/ /)[1].unpack('m')[0]
end
            
exception_class() click to toggle source
 
               # File net/smtp.rb, line 1019
def exception_class
  case @status
  when /\A4/  then SMTPServerBusy
  when /\A50/ then SMTPSyntaxError
  when /\A53/ then SMTPAuthenticationError
  when /\A5/  then SMTPFatalError
  else             SMTPUnknownError
  end
end
            
message() click to toggle source
 
               # File net/smtp.rb, line 1001
def message
  @string.lines.first
end
            
status_type_char() click to toggle source
 
               # File net/smtp.rb, line 989
def status_type_char
  @status[0, 1]
end
            
success?() click to toggle source
 
               # File net/smtp.rb, line 993
def success?
  status_type_char() == '2'
end