-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Version bumped to 2.2.0
- Loading branch information
SaadHassan-dev
committed
Dec 19, 2023
1 parent
fa00489
commit e742046
Showing
4 changed files
with
45 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
module IPinfo | ||
VERSION = '2.1.0' | ||
VERSION = '2.2.0' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ def test_that_it_has_a_version_number | |
refute_nil ::IPinfo::VERSION | ||
end | ||
|
||
def test_set_adapter | ||
def test_set_adapter_v4 | ||
ipinfo = IPinfo.create( | ||
ENV['IPINFO_TOKEN'], | ||
{ http_client: :excon } | ||
|
@@ -19,6 +19,16 @@ def test_set_adapter | |
assert(ipinfo.httpc = :excon) | ||
end | ||
|
||
def test_set_adapter_v6 | ||
ipinfo = IPinfo.create( | ||
ENV['IPINFO_TOKEN'], | ||
{ http_client: :excon }, | ||
{ 'host_type' => :v6 } | ||
) | ||
|
||
assert(ipinfo.httpc = :excon) | ||
end | ||
|
||
def assert_ip6(resp) | ||
assert_equal(resp.ip, TEST_IPV6) | ||
assert_equal(resp.ip_address, IPAddr.new(TEST_IPV6)) | ||
|
@@ -48,7 +58,7 @@ def assert_ip6(resp) | |
{ | ||
"name": 'Comcast Cable Communications, LLC', | ||
"domain": 'comcast.com', | ||
"type": '' | ||
"type": 'isp' | ||
} | ||
) | ||
assert_equal( | ||
|
@@ -94,6 +104,16 @@ def test_lookup_ip6 | |
end | ||
end | ||
|
||
def test_lookup_ip6_on_host_v6 | ||
ipinfo = IPinfo.create(ENV['IPINFO_TOKEN'], { 'host_type' => :v6 }) | ||
|
||
# multiple checks for cache | ||
(0...5).each do |_| | ||
resp = ipinfo.details(TEST_IPV6) | ||
assert_ip6(resp) | ||
end | ||
end | ||
|
||
def assert_ip4(resp) | ||
assert_equal(resp.ip, TEST_IPV4) | ||
assert_equal(resp.ip_address, IPAddr.new(TEST_IPV4)) | ||
|
@@ -149,7 +169,7 @@ def assert_ip4(resp) | |
resp.abuse, | ||
{ | ||
"address": 'US, CA, Mountain View, ' \ | ||
'1600 Amphitheatre Parkway, 94043', | ||
'1600 Amphitheatre Parkway, 94043', | ||
"country": 'US', | ||
"email": '[email protected]', | ||
"name": 'Abuse', | ||
|
@@ -171,4 +191,14 @@ def test_lookup_ip4 | |
assert_ip4(resp) | ||
end | ||
end | ||
|
||
def test_lookup_ip4_on_host_v6 | ||
ipinfo = IPinfo.create(ENV['IPINFO_TOKEN'], { 'host_type' => :v6 }) | ||
|
||
# multiple checks for cache | ||
(0...5).each do |_| | ||
resp = ipinfo.details(TEST_IPV4) | ||
assert_ip4(resp) | ||
end | ||
end | ||
end |