Class: Net::NNTP::Authinfo
Overview
Plain text AUTHINFO Request. Set user and pass with new.
Parameter:
- keyword
-
either ‘user’ or ‘pass’
- data
-
username if keyword is USER, password if keyword is PASS
Usage Example
nntp = Net::NNTP.new
nntp.server = 'localhost'
nntp.connect
request = Authinfo.new('user', 'test')
response = nntp.process(request)
if PasswordRequired === response
request = Authinfo.new('pass', 'xxx')
response = nntp.process(request)
if OKResponse === response
# authenticated, go ahead
else
raise StandardError, response.
end
end
Valid Responses: PasswordRequired, AuthenticationAccepted, AuthenticationFailed, AuthenticationOutOfSequence
Instance Method Summary collapse
- #capability ⇒ Object
-
#initialize(keyword, data) ⇒ Authinfo
constructor
user
is the string used in AUTHINFO USERpass
is the string used in AUTHINFO PASS.
Methods inherited from Request
#command, #dotstuff, #msgid_or_range, #range, #valid_response?
Constructor Details
#initialize(keyword, data) ⇒ Authinfo
user
is the string used in AUTHINFO USER pass
is the string used in AUTHINFO PASS
See: user_command, pass_command
135 136 137 |
# File 'lib/net/nntp/request.rb', line 135 def initialize(keyword, data) super 'AUTHINFO', [keyword.upcase, data].join(" ") end |
Instance Method Details
#capability ⇒ Object
144 145 146 |
# File 'lib/net/nntp/request.rb', line 144 def capability 'authinfo' end |