Skip to content

Commit

Permalink
Merge pull request #8 from oschwald/greg/account-id
Browse files Browse the repository at this point in the history
Handle ACCOUNT_ID_REQUIRED error and update some text
  • Loading branch information
kushniryb committed Feb 26, 2018
2 parents 6b97c5d + f318da1 commit 0d42edc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ $ gem install minfraud

## Configuration

User Id and License Key are required to work with minFraud API
Account ID and License Key are required to work with minFraud API

```ruby
Minfraud.configure do |c|
Expand Down Expand Up @@ -86,7 +86,7 @@ class RequestFormatError < BaseError; end
# Raised if IP address is absent / it is reserved / JSON body can not be decoded
class ClientError < BaseError; end

# Raised if there are some problems with the user id and / or license key
# Raised if there are some problems with the account ID and / or license key
class AuthorizationError < BaseError; end

# Raised if minFraud returns an error, or if there is an HTTP error
Expand Down
2 changes: 1 addition & 1 deletion lib/minfraud.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
module Minfraud
class << self
# @!attribute user_id
# @return [String] MaxMind username that is used for authorization
# @return [String] MaxMind account ID that is used for authorization
attr_accessor :user_id

# @!attribute license_key
Expand Down
7 changes: 5 additions & 2 deletions lib/minfraud/error_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,17 @@ def inspect(response)
JSON_INVALID: [
ClientError, 'JSON body cannot be decoded'
],
ACCOUNT_ID_REQUIRED: [
AuthorizationError, 'You have not supplied a account ID'
],
AUTHORIZATION_INVALID: [
AuthorizationError, 'Invalid license key and / or user id'
AuthorizationError, 'Invalid license key and / or account ID'
],
LICENSE_KEY_REQUIRED: [
AuthorizationError, 'You have not supplied a license key'
],
USER_ID_REQUIRED: [
AuthorizationError, 'You have not supplied a user id'
AuthorizationError, 'You have not supplied a account id'
],
INSUFFICIENT_FUNDS: [
ClientError, 'The license key you have provided does not have a sufficient funds to use this service'
Expand Down

0 comments on commit 0d42edc

Please sign in to comment.