Class: Minfraud::Components::Event

Inherits:
Base
  • Object
show all
Includes:
Enum
Defined in:
lib/minfraud/components/event.rb

Overview

Event corresponds to the event object of a minFraud request.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Enum

included

Methods inherited from Base

#to_json

Constructor Details

#initialize(params = {}) ⇒ Event

Returns a new instance of Event.

Parameters:

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

    Hash of parameters. Each key/value should correspond to one of the available attributes.



60
61
62
63
64
65
66
67
# File 'lib/minfraud/components/event.rb', line 60

def initialize(params = {})
  @transaction_id = params[:transaction_id]
  @shop_id        = params[:shop_id]
  @time           = params[:time]
  self.type       = params[:type]

  validate
end

Instance Attribute Details

#shop_idString?

Your internal ID for the shop, affiliate, or merchant this order is coming from. Required for minFraud users who are resellers, payment providers, gateways and affiliate networks. No specific format is required.

Returns:

  • (String, nil)


25
26
27
# File 'lib/minfraud/components/event.rb', line 25

def shop_id
  @shop_id
end

#timeString?

The date and time the event occurred. The string must be in the RFC 3339 date-time format, e.g., ā€œ2012-04-12T23:20:50.52Zā€. The time must be within the past 10 years. If this field is not in the request, the current time will be used.

Returns:

  • (String, nil)

See Also:



35
36
37
# File 'lib/minfraud/components/event.rb', line 35

def time
  @time
end

#transaction_idString?

Your internal ID for the transaction. MaxMind can use this to locate a specific transaction in logs, and it will also show up in email alerts and notifications from MaxMind to you. No specific format is required.

Returns:

  • (String, nil)


17
18
19
# File 'lib/minfraud/components/event.rb', line 17

def transaction_id
  @transaction_id
end

#typeSymbol?

The type of event being scored. This must be one of :account_creation, :account_login, :email_change, :password_reset, :payout_change, :purchase, :recurring_purchase, :referral, or :survey.

Returns:

  • (Symbol, nil)


45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/minfraud/components/event.rb', line 45

enum_accessor :type,
%i[
  account_creation
  account_login
  email_change
  password_reset
  payout_change
  purchase
  recurring_purchase
  referral
  survey
]