Class: ThePlaidApi::RiskCheckDevice

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/the_plaid_api/models/risk_check_device.rb

Overview

Result summary object specifying values for ‘device` attributes of risk check.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(ip_proxy_type:, ip_spam_list_count:, ip_timezone_offset:, risk_level: SKIP, factors: SKIP, additional_properties: nil) ⇒ RiskCheckDevice

Returns a new instance of RiskCheckDevice.



75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/the_plaid_api/models/risk_check_device.rb', line 75

def initialize(ip_proxy_type:, ip_spam_list_count:, ip_timezone_offset:,
               risk_level: SKIP, factors: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @ip_proxy_type = ip_proxy_type
  @ip_spam_list_count = ip_spam_list_count
  @ip_timezone_offset = ip_timezone_offset
  @risk_level = risk_level unless risk_level == SKIP
  @factors = factors unless factors == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#factorsArray[String]

List of factors, when available, that contribute towards the risk level of the given risk check type.

Returns:

  • (Array[String])


45
46
47
# File 'lib/the_plaid_api/models/risk_check_device.rb', line 45

def factors
  @factors
end

#ip_proxy_typeProxyType

An enum indicating whether a network proxy is present and if so what type it is. ‘none_detected` indicates the user is not on a detectable proxy network. `tor` indicates the user was using a Tor browser, which sends encrypted traffic on a decentralized network and is somewhat similar to a VPN (Virtual Private Network). `vpn` indicates the user is on a VPN (Virtual Private Network) `web_proxy` indicates the user is on a web proxy server, which may allow them to conceal information such as their IP address or other identifying information. `public_proxy` indicates the user is on a public web proxy server, which is similar to a web proxy but can be shared by multiple users. This may allow multiple users to appear as if they have the same IP address for instance.

Returns:



28
29
30
# File 'lib/the_plaid_api/models/risk_check_device.rb', line 28

def ip_proxy_type
  @ip_proxy_type
end

#ip_spam_list_countInteger

Count of spam lists the IP address is associated with if known.

Returns:

  • (Integer)


32
33
34
# File 'lib/the_plaid_api/models/risk_check_device.rb', line 32

def ip_spam_list_count
  @ip_spam_list_count
end

#ip_timezone_offsetString

UTC offset of the timezone associated with the IP address.

Returns:

  • (String)


36
37
38
# File 'lib/the_plaid_api/models/risk_check_device.rb', line 36

def ip_timezone_offset
  @ip_timezone_offset
end

#risk_levelRiskLevel

Risk level for the given risk check type.

Returns:



40
41
42
# File 'lib/the_plaid_api/models/risk_check_device.rb', line 40

def risk_level
  @risk_level
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/the_plaid_api/models/risk_check_device.rb', line 89

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  ip_proxy_type = hash.key?('ip_proxy_type') ? hash['ip_proxy_type'] : nil
  ip_spam_list_count =
    hash.key?('ip_spam_list_count') ? hash['ip_spam_list_count'] : nil
  ip_timezone_offset =
    hash.key?('ip_timezone_offset') ? hash['ip_timezone_offset'] : nil
  risk_level = hash.key?('risk_level') ? hash['risk_level'] : SKIP
  factors = hash.key?('factors') ? hash['factors'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  RiskCheckDevice.new(ip_proxy_type: ip_proxy_type,
                      ip_spam_list_count: ip_spam_list_count,
                      ip_timezone_offset: ip_timezone_offset,
                      risk_level: risk_level,
                      factors: factors,
                      additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



48
49
50
51
52
53
54
55
56
# File 'lib/the_plaid_api/models/risk_check_device.rb', line 48

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['ip_proxy_type'] = 'ip_proxy_type'
  @_hash['ip_spam_list_count'] = 'ip_spam_list_count'
  @_hash['ip_timezone_offset'] = 'ip_timezone_offset'
  @_hash['risk_level'] = 'risk_level'
  @_hash['factors'] = 'factors'
  @_hash
end

.nullablesObject

An array for nullable fields



67
68
69
70
71
72
73
# File 'lib/the_plaid_api/models/risk_check_device.rb', line 67

def self.nullables
  %w[
    ip_proxy_type
    ip_spam_list_count
    ip_timezone_offset
  ]
end

.optionalsObject

An array for optional fields



59
60
61
62
63
64
# File 'lib/the_plaid_api/models/risk_check_device.rb', line 59

def self.optionals
  %w[
    risk_level
    factors
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



126
127
128
129
130
131
132
# File 'lib/the_plaid_api/models/risk_check_device.rb', line 126

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} ip_proxy_type: #{@ip_proxy_type.inspect}, ip_spam_list_count:"\
  " #{@ip_spam_list_count.inspect}, ip_timezone_offset: #{@ip_timezone_offset.inspect},"\
  " risk_level: #{@risk_level.inspect}, factors: #{@factors.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



118
119
120
121
122
123
# File 'lib/the_plaid_api/models/risk_check_device.rb', line 118

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} ip_proxy_type: #{@ip_proxy_type}, ip_spam_list_count:"\
  " #{@ip_spam_list_count}, ip_timezone_offset: #{@ip_timezone_offset}, risk_level:"\
  " #{@risk_level}, factors: #{@factors}, additional_properties: #{@additional_properties}>"
end