minfraud 1.0.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/test.yml +46 -0
  3. data/.gitignore +2 -0
  4. data/.rubocop.yml +127 -0
  5. data/.travis.yml +20 -3
  6. data/CHANGELOG.md +56 -0
  7. data/CODE_OF_CONDUCT.md +4 -4
  8. data/Gemfile +11 -2
  9. data/LICENSE.txt +2 -1
  10. data/README.dev.md +4 -0
  11. data/README.md +107 -36
  12. data/Rakefile +18 -3
  13. data/bin/console +4 -3
  14. data/lib/maxmind/geoip2/model/city.rb +99 -0
  15. data/lib/maxmind/geoip2/model/country.rb +94 -0
  16. data/lib/maxmind/geoip2/model/insights.rb +38 -0
  17. data/lib/maxmind/geoip2/record/abstract.rb +46 -0
  18. data/lib/maxmind/geoip2/record/city.rb +62 -0
  19. data/lib/maxmind/geoip2/record/continent.rb +61 -0
  20. data/lib/maxmind/geoip2/record/country.rb +78 -0
  21. data/lib/maxmind/geoip2/record/location.rb +97 -0
  22. data/lib/maxmind/geoip2/record/maxmind.rb +41 -0
  23. data/lib/maxmind/geoip2/record/place.rb +52 -0
  24. data/lib/maxmind/geoip2/record/postal.rb +54 -0
  25. data/lib/maxmind/geoip2/record/represented_country.rb +47 -0
  26. data/lib/maxmind/geoip2/record/subdivision.rb +72 -0
  27. data/lib/maxmind/geoip2/record/traits.rb +224 -0
  28. data/lib/minfraud.rb +33 -8
  29. data/lib/minfraud/assessments.rb +25 -10
  30. data/lib/minfraud/components/account.rb +3 -1
  31. data/lib/minfraud/components/addressable.rb +11 -9
  32. data/lib/minfraud/components/base.rb +29 -5
  33. data/lib/minfraud/components/billing.rb +2 -0
  34. data/lib/minfraud/components/credit_card.rb +8 -1
  35. data/lib/minfraud/components/custom_inputs.rb +16 -0
  36. data/lib/minfraud/components/device.rb +13 -0
  37. data/lib/minfraud/components/email.rb +2 -0
  38. data/lib/minfraud/components/event.rb +15 -8
  39. data/lib/minfraud/components/order.rb +4 -1
  40. data/lib/minfraud/components/payment.rb +138 -14
  41. data/lib/minfraud/components/report/transaction.rb +69 -0
  42. data/lib/minfraud/components/shipping.rb +2 -4
  43. data/lib/minfraud/components/shopping_cart.rb +4 -1
  44. data/lib/minfraud/components/shopping_cart_item.rb +2 -2
  45. data/lib/minfraud/enum.rb +7 -4
  46. data/lib/minfraud/error_handler.rb +29 -9
  47. data/lib/minfraud/errors.rb +2 -0
  48. data/lib/minfraud/http_service.rb +13 -4
  49. data/lib/minfraud/http_service/request.rb +4 -1
  50. data/lib/minfraud/http_service/response.rb +40 -6
  51. data/lib/minfraud/model/abstract.rb +20 -0
  52. data/lib/minfraud/model/address.rb +52 -0
  53. data/lib/minfraud/model/billing_address.rb +11 -0
  54. data/lib/minfraud/model/credit_card.rb +75 -0
  55. data/lib/minfraud/model/device.rb +54 -0
  56. data/lib/minfraud/model/disposition.rb +35 -0
  57. data/lib/minfraud/model/email.rb +54 -0
  58. data/lib/minfraud/model/email_domain.rb +24 -0
  59. data/lib/minfraud/model/error.rb +28 -0
  60. data/lib/minfraud/model/factors.rb +24 -0
  61. data/lib/minfraud/model/geoip2_location.rb +25 -0
  62. data/lib/minfraud/model/insights.rb +68 -0
  63. data/lib/minfraud/model/ip_address.rb +82 -0
  64. data/lib/minfraud/model/issuer.rb +49 -0
  65. data/lib/minfraud/model/score.rb +76 -0
  66. data/lib/minfraud/model/score_ip_address.rb +23 -0
  67. data/lib/minfraud/model/shipping_address.rb +30 -0
  68. data/lib/minfraud/model/subscores.rb +175 -0
  69. data/lib/minfraud/model/warning.rb +63 -0
  70. data/lib/minfraud/report.rb +40 -0
  71. data/lib/minfraud/resolver.rb +16 -13
  72. data/lib/minfraud/version.rb +3 -1
  73. data/minfraud.gemspec +21 -15
  74. metadata +84 -19
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 6a55c03cbdb1487ae09c4e1e8b0286b53f49ae98
4
- data.tar.gz: 436b76d31314d1971fd511cce43e05d1cf80f1f4
2
+ SHA256:
3
+ metadata.gz: 5523cb6babed5c559ba622141b2db65a2396cbb016c6215ec641ba765fc01d10
4
+ data.tar.gz: 54dbf8b2cc34be45a428da2017f09b7cb2d7445c94ff7f37dda0a26c28a3fbfe
5
5
  SHA512:
