Class: Minfraud::Assessments

Inherits:
Object
  • Object
show all
Includes:
HTTPService, Resolver
Defined in:
lib/minfraud/assessments.rb

Constant Summary

Constants included from Resolver

Resolver::MAPPING

Constants included from HTTPService

HTTPService::DEFAULT_MIDDLEWARE, HTTPService::DEFAULT_SERVER

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Resolver

assign

Methods included from HTTPService

configuration

Constructor Details

#initialize(params = {}, resolver = ::Minfraud::Resolver) ⇒ Minfraud::Assessments

Note:

In case when params is a Hash of components it just assigns them to the corresponding instance variables

Returns Assessments instance.

Parameters:

  • params (Hash) (defaults to: {})

    hash of parameters

  • resolver (Minfraud::Resolver) (defaults to: ::Minfraud::Resolver)

    resolver that maps params to components


50
51
52
# File 'lib/minfraud/assessments.rb', line 50

def initialize(params = {}, resolver = ::Minfraud::Resolver)
  resolver.assign(self, params)
end

Instance Attribute Details

#accountMinfraud::Components::Account

Returns Account component.

Returns:


8
9
10
# File 'lib/minfraud/assessments.rb', line 8

def 
  @account
end

#billingMinfraud::Components::Billing

Returns Billing component.

Returns:


12
13
14
# File 'lib/minfraud/assessments.rb', line 12

def billing
  @billing
end

#credit_cardMinfraud::Components::CreditCard

Returns CreditCard component.

Returns:


16
17
18
# File 'lib/minfraud/assessments.rb', line 16

def credit_card
  @credit_card
end

#deviceMinfraud::Components::Device

Returns Device component.

Returns:


20
21
22
# File 'lib/minfraud/assessments.rb', line 20

def device
  @device
end

#emailMinfraud::Components::Email

Returns Email component.

Returns:


24
25
26
# File 'lib/minfraud/assessments.rb', line 24

def email
  @email
end

#eventMinfraud::Components::Event

Returns Event component.

Returns:


28
29
30
# File 'lib/minfraud/assessments.rb', line 28

def event
  @event
end

#orderMinfraud::Components::Order

Returns Order component.

Returns:


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

def order
  @order
end

#paymentMinfraud::Components::Payment

Returns Payment component.

Returns:


36
37
38
# File 'lib/minfraud/assessments.rb', line 36

def payment
  @payment
end

#shippingMinfraud::Components::Shipping

Returns Shipping component.

Returns:


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

def shipping
  @shipping
end

#shopping_cartMinfraud::Components::ShoppingCarat

Returns ShoppingCart component.

Returns:

  • (Minfraud::Components::ShoppingCarat)

    ShoppingCart component


44
45
46
# File 'lib/minfraud/assessments.rb', line 44

def shopping_cart
  @shopping_cart
end

Class Method Details

.define(endpoint) ⇒ Object


59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/minfraud/assessments.rb', line 59

def self.define(endpoint)
  define_method(endpoint) do
    raw       = request.perform(verb: :post, endpoint: endpoint.to_s, body: request_body)
    response  = ::Minfraud::HTTPService::Response.new(
      status:  raw.status.to_i,
      body:    raw.body,
      headers: raw.headers
    )

    ::Minfraud::ErrorHandler.inspect(response)
  end
end

Instance Method Details

#factorsMinfraud::HTTPService::Response

Makes a request to minFraud factors endpoint. Raises an error in case of invalid response

Returns:


74
# File 'lib/minfraud/assessments.rb', line 74

define :factors

#insightsMinfraud::HTTPService::Response

Makes a request to minFraud insights endpoint. Raises an error in case of invalid response

Returns:


73
# File 'lib/minfraud/assessments.rb', line 73

define :insights

#scoreMinfraud::HTTPService::Response

Makes a request to minFraud score endpoint. Raises an error in case of invalid response

Returns:


72
# File 'lib/minfraud/assessments.rb', line 72

define :score