Class: Net::SMTP::Authenticator
- Inherits:
-
Object
- Object
- Net::SMTP::Authenticator
show all
- Defined in:
- lib/net/smtp/authenticator.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
29
30
31
|
# File 'lib/net/smtp/authenticator.rb', line 29
def initialize(smtp)
@smtp = smtp
end
|
Instance Attribute Details
#smtp ⇒ Object
Returns the value of attribute smtp.
27
28
29
|
# File 'lib/net/smtp/authenticator.rb', line 27
def smtp
@smtp
end
|
Class Method Details
.auth_class(type) ⇒ Object
13
14
15
16
|
# File '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 ⇒ Object
4
5
6
|
# File 'lib/net/smtp/authenticator.rb', line 4
def self.auth_classes
@classes ||= {}
end
|
.auth_type(type) ⇒ Object
8
9
10
11
|
# File '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) ⇒ Object
18
19
20
21
22
23
24
25
|
# File '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
|
Instance Method Details
#base64_encode(str) ⇒ String
51
52
53
54
|
# File 'lib/net/smtp/authenticator.rb', line 51
def base64_encode(str)
[str].pack('m0')
end
|
#continue(arg) ⇒ String
Returns message from server.
35
36
37
38
39
|
# File '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
|
Returns response from server.
43
44
45
46
47
|
# File 'lib/net/smtp/authenticator.rb', line 43
def finish(arg)
res = smtp.get_response arg
raise SMTPAuthenticationError.new(res) unless res.success?
res
end
|