6
- metadata.gz: febcdcdfc8828f99424d485f041f621ef9763b2eca5f2b7a401b5ad54b2f1b312711d47c782cd8f986848fdac46a749e17621e88f86bb98e9e6693cde3d8980a
7
- data.tar.gz: 28279d249f2cc2495e4223337900f90c875eb48e6a667a75c994a8dc8ff19a9d0512b1914eac748e60a8a16a0d0973ee179f77c77657b4dad1185fdd2199cb3b
6
+ metadata.gz: 80142ac976fb6df365a3192a96dbf62c8ea7935f4ca9fea89333d0e2f2e64f5e4af402dc03814f58f268e354ed7adcb5c61134fb2d526c0a06b48581cad3fc54
7
+ data.tar.gz: a9b6caf26aaee87f5ebc479391cda46d3489cf591315772c481d722b343399edfc5ad40fca8eac0d740d826c0021bcf33d3aade2419247d26d1787328763599b
@@ -0,0 +1,46 @@
1
+ name: ruby-versions
2
+ on:
3
+ push:
4
+ paths-ignore:
5
+ - "**.md"
6
+ pull_request:
7
+ paths-ignore:
8
+ - "**.md"
9
+ jobs:
10
+ run:
11
+ name: ruby
12
+ runs-on: ${{ matrix.os }}
13
+ strategy:
14
+ fail-fast: false
15
+ matrix:
16
+ os: [ubuntu-latest, windows-latest, macos-latest]
17
+ version:
18
+ [
19
+ "2.2",
20
+ "2.3",
21
+ "2.4",
22
+ "2.5",
23
+ "2.6",
24
+ "2.7",
25
+ "head",
26
+ "jruby",
27
+ "jruby-head",
28
+ ]
29
+ exclude:
30
+ - os: windows-latest
31
+ version: "jruby"
32
+ - os: windows-latest
33
+ version: "jruby-head"
34
+ steps:
35
+ - name: checkout
36
+ uses: actions/checkout@v2
37
+
38
+ - uses: ruby/setup-ruby@v1
39
+ with:
40
+ ruby-version: ${{ matrix.version }}
41
+ - name: ruby version
42
+ run: ruby -v
43
+ - run: bundler install
44
+ name: install
45
+ - run: bundler exec rake -t
46
+ name: test
data/.gitignore CHANGED
@@ -1,7 +1,9 @@
1
+ /coverage
1
2
  pkg
2
3
  .project
3
4
  Gemfile.lock
4
5
  .rvmrc
5
6
  *.rbc
7
+ .yardoc
6
8
  *~
7
9
  .DS_Store
