Class: Net::NNTP::List

Inherits:
Request show all
Defined in:
lib/net/nntp/request.rb

Overview

RFC 3977

LIST request.

Valid Response: ListInformationFollows

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Request

#command, #dotstuff, #msgid_or_range, #range, #valid_response?

Constructor Details

#initialize(keyword = nil, rest = {}) ⇒ List

  • keyword must be nil or one of ACTIVE, ACTIVE.TIMES, DISTRIB.PATS, HEADERS, NEWSGROUPS or OVERVIEW.FMT.

  • rest can be a string or a hash with either the key :msgid or the keys :start and optionally :end to denote a range.

Example

request = Net::NNTP::List.new                                           # => LIST
request = Net::NNTP::List.new('ACTIVE')                                 # => LIST ACTIVE
request = Net::NNTP::List.new('ACTIVE.TIMES', 'at.*')                   # => LIST ACTIVE at.*
request = Net::NNTP::List.new('HEADERS', :msgid => '<this.is@invalid>') # => LIST HEADERS <this.is@invalid>
request = Net::NNTP::List.new('HEADERS', :start => 123, :end => 456)    # => LIST HEADERS 123-456


723
724
725
726
727
728
729
# File 'lib/net/nntp/request.rb', line 723

def initialize(keyword=nil, rest={}) 
  Net::NNTP.logger.debug("Keyword: <#{keyword}>")
  @keyword = keyword.strip.upcase if keyword
  parameters = (@keyword ? @keyword.dup : '') 
  parameters << ' ' << msgid_or_range(rest)
  super 'LIST', parameters
end

Instance Attribute Details

#keywordObject (readonly)

Returns the value of attribute keyword.



711
712
713
# File 'lib/net/nntp/request.rb', line 711

def keyword
  @keyword
end

Instance Method Details

#capabilityObject



735
736
737
# File 'lib/net/nntp/request.rb', line 735

def capability
  'list'
end

#valid_responsesObject



731
732
733
# File 'lib/net/nntp/request.rb', line 731

def valid_responses
  [ListInformationFollows]
end