Class: Net::SMTP::Response
- Inherits:
-
Object
- Object
- Net::SMTP::Response
- Defined in:
- lib/net/smtp.rb
Instance Attribute Summary collapse
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#string ⇒ Object
readonly
Returns the value of attribute string.
Class Method Summary collapse
Instance Method Summary collapse
- #capabilities ⇒ Object
- #continue? ⇒ Boolean
- #cram_md5_challenge ⇒ Object
- #exception_class ⇒ Object
-
#initialize(status, string) ⇒ Response
constructor
A new instance of Response.
- #message ⇒ Object
- #status_type_char ⇒ Object
- #success? ⇒ Boolean
Constructor Details
#initialize(status, string) ⇒ Response
Returns a new instance of Response.
957 958 959 960 |
# File 'lib/net/smtp.rb', line 957 def initialize(status, string) @status = status @string = string end |
Instance Attribute Details
#status ⇒ Object (readonly)
Returns the value of attribute status.
962 963 964 |
# File 'lib/net/smtp.rb', line 962 def status @status end |
#string ⇒ Object (readonly)
Returns the value of attribute string.
963 964 965 |
# File 'lib/net/smtp.rb', line 963 def string @string end |
Class Method Details
.parse(str) ⇒ Object
953 954 955 |
# File 'lib/net/smtp.rb', line 953 def Response.parse(str) new(str[0,3], str) end |
Instance Method Details
#capabilities ⇒ Object
985 986 987 988 989 990 991 992 993 |
# File 'lib/net/smtp.rb', line 985 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? ⇒ Boolean
973 974 975 |
# File 'lib/net/smtp.rb', line 973 def continue? status_type_char() == '3' end |
#cram_md5_challenge ⇒ Object
981 982 983 |
# File 'lib/net/smtp.rb', line 981 def cram_md5_challenge @string.split(/ /)[1].unpack('m')[0] end |
#exception_class ⇒ Object
995 996 997 998 999 1000 1001 1002 1003 |
# File 'lib/net/smtp.rb', line 995 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 ⇒ Object
977 978 979 |
# File 'lib/net/smtp.rb', line 977 def @string.lines.first end |
#status_type_char ⇒ Object
965 966 967 |
# File 'lib/net/smtp.rb', line 965 def status_type_char @status[0, 1] end |
#success? ⇒ Boolean
969 970 971 |
# File 'lib/net/smtp.rb', line 969 def success? status_type_char() == '2' end |