@@ -0,0 +1,127 @@
1
+ Gemspec/RequiredRubyVersion:
2
+ Enabled: false # We support 1.9, but newer rubocops don't.
3
+
4
+ # Metrics.
5
+
6
+ Metrics/BlockLength:
7
+ Enabled: false # Default is true, but mostly hit in tests.
8
+
9
+ Metrics/AbcSize:
10
+ Enabled: false # To allow for pre-existing code.
11
+
12
+ Metrics/ClassLength:
13
+ Enabled: false # To allow for pre-existing code.
14
+
15
+ Metrics/CyclomaticComplexity:
16
+ Enabled: false # To allow for pre-existing code.
17
+
18
+ Metrics/MethodLength:
19
+ Enabled: false # To allow for pre-existing code.
20
+
21
+ Metrics/PerceivedComplexity:
22
+ Enabled: false # To allow for pre-existing code.
23
+
24
+ # Layout.
25
+
26
+ Layout/LineLength:
27
+ Max: 150 # Default is 120.
28
+
29
+ Layout/HashAlignment:
30
+ EnforcedHashRocketStyle: table # Default is key.
31
+ EnforcedColonStyle: table # Default is key.
32
+
33
+ Layout/ExtraSpacing:
34
+ ForceEqualSignAlignment: true # Default is false.
35
+
36
+ Layout/IndentationStyle:
37
+ IndentationWidth: 2 # Default is <none>.
38
+
39
+ # Style.
40
+
41
+ Style/HashSyntax:
42
+ EnforcedStyle: ruby19_no_mixed_keys # Default is ruby19.
43
+
44
+ Style/CollectionMethods:
45
+ Enabled: true # Default is false.
46
+
47
+ Style/NumericLiterals:
48
+ MinDigits: 4 # Default is 5.
49
+
50
+ Style/NegatedIf: # I disagree with this.
51
+ Enabled: false
52
+
53
+ Style/IfUnlessModifier: # This doesn't always make sense.
54
+ Enabled: false
55
+
56
+ Style/SymbolArray:
57
+ EnforcedStyle: brackets # Default is percent, but 1.9 doesn't support that.
58
+
59
+ # Trailing commas are often good.
60
+ Style/TrailingCommaInArguments:
61
+ Enabled: false
62
+ Style/TrailingCommaInArrayLiteral:
63
+ Enabled: false
64
+ Style/TrailingCommaInHashLiteral:
65
+ Enabled: false
66
+
67
+ Style/SafeNavigation:
68
+ Enabled: false # Default is true, but this 1.9 doesn't support it.
69
+
70
+ # Default is both which is probably fine, but it changes code and I don't want
71
+ # to investigate any possible behavior change right now.
72
+ Style/EmptyElse:
73
+ EnforcedStyle: empty
74
+
75
+ Style/ConditionalAssignment:
76
+ Enabled: false # This produces kind of strange results.
77
+
78
+ Style/Dir:
79
+ Enabled: false # This is good, but not supported on 1.9.
80
+
81
+ Style/ExpandPathArguments:
82
+ Enabled: false # This causes us to use __dir__ which 1.9 doesn't support.
83
+
84
+ Style/GuardClause:
85
+ Enabled: false # Doesn't always make sense.
86
+
87
+ Style/Documentation:
88
+ Enabled: false # We should enable this, but allow for pre-existing code.
89
+
90
+ Style/FormatStringToken:
91
+ Enabled: false # Seems unnecessary.
92
+
93
+ # Naming.
94
+
95
+ Naming/VariableNumber:
96
+ Enabled: false # Doesn't always make sense.
97
+
98
+ # These are new and rubocop warns if you don't configure them.
99
+
100
+ Layout/EmptyLinesAroundAttributeAccessor:
101
+ Enabled: true
102
+ Layout/SpaceAroundMethodCallOperator:
103
+ Enabled: true
104
+ Lint/DeprecatedOpenSSLConstant:
105
+ Enabled: true
106
+ Lint/MixedRegexpCaptureTypes:
107
+ Enabled: true
108
+ Lint/RaiseException:
109
+ Enabled: true
110
+ Lint/StructNewOverride:
111
+ Enabled: true
112
+ Style/ExponentialNotation:
113
+ Enabled: true
114
+ Style/HashEachMethods:
115
+ Enabled: true
116
+ Style/HashTransformKeys:
117
+ Enabled: true
118
+ Style/HashTransformValues:
119
+ Enabled: true
120
+ Style/RedundantFetchBlock:
121
+ Enabled: true
122
+ Style/RedundantRegexpCharacterClass:
123
+ Enabled: true
124
+ Style/RedundantRegexpEscape:
125
+ Enabled: true
126
+ Style/SlicingWithRange:
127
+ Enabled: true
@@ -1,5 +1,22 @@
1
- sudo: false
2
1
  language: ruby
