Skip to content

Commit 7b01ba6

Browse files
committed
Add static_ip_score support
1 parent ed67d29 commit 7b01ba6

File tree

4 files changed

+21
-0
lines changed

4 files changed

+21
-0
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ CHANGELOG
1717
integer which indicates the estimated number of users sharing the
1818
IP/network during the past 24 hours. This output is available from GeoIP2
1919
Precision Insights.
20+
* The `staticIpScore` property was added to `GeoIp2\Record\Traits`. This is
21+
a float which indicates how static or dynamic an IP address is. This
22+
output is available from GeoIP2 Precision Insights.
2023

2124
2.9.0 (2018-04-10)
2225
------------------

src/Record/Traits.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@
7171
* @property-read string|null $organization The name of the organization associated
7272
* with the IP address. This attribute is only available from the City and
7373
* Insights web services and the GeoIP2 Enterprise database.
74+
* @property-read float|null $staticIPScore An indicator of how static or
75+
* dynamic an IP address is. This property is only available from GeoIP2
76+
* Precision Insights.
7477
* @property-read int|null $userCount The estimated number of users sharing
7578
* the IP/network during the past 24 hours. For IPv4, the count is for the
7679
* individual IP. For IPv6, the count is for the /64 network. This property is
@@ -121,6 +124,7 @@ class Traits extends AbstractRecord
121124
'isTorExitNode',
122125
'network',
123126
'organization',
127+
'staticIpScore',
124128
'userCount',
125129
'userType',
126130
];

tests/GeoIp2/Test/Model/InsightsTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ public function testFull()
7474
'is_tor_exit_node' => true,
7575
'isp' => 'Comcast',
7676
'organization' => 'Blorg',
77+
'static_ip_score' => 1.3,
7778
'user_count' => 2,
7879
'user_type' => 'college',
7980
],
@@ -182,6 +183,12 @@ public function testFull()
182183
'$model->traits->isAnonymousProxy is false'
183184
);
184185

186+
$this->assertSame(
187+
1.3,
188+
$model->traits->staticIpScore,
189+
'staticIPScore is correct'
190+
);
191+
185192
$this->assertSame(
186193
22,
187194
$model->maxmind->queriesRemaining,

tests/GeoIp2/Test/WebService/ClientTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ private function getResponse($service, $ipAddress)
3333
{
3434
if ($service === 'Insights') {
3535
$insights = unserialize(serialize($this->country));
36+
$insights['traits']['static_ip_score'] = 1.3;
3637
$insights['traits']['user_count'] = 2;
3738

3839
$responses = [
@@ -253,6 +254,12 @@ public function testInsights()
253254
'network'
254255
);
255256

257+
$this->assertSame(
258+
1.3,
259+
$record->traits->staticIpScore,
260+
'staticIPScore is 2'
261+
);
262+
256263
$this->assertSame(
257264
2,
258265
$record->traits->userCount,

0 commit comments

Comments
 (0)