Module: Net::NATPMP
- Defined in:
- lib/net/natpmp.rb,
lib/net/natpmp/client.rb,
lib/net/natpmp/config.rb,
lib/net/natpmp/errors.rb,
lib/net/natpmp/requests.rb,
lib/net/natpmp/constants.rb,
lib/net/natpmp/responses.rb
Overview
Main class
Defined Under Namespace
Modules: Constants Classes: Client, Config, ConnectionRefused, Exception, ExternalAddressRequest, ExternalAddressResponse, InvalidParameter, InvalidReply, InvalidVersion, MappingRequest, MappingResponse, Request, RequestFailed, Response, TimeoutException
Class Method Summary collapse
-
.client(config) ⇒ Object
Instantiate class with default params.
Class Method Details
.client(config) ⇒ Object
Instantiate class with default params. Takes a config instance or any other params. :gw is mandatory if config instance not provided
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/net/natpmp.rb', line 16 def self.client(config) return Client.new(config) if config.is_a?(Config) unless config[:gw] raise Net::NATPMP::Exception, 'Gateway is missing. Call with: Net::NATPMP.client(gw: "x.x.x.x")' end Client.new(Config.new(**config)) end |