NNTPClient
TODO: Write a gem description
Installation
Add this line to your application's Gemfile:
gem 'NNTPClient'
And then execute:
$ bundle
Or install it yourself as:
$ gem install NNTPClient
Usage
Connection
Two different methods can be used to connect to a usenet server:
First, by supplying a URL and a port number as hash values:
nntp = NNTPClient.new(:url => 'nntp.example.org', :port => 119)
An optional
:socket_factory
value can be included if you'd with for something other than TCPSocket to be used.
Please note that the signature of::new
must matchTCPSocket::new
's signature.By supplying an existing socket:
my_socket = TCPSocket.new('nntp.example.org', 119) nntp = NNTPClient.new(:socket => my_socket)
Listing Newsgroups
Upon connecting to a server, a list of valid newsgroups may be retrieved as such:
groups = nntp.groups
The first time #groups
is called, it retrieves the list of groups from the server. Subsequent calls return an instance variable.
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request