2
+
3
3
  rvm:
4
- - 2.3.1
5
- before_install: gem install bundler -v 1.12.5
4
+ - 1.9
5
+ - 2.0
6
+ - 2.1
7
+ - 2.2
8
+ - 2.3
9
+ - 2.4
10
+ - 2.5
11
+ - 2.6
12
+ - 2.7
13
+
14
+ notifications:
15
+ email:
16
+ on_failure: always
17
+ on_success: change
18
+ recipients:
19
+ - dev-ci@maxmind.com
20
+ slack:
21
+ rooms:
22
+ secure: "wuwMo+BWnaBtkt1uGAi4Zd0EARX3B2TXDmBGCtn8r4PLfehh61S6nLQDASNXSk200PmniFM8PyOUNVGVJqWpYQAEMn32WWdy4vTK2c8CsjwfsMhgnOI2YDCzw+jiP+8EfIGBsPO4xA7yrzweP8gkzBtplb3LbaCiW83WfFo9+402yr0/0F9gfWi8qvuIw29XAS1XWhTY4itqGfkSPdOHQz/45ElpLkGlgreuRrih3tAgn9YLb/Uh/6McHfHkL74YwQU3p0NiZcoleWYM0CLpPzyrN8EsbmIT+L75nIVwXnh62Gx2jJWayj7ZzvyKtVKHtLb/LKRs4Dg0UEg65xX1EcBAkC5fn4KG1jQHvi/tdOx1Sfh3hO6OK+68q1R6cQQYy+uG84q8RUjpO6dzFcWpE1yMdbQ5XMKfTh56ZdhXJ803LD2gGeIgcMwJp6HK9tnf0vaPPI9kbr8fqJBUUkciUoqpYzFd5m0ZCUbJsMD0oPY19FSRtfCNQvCbmhYrLy1sQ5FeMzbF0bi2oaUv+JD/A5RKokNMrrwv3nnTtG4vN1hJklQk2VW3sZWl6UjYgzhrbmKABtvPuB+xcYywIu4+JSworpfDwM/PZAKOfd6n+r8OdNV256l8WaNeF6osvXkUR7yxYpytywdQPA0d/z8mxTVoATE3wat7pnmTrqI5fqw=\n"
@@ -0,0 +1,56 @@
1
+ # Minfraud Changelog
2
+
3
+ ## v1.2.0 (2020-07-15)
4
+
5
+ * Adds new processor types to `Minfraud::Components::Payment`: `:cashfree`,
6
+ `:first_atlantic_commerce`, `:komoju`, `:paytm`, `:razorpay`, and
7
+ `:systempay`.
8
+ * Adds support for three new Factors outputs: `/subscores/device` (the risk
9
+ associated with the device), `/subscores/email_local_part` (the risk
10
+ associated with the part of the email address before the @ symbol) and
11
+ `/subscores/shipping_address` (the risk associated with the shipping
12
+ address).
13
+ * Adds support for providing your MaxMind account ID using the `account_id`
14
+ attribute instead of the `user_id` attribute. In a future release,
15
+ support for the `user_id` attribute will be removed.
16
+
17
+ ## v1.1.0 (2020-06-19)
18
+
19
+ * Adds support for the minFraud Report Transaction API. Reporting
20
+ transactions to MaxMind helps us detect about 10-50% more fraud and
21
+ reduce false positives for you.
22
+ * Adds support for the new credit card output `/credit_card/is_business`.
23
+ This indicates whether the card is a business card. It may be accessed
24
+ via `response.credit_credit.is_business` on the minFraud Insights and
25
+ Factors response objects.
26
+ * Adds support for the new email domain output `/email/domain/first_seen`.
27
+ This may be accessed via `response.email.domain.first_seen` on the
28
+ minFraud Insights and Factors response objects.
29
+ * Rename `ErrorHandler#inspect` to `ErrorHandler#examine` in order not to
30
+ break LSP.
31
+ * Adds classes for the Score, Insights, and Factors responses. This allows
32
+ us to provide API documentation for the various response attributes.
33
+ * Removes `hashie` as a required dependency.
34
+ * Adds new processor types to `Minfraud::Components::Payment`: `:affirm`,
35
+ `:afterpay`, `:cardpay`, `:ccavenue`, `:cetelem`, `:ct_payments`,
36
+ `:dalenys`, `:datacash`, `:dotpay`, `:ecommpay`, `:epx`, `:g2a_pay`,
37
+ `:gocardless`, `:interac`, `:klarna`, `:mercanet`, `:oney`, `:payeezy`,
38
+ `:paylike`, `:payment_express`, `:paysafecard`, `:posconnect`,
39
+ `:smartdebit`, `:synapsefi`, and others.
40
+ * Adds support for passing custom inputs to minFraud. GitHub #6.
41
+ * Adds `:email_change`, `:password_reset`, and `:payout_change` as types to
42
+ `Minfraud::Components::Event`.
43
+ * Adds support for the `session_id` and `session_age` inputs.
44
+
45
+ ## v1.0.4 (2016-12-23)
46
+
47
+ * Prevents boolean value conversion to string to avoid warnings
48
+ * Adds `amount` attribute to the `Minfraud::Components::Order` instances
49
+
50
+ ## v1.0.3 (2016-11-24)
51
+ * Adds `token` attribute to the `Minfraud::Components::CreditCard` instances
52
+ according to the MinFraud Release Notes introduced on November 17, 2016
53
+
54
+ ## v1.0.2 (2016-10-11)
55
+
56
+ * Adds support for Ruby >= 1.9
@@ -35,7 +35,7 @@ This code of conduct applies both within project spaces and in public spaces
35
35
  when an individual is representing the project or its community.
