Skip to content

Commit e94847c

Browse files
oschwaldclaude
andcommitted
Add email domain outputs
This adds support for new email domain outputs including classification, risk score, volume, and automated visit information. These outputs are available on the Insights and Factors responses. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent cf762a2 commit e94847c

File tree

7 files changed

+118
-2
lines changed

7 files changed

+118
-2
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@
1515
* Added the input `/payment/method`. This is the payment method associated
1616
with the transaction. You may provide this using the `method` attribute
1717
on `Minfraud::Components::Payment`.
18+
* Added support for the `/email/domain/classification`,
19+
`/email/domain/risk`, `/email/domain/volume`, and `/email/domain/visit`
20+
outputs. These are available as the `classification`, `risk`, `volume`,
21+
and `visit` attributes on `Minfraud::Model::EmailDomain`. The `visit`
22+
attribute returns a `Minfraud::Model::EmailDomainVisit` object.
23+
* Added support for the `/email/domain/visit/has_redirect`,
24+
`/email/domain/visit/last_visited_on`, and `/email/domain/visit/status`
25+
outputs. These are available as the `has_redirect`, `last_visited_on`,
26+
and `status` attributes on `Minfraud::Model::EmailDomainVisit`.
1827

1928
## v2.8.0 (2025-05-23)
2029

lib/minfraud/model/email_domain.rb

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,55 @@
11
# frozen_string_literal: true
22

33
require 'minfraud/model/abstract'
4+
require 'minfraud/model/email_domain_visit'
45

56
module Minfraud
67
module Model
78
# Model containing information about the email domain.
89
class EmailDomain < Abstract
10+
# A classification of the domain. Possible values are:
11+
# * business
12+
# * education
13+
# * government
14+
# * isp_email
15+
#
16+
# @return [String, nil]
17+
attr_reader :classification
18+
919
# A date string (e.g. 2017-04-24) to identify the date an email domain
1020
# was first seen by MaxMind. This is expressed using the ISO 8601 date
1121
# format.
1222
#
1323
# @return [String, nil]
1424
attr_reader :first_seen
1525

26+
# A risk score ranging from 0.01 to 99. Higher values indicate greater
27+
# risk.
28+
#
29+
# @return [Float, nil]
30+
attr_reader :risk
31+
32+
# An object containing information about an automated visit to the email
33+
# domain.
34+
#
35+
# @return [Minfraud::Model::EmailDomainVisit, nil]
36+
attr_reader :visit
37+
38+
# Activity across the minFraud network expressed as sightings per
39+
# million. The value ranges from 0.001 to 1,000,000.
40+
#
41+
# @return [Float, nil]
42+
attr_reader :volume
43+
1644
# @!visibility private
1745
def initialize(record)
1846
super
1947

20-
@first_seen = get('first_seen')
48+
@classification = get('classification')
49+
@first_seen = get('first_seen')
50+
@risk = get('risk')
51+
@visit = EmailDomainVisit.new(get('visit'))
52+
@volume = get('volume')
2153
end
2254
end
2355
end
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# frozen_string_literal: true
2+
3+
require 'minfraud/model/abstract'
4+
5+
module Minfraud
6+
module Model
7+
# Model containing information about an automated visit to the email
8+
# domain.
9+
class EmailDomainVisit < Abstract
10+
# Whether the domain redirects to another URL.
11+
#
12+
# @return [Boolean, nil]
13+
attr_reader :has_redirect
14+
15+
# A date string (e.g. 2025-11-15) identifying the date the automated
16+
# visit was completed. This is expressed using the ISO 8601 date format.
17+
#
18+
# @return [String, nil]
19+
attr_reader :last_visited_on
20+
21+
# The status of the domain. Possible values are:
22+
# * live - The domain is operational and serving content.
23+
# * dns_error - The domain has missing, expired, or misconfigured DNS.
24+
# * network_error - The domain is offline or unreachable.
25+
# * http_error - The domain is reachable, but has an application error.
26+
# * parked - The domain is reachable and in a parked state.
27+
# * pre_development - The domain is reachable and in a pre-development
28+
# state.
29+
#
30+
# @return [String, nil]
31+
attr_reader :status
32+
33+
# @!visibility private
34+
def initialize(record)
35+
super
36+
37+
@has_redirect = get('has_redirect')
38+
@last_visited_on = get('last_visited_on')
39+
@status = get('status')
40+
end
41+
end
42+
end
43+
end

spec/fixtures/files/factors-response1.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,17 @@
159159
"local_time": "2017-06-08T14:16:38Z"
160160
},
161161
"email": {
162+
"domain": {
163+
"classification": "education",
164+
"first_seen": "2019-05-20",
165+
"risk": 2.5,
166+
"visit": {
167+
"has_redirect": false,
168+
"last_visited_on": "2025-11-10",
169+
"status": "parked"
170+
},
171+
"volume": 150.75
172+
},
162173
"first_seen": "2017-01-02",
163174
"is_disposable": true,
164175
"is_free": true,

spec/fixtures/files/insights-response1.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,15 @@
180180
},
181181
"email": {
182182
"domain": {
183-
"first_seen": "2016-01-03"
183+
"classification": "business",
184+
"first_seen": "2016-01-03",
185+
"risk": 1.23,
186+
"visit": {
187+
"has_redirect": true,
188+
"last_visited_on": "2025-11-15",
189+
"status": "live"
190+
},
191+
"volume": 6.5
184192
},
185193
"first_seen": "2017-01-02",
186194
"is_disposable": true,

spec/fixtures/files/insights-response2.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@
121121
"local_time": "2017-06-08T14:16:38Z"
122122
},
123123
"email": {
124+
"domain": {},
124125
"is_disposable": true,
125126
"is_free": true,
126127
"is_high_risk": true

spec/model/insights_spec.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,13 @@
118118
expect(m.device.last_seen).to eq '2016-06-08T14:16:38Z'
119119
expect(m.device.local_time).to eq '2017-06-08T14:16:38Z'
120120

121+
expect(m.email.domain.classification).to eq 'business'
121122
expect(m.email.domain.first_seen).to eq '2016-01-03'
123+
expect(m.email.domain.risk).to eq 1.23
124+
expect(m.email.domain.visit.has_redirect).to be true
125+
expect(m.email.domain.visit.last_visited_on).to eq '2025-11-15'
126+
expect(m.email.domain.visit.status).to eq 'live'
127+
expect(m.email.domain.volume).to eq 6.5
122128
expect(m.email.first_seen).to eq '2017-01-02'
123129
expect(m.email.is_disposable).to be true
124130
expect(m.email.is_free).to be true
@@ -197,7 +203,13 @@
197203
expect(m.device.confidence).to be_nil
198204
expect(m.device.id).to eq '7835b099-d385-4e5b-969e-7df26181d73b'
199205

206+
expect(m.email.domain.classification).to be_nil
200207
expect(m.email.domain.first_seen).to be_nil
208+
expect(m.email.domain.risk).to be_nil
209+
expect(m.email.domain.visit.has_redirect).to be_nil
210+
expect(m.email.domain.visit.last_visited_on).to be_nil
211+
expect(m.email.domain.visit.status).to be_nil
212+
expect(m.email.domain.volume).to be_nil
201213
expect(m.email.first_seen).to be_nil
202214
expect(m.email.is_disposable).to be true
203215

0 commit comments

Comments
 (0)