Class: Minfraud::Components::Device

Inherits:
Base
  • Object
show all
Defined in:
lib/minfraud/components/device.rb

Overview

Device corresponds to the device object of a minFraud request.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#to_json

Constructor Details

#initialize(params = {}) ⇒ Device

Returns a new instance of Device.

Parameters:

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

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



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

def initialize(params = {})
  @ip_address      = params[:ip_address]
  @user_agent      = params[:user_agent]
  @accept_language = params[:accept_language]
  @session_age     = params[:session_age]
  @session_id      = params[:session_id]

  validate
end

Instance Attribute Details

#accept_languageString?

The HTTP “Accept-Language” header of the browser used in the transaction.

Returns:

  • (String, nil)


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

def accept_language
  @accept_language
end

#ip_addressString?

The IP address associated with the device used by the customer in the transaction. The IP address must be in IPv4 or IPv6 presentation format, i.e., dotted-quad notation or the IPv6 hexadecimal-colon notation.

Returns:

  • (String, nil)


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

def ip_address
  @ip_address
end

#session_ageFloat?

The number of seconds between the creation of the user’s session and the time of the transaction. Note that session_age is not the duration of the current visit, but the time since the start of the first visit. The value must be at least 0 and at most 10^13-1.

Returns:

  • (Float, nil)


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

def session_age
  @session_age
end

#session_idString?

An ID that uniquely identifies a visitor’s session on the site.

Returns:

  • (String, nil)


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

def session_id
  @session_id
end

#user_agentString?

The HTTP “User-Agent” header of the browser used in the transaction.

Returns:

  • (String, nil)


22
23
24
# File 'lib/minfraud/components/device.rb', line 22

def user_agent
  @user_agent
end