Module: Minfraud

Defined in:
lib/minfraud/version.rb,
lib/minfraud/request.rb,
lib/minfraud/response.rb,
lib/minfraud/minfraud.rb,
lib/minfraud/transaction.rb

Defined Under Namespace

Classes: ConfigurationError, Request, Response, ResponseError, Transaction, TransactionError

Constant Summary collapse

VERSION =
"0.1.3"

Class Method Summary collapse

Class Method Details

.configure {|_self| ... } ⇒ nil, ConfigurationError

May be used to configure using common block style:

“`ruby Minfraud.configure do |c|

c.license_key = 'abcd1234'

end “`

Parameters:

  • is (Proc)

    passed the Minfraud module as its argument

Yields:

  • (_self)

Yield Parameters:

  • _self (Minfraud)

    the object that the method was called on

Returns:



22
23
24
25
26
27
# File 'lib/minfraud/minfraud.rb', line 22

def self.configure
  yield self
  unless has_required_configuration?
    raise ConfigurationError, 'You must set license_key so MaxMind can identify you'
  end
end

.has_required_configuration?Boolean

Returns service URI

Returns:

  • (Boolean)

    service URI



67
68
69
# File 'lib/minfraud/minfraud.rb', line 67

def self.has_required_configuration?
  class_variable_defined?(:@@license_key)
end

.license_keyString?

Module attribute getter for license_key This is the MaxMind API consumer's license key.

Returns:

  • (String, nil)

    license key if set



32
33
34
# File 'lib/minfraud/minfraud.rb', line 32

def self.license_key
  class_variable_defined?(:@@license_key) ? @@license_key : nil
end

.license_key=(key) ⇒ String

Module attribute setter for license_key This is the MaxMind API consumer's license key. It is required for this gem to work.

Parameters:

  • key (String)

    license key

Returns:

  • (String)

    license key



41
42
43
# File 'lib/minfraud/minfraud.rb', line 41

def self.license_key=(key)
  @@license_key = key
end

.requested_typeString?

Module attribute getter for requested_type minFraud service level (standard/premium)

Returns:

  • (String, nil)

    service level if set



48
49
50
# File 'lib/minfraud/minfraud.rb', line 48

def self.requested_type
  class_variable_defined?(:@@requested_type) ? @@requested_type : nil
end

.requested_type=(type) ⇒ String

Module attribute setter for requested_type Desired service level (standard/premium)

Parameters:

  • type (String)

    service level

Returns:

  • (String)

    service level



56
57
58
# File 'lib/minfraud/minfraud.rb', line 56

def self.requested_type=(type)
  @@requested_type = type
end

.uriURI::HTTPS

MaxMind minFraud API service URI

Returns:

  • (URI::HTTPS)

    service uri



62
63
64
# File 'lib/minfraud/minfraud.rb', line 62

def self.uri
  @@uri ||= URI('https://minfraud.maxmind.com/app/ccv2r')
end