Class: Net::SMTP::Response
- Inherits:
-
Object
- Object
- Net::SMTP::Response
- Defined in:
- lib/rubysl/net/smtp/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
969 970 971 972 |
# File 'lib/rubysl/net/smtp/smtp.rb', line 969 def initialize(status, string) @status = status @string = string end |
Instance Attribute Details
#status ⇒ Object (readonly)
Returns the value of attribute status.
974 975 976 |
# File 'lib/rubysl/net/smtp/smtp.rb', line 974 def status @status end |
#string ⇒ Object (readonly)
Returns the value of attribute string.
975 976 977 |
# File 'lib/rubysl/net/smtp/smtp.rb', line 975 def string @string end |
Class Method Details
.parse(str) ⇒ Object
965 966 967 |
# File 'lib/rubysl/net/smtp/smtp.rb', line 965 def Response.parse(str) new(str[0,3], str) end |
Instance Method Details
#capabilities ⇒ Object
997 998 999 1000 1001 1002 1003 1004 1005 |
# File 'lib/rubysl/net/smtp/smtp.rb', line 997 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
985 986 987 |
# File 'lib/rubysl/net/smtp/smtp.rb', line 985 def continue? status_type_char() == '3' end |
#cram_md5_challenge ⇒ Object
993 994 995 |
# File 'lib/rubysl/net/smtp/smtp.rb', line 993 def cram_md5_challenge @string.split(/ /)[1].unpack('m')[0] end |
#exception_class ⇒ Object
1007 1008 1009 1010 1011 1012 1013 1014 1015 |
# File 'lib/rubysl/net/smtp/smtp.rb', line 1007 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
989 990 991 |
# File 'lib/rubysl/net/smtp/smtp.rb', line 989 def @string.lines.first end |
#status_type_char ⇒ Object
977 978 979 |
# File 'lib/rubysl/net/smtp/smtp.rb', line 977 def status_type_char @status[0, 1] end |
#success? ⇒ Boolean
981 982 983 |
# File 'lib/rubysl/net/smtp/smtp.rb', line 981 def success? status_type_char() == '2' end |