minfraud 1.4.1 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +7 -0
  3. data/.github/workflows/rubocop.yml +1 -1
  4. data/.github/workflows/test.yml +2 -4
  5. data/.rubocop.yml +4 -25
  6. data/CHANGELOG.md +97 -2
  7. data/Gemfile +0 -9
  8. data/LICENSE.txt +1 -1
  9. data/README.dev.md +1 -1
  10. data/README.md +13 -12
  11. data/lib/minfraud/assessments.rb +21 -16
  12. data/lib/minfraud/components/account.rb +1 -1
  13. data/lib/minfraud/components/billing.rb +1 -1
  14. data/lib/minfraud/components/credit_card.rb +47 -15
  15. data/lib/minfraud/components/custom_inputs.rb +1 -1
  16. data/lib/minfraud/components/device.rb +1 -1
  17. data/lib/minfraud/components/email.rb +93 -4
  18. data/lib/minfraud/components/event.rb +11 -11
  19. data/lib/minfraud/components/order.rb +1 -1
  20. data/lib/minfraud/components/payment.rb +153 -133
  21. data/lib/minfraud/components/report/transaction.rb +2 -2
  22. data/lib/minfraud/components/shipping.rb +2 -2
  23. data/lib/minfraud/components/shopping_cart.rb +2 -2
  24. data/lib/minfraud/components/shopping_cart_item.rb +3 -3
  25. data/lib/minfraud/http_service/response.rb +28 -21
  26. data/lib/minfraud/model/device.rb +1 -1
  27. data/lib/minfraud/model/disposition.rb +13 -6
  28. data/lib/minfraud/model/factors.rb +1 -1
  29. data/lib/minfraud/model/ip_address.rb +15 -43
  30. data/lib/minfraud/model/ip_risk_reason.rb +48 -0
  31. data/lib/minfraud/model/score.rb +1 -1
  32. data/lib/minfraud/model/subscores.rb +1 -23
  33. data/lib/minfraud/report.rb +19 -11
  34. data/lib/minfraud/validates.rb +2 -2
  35. data/lib/minfraud/version.rb +1 -1
  36. data/lib/minfraud.rb +18 -24
  37. data/minfraud.gemspec +14 -10
  38. metadata +58 -63
  39. data/lib/maxmind/geoip2/model/city.rb +0 -99
  40. data/lib/maxmind/geoip2/model/country.rb +0 -94
  41. data/lib/maxmind/geoip2/model/insights.rb +0 -38
  42. data/lib/maxmind/geoip2/record/abstract.rb +0 -46
  43. data/lib/maxmind/geoip2/record/city.rb +0 -62
  44. data/lib/maxmind/geoip2/record/continent.rb +0 -61
  45. data/lib/maxmind/geoip2/record/country.rb +0 -78
  46. data/lib/maxmind/geoip2/record/location.rb +0 -97
  47. data/lib/maxmind/geoip2/record/maxmind.rb +0 -41
  48. data/lib/maxmind/geoip2/record/place.rb +0 -52
  49. data/lib/maxmind/geoip2/record/postal.rb +0 -54
  50. data/lib/maxmind/geoip2/record/represented_country.rb +0 -47
  51. data/lib/maxmind/geoip2/record/subdivision.rb +0 -72
  52. data/lib/maxmind/geoip2/record/traits.rb +0 -233
  53. data/lib/minfraud/http_service/request.rb +0 -38
  54. 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
@@ -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 && record.key?('warnings')
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
- # Subscores for components that are used in calculating the riskScore.
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')
@@ -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
- raw = request.perform(
36
- verb: :post,
37
- endpoint: 'transactions/report',
38
- body: @transaction.to_json,
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
- status: raw.status.to_i,
43
- body: raw.body,
44
- headers: raw.headers
49
+ endpoint,
50
+ locales,
51
+ response,
52
+ body,
45
53
  )
46
54
 
47
55
  ::Minfraud::ErrorHandler.examine(response)
@@ -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 < 0 || value > 1e13 - 1
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 < 0 || value > 1e13 - 1
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
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Minfraud
4
4
  # The Gem version.
5
- VERSION = '1.4.1'
5
+ VERSION = '2.1.0'
6
6
  end
data/lib/minfraud.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'faraday'
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 :connection
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
- config = Minfraud::HTTPService.configuration
74
- @connection = Faraday.new(config[:server], {}, &config[:middleware])
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
- # The current Minfraud configuration.
78
- #
79
- # @deprecated This will be removed in the next major version.
80
- #
81
- # @return [Hash]
82
- def configuration
83
- {
84
- user_id: @user_id,
85
- license_key: @license_key
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', File.dirname(File.realpath(__FILE__)))
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.1'
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 'faraday', '>= 0.9.1', '< 2.0'
26
- spec.add_runtime_dependency 'faraday_middleware', '>= 0.9.1', '< 2.0'
27
- spec.add_runtime_dependency 'net-http-persistent', '>= 2.0.0', '< 5.0'
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', '>= 1.16'
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.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: 2020-12-01 00:00:00.000000000 Z
12
+ date: 2022-01-25 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
- name: faraday
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.0'
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.0'
27
+ version: '2.2'
33
28
  - !ruby/object:Gem::Dependency
34
- name: faraday_middleware
29
+ name: http
35
30
  requirement: !ruby/object:Gem::Requirement
36
31
  requirements:
37
32
  - - ">="
38
33
  - !ruby/object:Gem::Version
39
- version: 0.9.1
34
+ version: '4.3'
40
35
  - - "<"
41
36
  - !ruby/object:Gem::Version
42
- version: '2.0'
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: 0.9.1
44
+ version: '4.3'
50
45
  - - "<"
51
46
  - !ruby/object:Gem::Version
52
- version: '2.0'
47
+ version: '6.0'
53
48
  - !ruby/object:Gem::Dependency
54
- name: net-http-persistent
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: '5.0'
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: 2.0.0
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: '5.0'
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: '1.16'
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: '1.16'
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: '0'
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: '0'
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: '0'
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: '0'
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: '2.1'
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
- rubyforge_project:
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