Class: Net::NATPMP::ExternalAddressResponse

Inherits:
Response
  • Object
show all
Defined in:
lib/net/natpmp/responses.rb

Overview

Response for the external address request

Instance Attribute Summary collapse

Attributes inherited from Response

#raw_response

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ ExternalAddressResponse

Returns a new instance of ExternalAddressResponse.



18
19
20
21
# File 'lib/net/natpmp/responses.rb', line 18

def initialize(response)
  super
  @ip_int = response.unpack1('@8N')
end

Instance Attribute Details

#ip_intObject (readonly)

Returns the value of attribute ip_int.



16
17
18
# File 'lib/net/natpmp/responses.rb', line 16

def ip_int
  @ip_int
end

Instance Method Details

#addressObject



23
24
25
# File 'lib/net/natpmp/responses.rb', line 23

def address
  IPAddr.new(ip_int, Socket::AF_INET)
end

#inspectObject



31
32
33
# File 'lib/net/natpmp/responses.rb', line 31

def inspect
  "External address: #{address}"
end

#to_sObject



27
28
29
# File 'lib/net/natpmp/responses.rb', line 27

def to_s
  address.to_s
end