Class: IpLocationService::IpAddress
- Inherits:
-
Object
- Object
- IpLocationService::IpAddress
- Defined in:
- lib/ip_location_service/ip_address.rb
Overview
Represents an ip address to be passed to the LocateIp-Operation of the IpLocation-Service.
Constant Summary collapse
- @@IP_V4 =
4
- @@IP_V6 =
6
Instance Attribute Summary collapse
-
#ip_address ⇒ Object
Returns the value of attribute ip_address.
-
#ip_type ⇒ Object
Returns the value of attribute ip_type.
Class Method Summary collapse
-
.IP_V4 ⇒ Object
Class methods.
- .IP_V6 ⇒ Object
Instance Method Summary collapse
-
#initialize(ip_address, ip_type = @@IP_V4) ⇒ IpAddress
constructor
Parameters
ip_address
::ip_type
:: IP version of the given address. - #to_s ⇒ Object
Constructor Details
#initialize(ip_address, ip_type = @@IP_V4) ⇒ IpAddress
Parameters
ip_address
ip_type
-
IP version of the given address. Valid options are :ipv4 and ipv6. Currently only :ipv4 is supported.
14 15 16 17 |
# File 'lib/ip_location_service/ip_address.rb', line 14 def initialize(ip_address, ip_type = @@IP_V4) @ip_address = ip_address @ip_type = ip_type end |
Instance Attribute Details
#ip_address ⇒ Object
Returns the value of attribute ip_address.
9 10 11 |
# File 'lib/ip_location_service/ip_address.rb', line 9 def ip_address @ip_address end |
#ip_type ⇒ Object
Returns the value of attribute ip_type.
9 10 11 |
# File 'lib/ip_location_service/ip_address.rb', line 9 def ip_type @ip_type end |
Class Method Details
.IP_V4 ⇒ Object
Class methods
25 26 27 |
# File 'lib/ip_location_service/ip_address.rb', line 25 def self.IP_V4 @@IP_V4 end |
.IP_V6 ⇒ Object
29 30 31 |
# File 'lib/ip_location_service/ip_address.rb', line 29 def self.IP_V6 @@IP_V6 end |
Instance Method Details
#to_s ⇒ Object
19 20 21 |
# File 'lib/ip_location_service/ip_address.rb', line 19 def to_s @ip_address.to_s end |