minfraud 1.4.1 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +7 -0
- data/.github/workflows/rubocop.yml +1 -1
- data/.github/workflows/test.yml +2 -4
- data/.rubocop.yml +4 -25
- data/CHANGELOG.md +97 -2
- data/Gemfile +0 -9
- data/LICENSE.txt +1 -1
- data/README.dev.md +1 -1
- data/README.md +13 -12
- data/lib/minfraud/assessments.rb +21 -16
- data/lib/minfraud/components/account.rb +1 -1
- data/lib/minfraud/components/billing.rb +1 -1
- data/lib/minfraud/components/credit_card.rb +47 -15
- data/lib/minfraud/components/custom_inputs.rb +1 -1
- data/lib/minfraud/components/device.rb +1 -1
- data/lib/minfraud/components/email.rb +93 -4
- data/lib/minfraud/components/event.rb +11 -11
- data/lib/minfraud/components/order.rb +1 -1
- data/lib/minfraud/components/payment.rb +153 -133
- data/lib/minfraud/components/report/transaction.rb +2 -2
- data/lib/minfraud/components/shipping.rb +2 -2
- data/lib/minfraud/components/shopping_cart.rb +2 -2
- data/lib/minfraud/components/shopping_cart_item.rb +3 -3
- data/lib/minfraud/http_service/response.rb +28 -21
- data/lib/minfraud/model/device.rb +1 -1
- data/lib/minfraud/model/disposition.rb +13 -6
- data/lib/minfraud/model/factors.rb +1 -1
- data/lib/minfraud/model/ip_address.rb +15 -43
- data/lib/minfraud/model/ip_risk_reason.rb +48 -0
- data/lib/minfraud/model/score.rb +1 -1
- data/lib/minfraud/model/subscores.rb +1 -23
- data/lib/minfraud/report.rb +19 -11
- data/lib/minfraud/validates.rb +2 -2
- data/lib/minfraud/version.rb +1 -1
- data/lib/minfraud.rb +18 -24
- data/minfraud.gemspec +14 -10
- metadata +58 -63
- data/lib/maxmind/geoip2/model/city.rb +0 -99
- data/lib/maxmind/geoip2/model/country.rb +0 -94
- data/lib/maxmind/geoip2/model/insights.rb +0 -38
- data/lib/maxmind/geoip2/record/abstract.rb +0 -46
- data/lib/maxmind/geoip2/record/city.rb +0 -62
- data/lib/maxmind/geoip2/record/continent.rb +0 -61
- data/lib/maxmind/geoip2/record/country.rb +0 -78
- data/lib/maxmind/geoip2/record/location.rb +0 -97
- data/lib/maxmind/geoip2/record/maxmind.rb +0 -41
- data/lib/maxmind/geoip2/record/place.rb +0 -52
- data/lib/maxmind/geoip2/record/postal.rb +0 -54
- data/lib/maxmind/geoip2/record/represented_country.rb +0 -47
- data/lib/maxmind/geoip2/record/subdivision.rb +0 -72
- data/lib/maxmind/geoip2/record/traits.rb +0 -233
- data/lib/minfraud/http_service/request.rb +0 -38
- data/lib/minfraud/http_service.rb +0 -45
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'minfraud/model/abstract'
|
4
|
+
|
5
|
+
module Minfraud
|
6
|
+
module Model
|
7
|
+
# Reason for the IP risk.
|
8
|
+
#
|
9
|
+
# This class provides both a machine-readable code and a human-readable
|
10
|
+
# explanation of the reason for the IP risk score.
|
11
|
+
#
|
12
|
+
# Although more codes may be added in the future, the current codes are:
|
13
|
+
#
|
14
|
+
# * ANONYMOUS_IP - The IP address belongs to an anonymous network. See the
|
15
|
+
# object at ip_address.traits for more details.
|
16
|
+
# * BILLING_POSTAL_VELOCITY - Many different billing postal codes have been
|
17
|
+
# seen on this IP address.
|
18
|
+
# * EMAIL_VELOCITY - Many different email addresses have been seen on this
|
19
|
+
# IP address.
|
20
|
+
# * HIGH_RISK_DEVICE - A high risk device was seen on this IP address.
|
21
|
+
# * HIGH_RISK_EMAIL - A high risk email address was seen on this IP address
|
22
|
+
# in your past transactions.
|
23
|
+
# * ISSUER_ID_NUMBER_VELOCITY - Many different issuer ID numbers have been
|
24
|
+
# seen on this IP address.
|
25
|
+
# * MINFRAUD_NETWORK_ACTIVITY - Suspicious activity has been seen on this
|
26
|
+
# IP address across minFraud customers.
|
27
|
+
class IPRiskReason < Abstract
|
28
|
+
# This value is a machine-readable code identifying the reason.
|
29
|
+
#
|
30
|
+
# @return [String, nil]
|
31
|
+
attr_reader :code
|
32
|
+
|
33
|
+
# This field provides a human-readable explanation of the reason. The
|
34
|
+
# text may change at any time and should not be matched against.
|
35
|
+
#
|
36
|
+
# @return [String, nil]
|
37
|
+
attr_reader :reason
|
38
|
+
|
39
|
+
# @!visibility private
|
40
|
+
def initialize(record)
|
41
|
+
super(record)
|
42
|
+
|
43
|
+
@code = get('code')
|
44
|
+
@reason = get('reason')
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/lib/minfraud/model/score.rb
CHANGED
@@ -65,7 +65,7 @@ module Minfraud
|
|
65
65
|
@queries_remaining = get('queries_remaining')
|
66
66
|
@risk_score = get('risk_score')
|
67
67
|
@warnings = []
|
68
|
-
if record
|
68
|
+
if record&.key?('warnings')
|
69
69
|
record['warnings'].each do |w|
|
70
70
|
@warnings << Minfraud::Model::Warning.new(w)
|
71
71
|
end
|
@@ -4,7 +4,7 @@ require 'minfraud/model/abstract'
|
|
4
4
|
|
5
5
|
module Minfraud
|
6
6
|
module Model
|
7
|
-
#
|
7
|
+
# Score for risk factors that are used in calculating the riskScore.
|
8
8
|
class Subscores < Abstract
|
9
9
|
# The risk associated with the AVS result. If present, this is a value in
|
10
10
|
# the range 0.01 to 99.
|
@@ -84,26 +84,6 @@ module Minfraud
|
|
84
84
|
# @return [Float, nil]
|
85
85
|
attr_reader :email_local_part
|
86
86
|
|
87
|
-
# The risk associated with the issuer ID number on the email domain. If
|
88
|
-
# present, this is a value in the range 0.01 to 99.
|
89
|
-
#
|
90
|
-
# Deprecated effective August 29, 2019. This subscore will default to 1
|
91
|
-
# and will be removed in a future release. The user tenure on email is
|
92
|
-
# reflected in the /subscores/email_address output.
|
93
|
-
#
|
94
|
-
# @return [Float, nil]
|
95
|
-
attr_reader :email_tenure
|
96
|
-
|
97
|
-
# The risk associated with the issuer ID number on the IP address. If
|
98
|
-
# present, this is a value in the range 0.01 to 99.
|
99
|
-
#
|
100
|
-
# Deprecated effective August 29, 2019. This subscore will default to 1
|
101
|
-
# and will be removed in a future release. The IP tenure is reflected in
|
102
|
-
# the overall risk score.
|
103
|
-
#
|
104
|
-
# @return [Float, nil]
|
105
|
-
attr_reader :ip_tenure
|
106
|
-
|
107
87
|
# The risk associated with the particular issuer ID number (IIN) given
|
108
88
|
# the billing location and the history of usage of the IIN on your
|
109
89
|
# account and shop ID. If present, this is a value in the range 0.01 to
|
@@ -162,8 +142,6 @@ module Minfraud
|
|
162
142
|
@email_address = get('email_address')
|
163
143
|
@email_domain = get('email_domain')
|
164
144
|
@email_local_part = get('email_local_part')
|
165
|
-
@email_tenure = get('email_tenure')
|
166
|
-
@ip_tenure = get('ip_tenure')
|
167
145
|
@issuer_id_number = get('issuer_id_number')
|
168
146
|
@order_amount = get('order_amount')
|
169
147
|
@phone_number = get('phone_number')
|
data/lib/minfraud/report.rb
CHANGED
@@ -3,10 +3,8 @@
|
|
3
3
|
module Minfraud
|
4
4
|
# Report is used to perform minFraud Report Transaction API requests.
|
5
5
|
#
|
6
|
-
# @see https://dev.maxmind.com/minfraud/report-transaction
|
6
|
+
# @see https://dev.maxmind.com/minfraud/report-a-transaction?lang=en
|
7
7
|
class Report
|
8
|
-
include ::Minfraud::HTTPService
|
9
|
-
|
10
8
|
# The Report::Transaction component.
|
11
9
|
#
|
12
10
|
# @return [Minfraud::Components::Report::Transaction, nil]
|
@@ -23,6 +21,8 @@ module Minfraud
|
|
23
21
|
#
|
24
22
|
# @return [nil]
|
25
23
|
#
|
24
|
+
# @raise [JSON::ParserError] if there was invalid JSON in the response.
|
25
|
+
#
|
26
26
|
# @raise [Minfraud::AuthorizationError] If there was an authentication
|
27
27
|
# problem.
|
28
28
|
#
|
@@ -32,16 +32,24 @@ module Minfraud
|
|
32
32
|
# @raise [Minfraud::ServerError] If the server reported an error of some
|
33
33
|
# kind.
|
34
34
|
def report_transaction
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
35
|
+
response = nil
|
36
|
+
body = nil
|
37
|
+
Minfraud.connection_pool.with do |client|
|
38
|
+
response = client.post(
|
39
|
+
'/minfraud/v2.0/transactions/report',
|
40
|
+
json: @transaction.to_json,
|
41
|
+
)
|
42
|
+
|
43
|
+
body = response.to_s
|
44
|
+
end
|
40
45
|
|
46
|
+
endpoint = nil
|
47
|
+
locales = nil
|
41
48
|
response = ::Minfraud::HTTPService::Response.new(
|
42
|
-
|
43
|
-
|
44
|
-
|
49
|
+
endpoint,
|
50
|
+
locales,
|
51
|
+
response,
|
52
|
+
body,
|
45
53
|
)
|
46
54
|
|
47
55
|
::Minfraud::ErrorHandler.examine(response)
|
data/lib/minfraud/validates.rb
CHANGED
@@ -114,7 +114,7 @@ module Minfraud
|
|
114
114
|
raise InvalidInputError, "The #{field} value is not valid. It must be numeric."
|
115
115
|
end
|
116
116
|
|
117
|
-
if value
|
117
|
+
if value.negative? || value > 1e13 - 1
|
118
118
|
raise InvalidInputError, "The #{field} value is not valid. It must be at least 0 and at most 1e13 - 1."
|
119
119
|
end
|
120
120
|
end
|
@@ -126,7 +126,7 @@ module Minfraud
|
|
126
126
|
raise InvalidInputError, "The #{field} is not valid. It must be an integer."
|
127
127
|
end
|
128
128
|
|
129
|
-
if value
|
129
|
+
if value.negative? || value > 1e13 - 1
|
130
130
|
raise InvalidInputError, "The #{field} is not valid. It must be at least 0 and at most 1e13 - 1."
|
131
131
|
end
|
132
132
|
end
|
data/lib/minfraud/version.rb
CHANGED
data/lib/minfraud.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'connection_pool'
|
4
|
+
require 'http'
|
4
5
|
require 'minfraud'
|
5
6
|
require 'minfraud/enum'
|
6
7
|
require 'minfraud/validates'
|
@@ -22,8 +23,6 @@ require 'minfraud/components/shopping_cart_item'
|
|
22
23
|
require 'minfraud/resolver'
|
23
24
|
require 'minfraud/version'
|
24
25
|
require 'minfraud/errors'
|
25
|
-
require 'minfraud/http_service'
|
26
|
-
require 'minfraud/http_service/request'
|
27
26
|
require 'minfraud/http_service/response'
|
28
27
|
require 'minfraud/error_handler'
|
29
28
|
require 'minfraud/assessments'
|
@@ -48,21 +47,13 @@ module Minfraud
|
|
48
47
|
# @return [String, nil]
|
49
48
|
attr_accessor :host
|
50
49
|
|
51
|
-
# The MaxMind account ID that is used for authorization.
|
52
|
-
#
|
53
|
-
# @deprecated Use {::account_id} instead. This will be removed in the next
|
54
|
-
# major version.
|
55
|
-
#
|
56
|
-
# @return [Integer, nil]
|
57
|
-
attr_accessor :user_id
|
58
|
-
|
59
50
|
# The MaxMind license key that is used for authorization.
|
60
51
|
#
|
61
52
|
# @return [String, nil]
|
62
53
|
attr_accessor :license_key
|
63
54
|
|
64
55
|
# @!visibility private
|
65
|
-
attr_reader :
|
56
|
+
attr_reader :connection_pool
|
66
57
|
|
67
58
|
# Yield self to accept configuration settings.
|
68
59
|
#
|
@@ -70,20 +61,23 @@ module Minfraud
|
|
70
61
|
def configure
|
71
62
|
yield self
|
72
63
|
|
73
|
-
|
74
|
-
@
|
64
|
+
pool_size = 5
|
65
|
+
host = @host.nil? ? 'minfraud.maxmind.com' : @host
|
66
|
+
@connection_pool = ConnectionPool.new(size: pool_size) do
|
67
|
+
make_http_client.persistent("https://#{host}")
|
68
|
+
end
|
75
69
|
end
|
76
70
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
71
|
+
private
|
72
|
+
|
73
|
+
def make_http_client
|
74
|
+
HTTP.basic_auth(
|
75
|
+
user: @account_id,
|
76
|
+
pass: @license_key,
|
77
|
+
).headers(
|
78
|
+
accept: 'application/json',
|
79
|
+
user_agent: "minfraud-api-ruby/#{Minfraud::VERSION}",
|
80
|
+
)
|
87
81
|
end
|
88
82
|
end
|
89
83
|
end
|
data/minfraud.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
lib = File.expand_path('lib',
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
4
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
5
|
|
6
6
|
require 'minfraud/version'
|
@@ -8,27 +8,31 @@ require 'minfraud/version'
|
|
8
8
|
Gem::Specification.new do |spec|
|
9
9
|
spec.name = 'minfraud'
|
10
10
|
spec.version = Minfraud::VERSION
|
11
|
-
spec.authors = ['kushnir.yb']
|
11
|
+
spec.authors = ['kushnir.yb', 'William Storey']
|
12
12
|
spec.email = ['support@maxmind.com']
|
13
13
|
|
14
14
|
spec.summary = 'Ruby API for the minFraud Score, Insights, Factors, and Report Transactions services'
|
15
15
|
spec.homepage = 'https://github.com/maxmind/minfraud-api-ruby'
|
16
16
|
spec.license = 'MIT'
|
17
17
|
|
18
|
-
spec.required_ruby_version = '>= 2.
|
18
|
+
spec.required_ruby_version = '>= 2.5.0'
|
19
19
|
|
20
20
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
21
21
|
spec.bindir = 'exe'
|
22
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
23
|
spec.require_paths = ['lib']
|
24
24
|
|
25
|
-
spec.add_runtime_dependency '
|
26
|
-
spec.add_runtime_dependency '
|
27
|
-
spec.add_runtime_dependency '
|
25
|
+
spec.add_runtime_dependency 'connection_pool', '~> 2.2'
|
26
|
+
spec.add_runtime_dependency 'http', '>= 4.3', '< 6.0'
|
27
|
+
spec.add_runtime_dependency 'maxmind-geoip2', '~> 1.1'
|
28
|
+
spec.add_runtime_dependency 'simpleidn', '~> 0.1', '>= 0.1.1'
|
28
29
|
|
29
|
-
spec.add_development_dependency 'bundler', '
|
30
|
-
spec.add_development_dependency 'rake'
|
30
|
+
spec.add_development_dependency 'bundler', '~> 2.2'
|
31
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
31
32
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
32
|
-
spec.add_development_dependency 'rubocop'
|
33
|
-
spec.add_development_dependency 'webmock'
|
33
|
+
spec.add_development_dependency 'rubocop', '~> 1.23'
|
34
|
+
spec.add_development_dependency 'webmock', '~> 3.14'
|
35
|
+
spec.metadata = {
|
36
|
+
'rubygems_mfa_required' => 'true'
|
37
|
+
}
|
34
38
|
end
|
metadata
CHANGED
@@ -1,103 +1,112 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minfraud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kushnir.yb
|
8
|
+
- William Storey
|
8
9
|
autorequire:
|
9
10
|
bindir: exe
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2022-01-25 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
15
|
+
name: connection_pool
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
16
17
|
requirements:
|
17
|
-
- - "
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 0.9.1
|
20
|
-
- - "<"
|
18
|
+
- - "~>"
|
21
19
|
- !ruby/object:Gem::Version
|
22
|
-
version: '2.
|
20
|
+
version: '2.2'
|
23
21
|
type: :runtime
|
24
22
|
prerelease: false
|
25
23
|
version_requirements: !ruby/object:Gem::Requirement
|
26
24
|
requirements:
|
27
|
-
- - "
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: 0.9.1
|
30
|
-
- - "<"
|
25
|
+
- - "~>"
|
31
26
|
- !ruby/object:Gem::Version
|
32
|
-
version: '2.
|
27
|
+
version: '2.2'
|
33
28
|
- !ruby/object:Gem::Dependency
|
34
|
-
name:
|
29
|
+
name: http
|
35
30
|
requirement: !ruby/object:Gem::Requirement
|
36
31
|
requirements:
|
37
32
|
- - ">="
|
38
33
|
- !ruby/object:Gem::Version
|
39
|
-
version:
|
34
|
+
version: '4.3'
|
40
35
|
- - "<"
|
41
36
|
- !ruby/object:Gem::Version
|
42
|
-
version: '
|
37
|
+
version: '6.0'
|
43
38
|
type: :runtime
|
44
39
|
prerelease: false
|
45
40
|
version_requirements: !ruby/object:Gem::Requirement
|
46
41
|
requirements:
|
47
42
|
- - ">="
|
48
43
|
- !ruby/object:Gem::Version
|
49
|
-
version:
|
44
|
+
version: '4.3'
|
50
45
|
- - "<"
|
51
46
|
- !ruby/object:Gem::Version
|
52
|
-
version: '
|
47
|
+
version: '6.0'
|
53
48
|
- !ruby/object:Gem::Dependency
|
54
|
-
name:
|
49
|
+
name: maxmind-geoip2
|
55
50
|
requirement: !ruby/object:Gem::Requirement
|
56
51
|
requirements:
|
57
|
-
- - "
|
58
|
-
- !ruby/object:Gem::Version
|
59
|
-
version: 2.0.0
|
60
|
-
- - "<"
|
52
|
+
- - "~>"
|
61
53
|
- !ruby/object:Gem::Version
|
62
|
-
version: '
|
54
|
+
version: '1.1'
|
63
55
|
type: :runtime
|
64
56
|
prerelease: false
|
65
57
|
version_requirements: !ruby/object:Gem::Requirement
|
66
58
|
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.1'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: simpleidn
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.1'
|
67
69
|
- - ">="
|
68
70
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
70
|
-
|
71
|
+
version: 0.1.1
|
72
|
+
type: :runtime
|
73
|
+
prerelease: false
|
74
|
+
version_requirements: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - "~>"
|
71
77
|
- !ruby/object:Gem::Version
|
72
|
-
version: '
|
78
|
+
version: '0.1'
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: 0.1.1
|
73
82
|
- !ruby/object:Gem::Dependency
|
74
83
|
name: bundler
|
75
84
|
requirement: !ruby/object:Gem::Requirement
|
76
85
|
requirements:
|
77
|
-
- - "
|
86
|
+
- - "~>"
|
78
87
|
- !ruby/object:Gem::Version
|
79
|
-
version: '
|
88
|
+
version: '2.2'
|
80
89
|
type: :development
|
81
90
|
prerelease: false
|
82
91
|
version_requirements: !ruby/object:Gem::Requirement
|
83
92
|
requirements:
|
84
|
-
- - "
|
93
|
+
- - "~>"
|
85
94
|
- !ruby/object:Gem::Version
|
86
|
-
version: '
|
95
|
+
version: '2.2'
|
87
96
|
- !ruby/object:Gem::Dependency
|
88
97
|
name: rake
|
89
98
|
requirement: !ruby/object:Gem::Requirement
|
90
99
|
requirements:
|
91
|
-
- - "
|
100
|
+
- - "~>"
|
92
101
|
- !ruby/object:Gem::Version
|
93
|
-
version: '0'
|
102
|
+
version: '13.0'
|
94
103
|
type: :development
|
95
104
|
prerelease: false
|
96
105
|
version_requirements: !ruby/object:Gem::Requirement
|
97
106
|
requirements:
|
98
|
-
- - "
|
107
|
+
- - "~>"
|
99
108
|
- !ruby/object:Gem::Version
|
100
|
-
version: '0'
|
109
|
+
version: '13.0'
|
101
110
|
- !ruby/object:Gem::Dependency
|
102
111
|
name: rspec
|
103
112
|
requirement: !ruby/object:Gem::Requirement
|
@@ -116,30 +125,30 @@ dependencies:
|
|
116
125
|
name: rubocop
|
117
126
|
requirement: !ruby/object:Gem::Requirement
|
118
127
|
requirements:
|
119
|
-
- - "
|
128
|
+
- - "~>"
|
120
129
|
- !ruby/object:Gem::Version
|
121
|
-
version: '
|
130
|
+
version: '1.23'
|
122
131
|
type: :development
|
123
132
|
prerelease: false
|
124
133
|
version_requirements: !ruby/object:Gem::Requirement
|
125
134
|
requirements:
|
126
|
-
- - "
|
135
|
+
- - "~>"
|
127
136
|
- !ruby/object:Gem::Version
|
128
|
-
version: '
|
137
|
+
version: '1.23'
|
129
138
|
- !ruby/object:Gem::Dependency
|
130
139
|
name: webmock
|
131
140
|
requirement: !ruby/object:Gem::Requirement
|
132
141
|
requirements:
|
133
|
-
- - "
|
142
|
+
- - "~>"
|
134
143
|
- !ruby/object:Gem::Version
|
135
|
-
version: '
|
144
|
+
version: '3.14'
|
136
145
|
type: :development
|
137
146
|
prerelease: false
|
138
147
|
version_requirements: !ruby/object:Gem::Requirement
|
139
148
|
requirements:
|
140
|
-
- - "
|
149
|
+
- - "~>"
|
141
150
|
- !ruby/object:Gem::Version
|
142
|
-
version: '
|
151
|
+
version: '3.14'
|
143
152
|
description:
|
144
153
|
email:
|
145
154
|
- support@maxmind.com
|
@@ -147,6 +156,7 @@ executables: []
|
|
147
156
|
extensions: []
|
148
157
|
extra_rdoc_files: []
|
149
158
|
files:
|
159
|
+
- ".github/dependabot.yml"
|
150
160
|
- ".github/workflows/rubocop.yml"
|
151
161
|
- ".github/workflows/test.yml"
|
152
162
|
- ".gitignore"
|
@@ -161,20 +171,6 @@ files:
|
|
161
171
|
- Rakefile
|
162
172
|
- bin/console
|
163
173
|
- bin/setup
|
164
|
-
- lib/maxmind/geoip2/model/city.rb
|
165
|
-
- lib/maxmind/geoip2/model/country.rb
|
166
|
-
- lib/maxmind/geoip2/model/insights.rb
|
167
|
-
- lib/maxmind/geoip2/record/abstract.rb
|
168
|
-
- lib/maxmind/geoip2/record/city.rb
|
169
|
-
- lib/maxmind/geoip2/record/continent.rb
|
170
|
-
- lib/maxmind/geoip2/record/country.rb
|
171
|
-
- lib/maxmind/geoip2/record/location.rb
|
172
|
-
- lib/maxmind/geoip2/record/maxmind.rb
|
173
|
-
- lib/maxmind/geoip2/record/place.rb
|
174
|
-
- lib/maxmind/geoip2/record/postal.rb
|
175
|
-
- lib/maxmind/geoip2/record/represented_country.rb
|
176
|
-
- lib/maxmind/geoip2/record/subdivision.rb
|
177
|
-
- lib/maxmind/geoip2/record/traits.rb
|
178
174
|
- lib/minfraud.rb
|
179
175
|
- lib/minfraud/assessments.rb
|
180
176
|
- lib/minfraud/components/account.rb
|
@@ -195,8 +191,6 @@ files:
|
|
195
191
|
- lib/minfraud/enum.rb
|
196
192
|
- lib/minfraud/error_handler.rb
|
197
193
|
- lib/minfraud/errors.rb
|
198
|
-
- lib/minfraud/http_service.rb
|
199
|
-
- lib/minfraud/http_service/request.rb
|
200
194
|
- lib/minfraud/http_service/response.rb
|
201
195
|
- lib/minfraud/model/abstract.rb
|
202
196
|
- lib/minfraud/model/address.rb
|
@@ -211,6 +205,7 @@ files:
|
|
211
205
|
- lib/minfraud/model/geoip2_location.rb
|
212
206
|
- lib/minfraud/model/insights.rb
|
213
207
|
- lib/minfraud/model/ip_address.rb
|
208
|
+
- lib/minfraud/model/ip_risk_reason.rb
|
214
209
|
- lib/minfraud/model/issuer.rb
|
215
210
|
- lib/minfraud/model/score.rb
|
216
211
|
- lib/minfraud/model/score_ip_address.rb
|
@@ -225,7 +220,8 @@ files:
|
|
225
220
|
homepage: https://github.com/maxmind/minfraud-api-ruby
|
226
221
|
licenses:
|
227
222
|
- MIT
|
228
|
-
metadata:
|
223
|
+
metadata:
|
224
|
+
rubygems_mfa_required: 'true'
|
229
225
|
post_install_message:
|
230
226
|
rdoc_options: []
|
231
227
|
require_paths:
|
@@ -234,15 +230,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
234
230
|
requirements:
|
235
231
|
- - ">="
|
236
232
|
- !ruby/object:Gem::Version
|
237
|
-
version:
|
233
|
+
version: 2.5.0
|
238
234
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
239
235
|
requirements:
|
240
236
|
- - ">="
|
241
237
|
- !ruby/object:Gem::Version
|
242
238
|
version: '0'
|
243
239
|
requirements: []
|
244
|
-
|
245
|
-
rubygems_version: 2.7.6.2
|
240
|
+
rubygems_version: 3.2.22
|
246
241
|
signing_key:
|
247
242
|
specification_version: 4
|
248
243
|
summary: Ruby API for the minFraud Score, Insights, Factors, and Report Transactions
|
@@ -1,99 +0,0 @@
|
|
1
|
-
# Copyright (c) 2020 by MaxMind, Inc.
|
2
|
-
#
|
3
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
-
# of this software and associated documentation files (the "Software"), to deal
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
-
# SOFTWARE.
|
20
|
-
|
21
|
-
# frozen_string_literal: true
|
22
|
-
|
23
|
-
require 'maxmind/geoip2/model/country'
|
24
|
-
require 'maxmind/geoip2/record/city'
|
25
|
-
require 'maxmind/geoip2/record/location'
|
26
|
-
require 'maxmind/geoip2/record/postal'
|
27
|
-
require 'maxmind/geoip2/record/subdivision'
|
28
|
-
|
29
|
-
module MaxMind
|
30
|
-
module GeoIP2
|
31
|
-
module Model
|
32
|
-
# Model class for the data returned by the GeoIP2 City web service and
|
33
|
-
# database. It is also used for GeoLite2 City lookups.
|
34
|
-
#
|
35
|
-
# The only difference between the City and Insights model classes is which
|
36
|
-
# fields in each record may be populated. See
|
37
|
-
# https://dev.maxmind.com/geoip/geoip2/web-services for more details.
|
38
|
-
#
|
39
|
-
# See {MaxMind::GeoIP2::Model::Country} for inherited methods.
|
40
|
-
class City < Country
|
41
|
-
# City data for the IP address.
|
42
|
-
#
|
43
|
-
# @return [MaxMind::GeoIP2::Record::City]
|
44
|
-
attr_reader :city
|
45
|
-
|
46
|
-
# Location data for the IP address.
|
47
|
-
#
|
48
|
-
# @return [MaxMind::GeoIP2::Record::Location]
|
49
|
-
attr_reader :location
|
50
|
-
|
51
|
-
# Postal data for the IP address.
|
52
|
-
#
|
53
|
-
# @return [MaxMind::GeoIP2::Record::Postal]
|
54
|
-
attr_reader :postal
|
55
|
-
|
56
|
-
# The country subdivisions for the IP address.
|
57
|
-
#
|
58
|
-
# The number and type of subdivisions varies by country, but a subdivision
|
59
|
-
# is typically a state, province, country, etc. Subdivisions are ordered
|
60
|
-
# from most general (largest) to most specific (smallest).
|
61
|
-
#
|
62
|
-
# If the response did not contain any subdivisions, this attribute will be
|
63
|
-
# an empty array.
|
64
|
-
#
|
65
|
-
# @return [Array<MaxMind::GeoIP2::Record::Subdivision>]
|
66
|
-
attr_reader :subdivisions
|
67
|
-
|
68
|
-
# @!visibility private
|
69
|
-
def initialize(record, locales)
|
70
|
-
super(record, locales)
|
71
|
-
@city = MaxMind::GeoIP2::Record::City.new(record['city'], locales)
|
72
|
-
@location = MaxMind::GeoIP2::Record::Location.new(record['location'])
|
73
|
-
@postal = MaxMind::GeoIP2::Record::Postal.new(record['postal'])
|
74
|
-
@subdivisions = create_subdivisions(record['subdivisions'], locales)
|
75
|
-
end
|
76
|
-
|
77
|
-
# The most specific subdivision returned.
|
78
|
-
#
|
79
|
-
# If the response did not contain any subdivisions, this method returns
|
80
|
-
# nil.
|
81
|
-
#
|
82
|
-
# @return [MaxMind::GeoIP2::Record::Subdivision, nil]
|
83
|
-
def most_specific_subdivision
|
84
|
-
@subdivisions.last
|
85
|
-
end
|
86
|
-
|
87
|
-
private
|
88
|
-
|
89
|
-
def create_subdivisions(subdivisions, locales)
|
90
|
-
return [] if subdivisions.nil?
|
91
|
-
|
92
|
-
subdivisions.map do |s|
|
93
|
-
MaxMind::GeoIP2::Record::Subdivision.new(s, locales)
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|