Class: IpLocationService::IpAddress

Inherits:
Object
  • Object
show all
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

Class Method Summary collapse

Instance Method Summary collapse

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_addressObject

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_typeObject

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_V4Object

Class methods



25
26
27
# File 'lib/ip_location_service/ip_address.rb', line 25

def self.IP_V4
  @@IP_V4
end

.IP_V6Object



29
30
31
# File 'lib/ip_location_service/ip_address.rb', line 29

def self.IP_V6
  @@IP_V6
end

Instance Method Details

#to_sObject



19
20
21
# File 'lib/ip_location_service/ip_address.rb', line 19

def to_s
  @ip_address.to_s
end