36
36
 
37
37
  Instances of abusive, harassing, or otherwise unacceptable behavior may be
38
- reported by contacting a project maintainer at kushnir.yb@gmail.com. All
38
+ reported by contacting a project maintainer at support@maxmind.com. All
39
39
  complaints will be reviewed and investigated and will result in a response that
40
40
  is deemed necessary and appropriate to the circumstances. Maintainers are
41
41
  obligated to maintain confidentiality with regard to the reporter of an
@@ -43,7 +43,7 @@ incident.
43
43
 
44
44
  This Code of Conduct is adapted from the [Contributor Covenant][homepage],
45
45
  version 1.3.0, available at
46
- [http://contributor-covenant.org/version/1/3/0/][version]
46
+ [https://contributor-covenant.org/version/1/3/0/][version]
47
47
 
48
- [homepage]: http://contributor-covenant.org
49
- [version]: http://contributor-covenant.org/version/1/3/0/
48
+ [homepage]: https://contributor-covenant.org
49
+ [version]: https://contributor-covenant.org/version/1/3/0/
data/Gemfile CHANGED
@@ -1,5 +1,14 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
- # Specify your gem's dependencies in minfraud.gemspec
4
- gem 'coveralls', require: false
5
+ # coveralls fails on Ruby 1.9. My understanding is we don't need to run this on
6
+ # more than one version anyway, so restrict to the current latest.
7
+ version_pieces = RUBY_VERSION.split('.')
8
+ major_version = version_pieces[0]
9
+ minor_version = version_pieces[1]
10
+ if major_version == '2' && minor_version == '7'
11
+ gem 'coveralls', require: false
12
+ end
13
+
5
14
  gemspec
@@ -1,6 +1,7 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2016 kushnir.yb
3
+ Copyright (c) 2016-2020 kushnir.yb
4
+ Copyright (c) 2020 MaxMind, Inc.
4
5
 
5
6
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
7
  of this software and associated documentation files (the "Software"), to deal
@@ -0,0 +1,4 @@
1
+ # How to release
2
+
3
+ See
4
+ [here](https://github.com/maxmind/MaxMind-DB-Reader-ruby/blob/master/README.dev.md).
data/README.md CHANGED
@@ -1,12 +1,18 @@
1
- # Simple Ruby Wrapper to the MaxMind minFraud API
1
+ # Ruby API for MaxMind minFraud Services
2
2
 
3
- [![Code Climate](https://codeclimate.com/github/kushniryb/minfraud-api-v2/badges/gpa.svg)](https://codeclimate.com/github/kushniryb/minfraud-api-v2)
4
- [![Coverage Status](https://coveralls.io/repos/github/kushniryb/minfraud-api-v2/badge.svg?branch=master)](https://coveralls.io/github/kushniryb/minfraud-api-v2?branch=master)
5
- [![Build Status](https://travis-ci.org/kushniryb/minfraud-api-v2.svg?branch=master)](https://travis-ci.org/kushniryb/minfraud-api-v2)
3
+ ## Description
6
4
 
7
- Compatible with version minFraud API v2.0
5
+ This package provides an API for the [MaxMind minFraud web
6
+ services](https://dev.maxmind.com/minfraud/). This includes minFraud Score,
7
+ Insights, and Factors. It also includes our [minFraud Report Transaction
8
+ API](https://dev.maxmind.com/minfraud/report-transaction/).
8
9
 
9
- [minFraud API documentation](http://dev.maxmind.com/minfraud/)
10
+ The legacy minFraud Standard and Premium services are not supported by this
11
+ API.
12
+
13
+ ## Requirements
14
+
15
+ This gem works with Ruby 1.9 and above.
10
16
 
11
17
  ## Installation
12
18
 
@@ -27,81 +33,146 @@ Or install it yourself as:
27
33
  $ gem install minfraud
28
34
  ```
29
35
 
30
- ## Configuration
36
+ ## Usage
37
+
38
+ ### Configuration
31
39
 
32
- User Id and License Key are required to work with minFraud API
40
+ An account ID and license key are required to work with the web services.
33
41
 
34
42
  ```ruby
35
43
  Minfraud.configure do |c|
44
+ c.account_id = 12345
36
45
  c.license_key = 'your_license_key'
37
- c.user_id = 'your_user_id'
38
46
  end
39
- ```
47
+ ````
48
+
49
+ ### Making a minFraud Score, Insights, or Factors Request
40
50
 
41
- ## Usage
42
51
  ```ruby
43
- # You can either provide a hash of params to initializer
52
+ # You can either provide a hash of parameters to the initializer
44
53
  assessment = Minfraud::Assessments.new(
45
54
  device: {
46
55
  ip_address: '1.2.3.4.5'
47
56
  }
48
57
  )
49
- # or create a component and assign them to assessments object directly, e.g
58
+ # or create a component and assign them to the assessments object directly
50
59
  device = Minfraud::Components::Device.new(ip_address: '1.2.3.4.5')
51
60
  assessment = Minfraud::Assessments.new(device: device)
52
61
  # or
53
62
  assessment = Minfraud::Assessments.new
54
63
  assessment.device = device
55
- # There are multiple components that reflect minFraud request top level keys
56
64
 
57
- # Some components will raise an error if provided with the wrong values for attributes, e.g
65
+ # There are multiple components that reflect the minFraud request top level
66
+ # keys.
67
+
68
+ # Some components will raise an error if provided with the wrong values for
69
+ # attributes, e.g
58
70
  event = Minfraud::Components::Event.new(type: 'foobar') # => Minfraud::NotEnumValueError
59
- # You can check the list of permitted values for the attribute by calling a class method
71
+
72
+ # You can check the list of permitted values for the attribute by calling a
73
+ # class method
60
74
  Minfraud::Components::Event.type_values # => ["account_creation", "account_login", ....]
61
75
 
62
- # You can now call 3 different minFraud endpoints: score, insights, factors
76
+ # You can now call 3 different minFraud endpoints: score, insights and factors
77
+ assessment.score
63
78
  assessment.insights
64
79
  assessment.factors
65
80
 
66
81
  result = assessment.score # => Minfraud::Response instance
67
82
 
68
83
  result.status # => Response status code
69
- result.code # => minFraud specific response code
70
- result.body # => Mashified body
84
+ result.code # => minFraud-specific response code
85
+ result.body # => Response body
71
86
  result.headers # => Response headers
72
87
 
73
- # You can also change data inbetween requests
88
+ # You can change data between requests
74
89
  first_request = assessment.insights
75
90
  assessment.device.ip_address = '22.22.22.33'
76
91
  second_request = assessment.insights
77
92
  ```
78
93
 
79
- ### Exception handling
94
+ See the [API documentation](https://www.rubydoc.info/gems/minfraud) for
95
+ more details.
80
96
 
81
- Gem is supplied with four different types of exceptions:
82
- ```ruby
83
- # Raised if unpermitted key is provided to Minfraud::Assessments initializer
84
- class RequestFormatError < BaseError; end
97
+ ### Reporting a Transaction to MaxMind
98
+
99
+ MaxMind encourages the use of this API, as data received through this
100
+ channel is continually used to improve the accuracy of their fraud
101
+ detection algorithms.
85
102
 
86
- # Raised if IP address is absent / it is reserved / JSON body can not be decoded
87
- class ClientError < BaseError; end
103
+ To use the Report Transactions API, create a new
104
+ `Minfraud::Components::Report::Transaction` object. An IP address and a
105
+ valid tag are required arguments for this API. Additional params may also
106
+ be set, as documented below.
88
107
 
89
- # Raised if there are some problems with the user id and / or license key
90
- class AuthorizationError < BaseError; end
108
+ If the report is successful, nothing is returned. If the report fails, an
109
+ exception with be thrown.
91
110
 
92
- # Raised if minFraud returns an error, or if there is an HTTP error
93
- class ServerError < BaseError; end
111
+ See the API documentation for more details.
94
112
 
95
- # Raised if an attribute value doesn't belong to the predefined set of values
96
- class NotEnumValueError < BaseError; end
113
+ ```ruby
114
+ # The report_transaction method only makes use of a transaction component:
115
+ txn = Minfraud::Components::Report::Transaction.new(
116
+ ip_address: '1.2.3.4',
117
+ tag: :suspected_fraud,
118
+ maxmind_id: '12345678',
119
+ minfraud_id: '58fa38d8-4b87-458b-a22b-f00eda1aa20d',
120
+ notes: 'notes go here',
121
+ transaction_id: '1FA254yZ'
122
+ )
123
+ reporter = Minfraud::Report.new(transaction: txn)
124
+ reporter.report_transaction
97
125
  ```
98
126
 
127
+ See the [API documentation](https://www.rubydoc.info/gems/minfraud) for
128
+ more details.
129
+
130
+ ### Exceptions
131
+
132
+ The gem supplies several distinct exception-types:
133
+
134
+ * `RequestFormatError` - Raised if unpermitted key is provided to the
135
+ `Minfraud::Assessments` initializer
136
+ * `ClientError` - Raised if the IP address is absent, reserved or the JSON
137
+ body cannot be decoded
138
+ * `AuthorizationError` - Raised if there are problems with the account ID
139
+ and/or license key
140
+ * `ServerError` - Raised if minFraud returns an error or if there is an
141
+ HTTP error
142
+ * `NotEnumValueError` - Raised if an attribute value doesn't belong to the
143
+ predefined set of values
144
+
145
+ ## Support
146
+
147
+ Please report all issues with this code using the
148
+ [GitHub issue tracker](https://github.com/maxmind/minfraud-api-ruby/issues).
149
+
150
+ If you are having an issue with the minFraud service that is not specific
151
+ to the client API, please see
152
+ [our support page](https://www.maxmind.com/en/support).
153
+
99
154
  ## Contributing
100
155
 
101
- Bug reports and pull requests are welcome on GitHub [here](https://github.com/kushniryb/minfraud-api-v2). This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
156
+ Bug reports and pull requests are welcome on
157
+ [GitHub](https://github.com/maxmind/minfraud-api-ruby). This project is
158
+ intended to be a safe, welcoming space for collaboration, and contributors
159
+ are expected to adhere to the [Contributor
160
+ Covenant](https://contributor-covenant.org) code of conduct.
161
+
162
+ ## Versioning
163
+
164
+ This API uses [Semantic Versioning](https://semver.org/).
165
+
166
+ ## Copyright and License
167
+
168
+ Copyright (c) 2016-2020 kushnir.yb.
102
169
 
170
+ Copyright (c) 2020 MaxMind, Inc.
103
171
 
104
- ## License
172
+ The gem is available as open source under the terms of the [MIT
173
+ License](https://opensource.org/licenses/MIT).
105
174
 
106
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
175
+ ## Thank You
107
176
 
177
+ This gem is the work of the creator and original maintainer kushnir.yb
178
+ (@kushniryb).