class Minfraud::Assessments
Assessments
is used to perform minFraud Score, Insights, and Factors requests.
@see dev.maxmind.com/minfraud/
Attributes
The Account component.
@return [Minfraud::Components::Account, nil]
The Billing component.
@return [Minfraud::Components::Billing, nil]
The CreditCard component.
@return [Minfraud::Components::CreditCard, nil]
The CustomInputs component.
@return [Minfraud::Components::CustomInputs, nil]
The Device component.
@return [Minfraud::Components::Device, nil]
The Email component.
@return [Minfraud::Components::Email, nil]
The Event component.
@return [Minfraud::Components::Event, nil]
The Order component.
@return [Minfraud::Components::Order, nil]
The Payment component.
@return [Minfraud::Components::Payment, nil]
The Shipping component.
@return [Minfraud::Components::Shipping, nil]
The ShoppingCart component.
@return [Minfraud::Components::ShoppingCart, nil]
Public Class Methods
@param params [Hash] Hash of parameters. Each key is a symbol
corresponding to one of the available component attributes. Values may be component objects or hashes that will be provided to the component constructors.
@param resolver [Minfraud::Resolver] Resolver
that maps parameters to
components.
# File lib/minfraud/assessments.rb, line 74 def initialize(params = {}, resolver = ::Minfraud::Resolver) @locales = params.delete('locales') @locales = ['en'] if @locales.nil? resolver.assign(self, params) end
Public Instance Methods
Perform a minFraud Factors request.
@return [Minfraud::HTTPService::Response]
@raise [Minfraud::AuthorizationError] If there was an authentication
problem.
@raise [Minfraud::ClientError] If there was a critical problem with one
of your inputs.
@raise [Minfraud::ServerError] If the server reported an error of some
kind.
# File lib/minfraud/assessments.rb, line 93 def factors perform_request(:factors) end
Perform a minFraud Insights request.
@return [Minfraud::HTTPService::Response]
@raise [Minfraud::AuthorizationError] If there was an authentication
problem.
@raise [Minfraud::ClientError] If there was a critical problem with one
of your inputs.
@raise [Minfraud::ServerError] If the server reported an error of some
kind.
# File lib/minfraud/assessments.rb, line 109 def insights perform_request(:insights) end
Perform a minFraud Score request.
@return [Minfraud::HTTPService::Response]
@raise [Minfraud::AuthorizationError] If there was an authentication
problem.
@raise [Minfraud::ClientError] If there was a critical problem with one
of your inputs.
@raise [Minfraud::ServerError] If the server reported an error of some
kind.
# File lib/minfraud/assessments.rb, line 125 def score perform_request(:score) end
Private Instance Methods
# File lib/minfraud/assessments.rb, line 131 def perform_request(endpoint) raw = request.perform( verb: :post, endpoint: endpoint.to_s, body: request_body, ) response = ::Minfraud::HTTPService::Response.new( endpoint: endpoint, locales: @locales, status: raw.status.to_i, body: raw.body, headers: raw.headers ) ::Minfraud::ErrorHandler.examine(response) end
# File lib/minfraud/assessments.rb, line 157 def request @request ||= Request.new(::Minfraud::HTTPService.configuration) end
# File lib/minfraud/assessments.rb, line 149 def request_body MAPPING.keys.reduce({}) do |mem, e| next mem unless (value = send(e)) mem.merge!(e.to_s => value.to_json) end end