Class: ThePlaidApi::RiskCheckEmail

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

Overview

Result summary object specifying values for ‘email` 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(is_deliverable:, breach_count:, first_breached_at:, last_breached_at:, domain_registered_at:, domain_is_free_provider:, domain_is_custom:, domain_is_disposable:, top_level_domain_is_suspicious:, linked_services:, risk_level: SKIP, factors: SKIP, additional_properties: nil) ⇒ RiskCheckEmail

Returns a new instance of RiskCheckEmail.



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/the_plaid_api/models/risk_check_email.rb', line 107

def initialize(is_deliverable:, breach_count:, first_breached_at:,
               last_breached_at:, domain_registered_at:,
               domain_is_free_provider:, domain_is_custom:,
               domain_is_disposable:, top_level_domain_is_suspicious:,
               linked_services:, risk_level: SKIP, factors: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @is_deliverable = is_deliverable
  @breach_count = breach_count
  @first_breached_at = first_breached_at
  @last_breached_at = last_breached_at
  @domain_registered_at = domain_registered_at
  @domain_is_free_provider = domain_is_free_provider
  @domain_is_custom = domain_is_custom
  @domain_is_disposable = domain_is_disposable
  @top_level_domain_is_suspicious = top_level_domain_is_suspicious
  @linked_services = linked_services
  @risk_level = risk_level unless risk_level == SKIP
  @factors = factors unless factors == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#breach_countInteger

Count of all known breaches of this email address if known.

Returns:

  • (Integer)


19
20
21
# File 'lib/the_plaid_api/models/risk_check_email.rb', line 19

def breach_count
  @breach_count
end

#domain_is_customRiskCheckEmailDomainIsCustom

Indicates whether the email address domain is custom if known, i.e. a company domain and not free or disposable.



41
42
43
# File 'lib/the_plaid_api/models/risk_check_email.rb', line 41

def domain_is_custom
  @domain_is_custom
end

#domain_is_disposableRiskCheckEmailDomainIsDisposable

Indicates whether the email domain is listed as disposable if known. Disposable domains are often used to create email addresses that are part of a fake set of user details.



47
48
49
# File 'lib/the_plaid_api/models/risk_check_email.rb', line 47

def domain_is_disposable
  @domain_is_disposable
end

#domain_is_free_providerRiskCheckEmailDomainIsFreeProvider

Indicates whether the email address domain is a free provider such as Gmail or Hotmail if known.



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

def domain_is_free_provider
  @domain_is_free_provider
end

#domain_registered_atDate

A date in the format YYYY-MM-DD (RFC 3339 Section 5.6).

Returns:

  • (Date)


31
32
33
# File 'lib/the_plaid_api/models/risk_check_email.rb', line 31

def domain_registered_at
  @domain_registered_at
end

#factorsArray[String]

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

Returns:

  • (Array[String])


68
69
70
# File 'lib/the_plaid_api/models/risk_check_email.rb', line 68

def factors
  @factors
end

#first_breached_atDate

A date in the format YYYY-MM-DD (RFC 3339 Section 5.6).

Returns:

  • (Date)


23
24
25
# File 'lib/the_plaid_api/models/risk_check_email.rb', line 23

def first_breached_at
  @first_breached_at
end

#is_deliverableRiskCheckEmailIsDeliverableStatus

SMTP-MX check to confirm the email address exists if known.



15
16
17
# File 'lib/the_plaid_api/models/risk_check_email.rb', line 15

def is_deliverable
  @is_deliverable
end

#last_breached_atDate

A date in the format YYYY-MM-DD (RFC 3339 Section 5.6).

Returns:

  • (Date)


27
28
29
# File 'lib/the_plaid_api/models/risk_check_email.rb', line 27

def last_breached_at
  @last_breached_at
end

#linked_servicesArray[RiskCheckLinkedService]

A list of online services where this email address has been detected to have accounts or other activity.

Returns:



59
60
61
# File 'lib/the_plaid_api/models/risk_check_email.rb', line 59

def linked_services
  @linked_services
end

#risk_levelRiskLevel

Risk level for the given risk check type.

Returns:



63
64
65
# File 'lib/the_plaid_api/models/risk_check_email.rb', line 63

def risk_level
  @risk_level
end

#top_level_domain_is_suspiciousRiskCheckEmailTopLevelDomainIsSuspicious

Indicates whether the email address top level domain, which is the last part of the domain, is fraudulent or risky if known. In most cases, a suspicious top level domain is also associated with a disposable or high-risk domain.



54
55
56
# File 'lib/the_plaid_api/models/risk_check_email.rb', line 54

def top_level_domain_is_suspicious
  @top_level_domain_is_suspicious
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/the_plaid_api/models/risk_check_email.rb', line 132

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  is_deliverable =
    hash.key?('is_deliverable') ? hash['is_deliverable'] : nil
  breach_count = hash.key?('breach_count') ? hash['breach_count'] : nil
  first_breached_at =
    hash.key?('first_breached_at') ? hash['first_breached_at'] : nil
  last_breached_at =
    hash.key?('last_breached_at') ? hash['last_breached_at'] : nil
  domain_registered_at =
    hash.key?('domain_registered_at') ? hash['domain_registered_at'] : nil
  domain_is_free_provider =
    hash.key?('domain_is_free_provider') ? hash['domain_is_free_provider'] : nil
  domain_is_custom =
    hash.key?('domain_is_custom') ? hash['domain_is_custom'] : nil
  domain_is_disposable =
    hash.key?('domain_is_disposable') ? hash['domain_is_disposable'] : nil
  top_level_domain_is_suspicious =
    hash.key?('top_level_domain_is_suspicious') ? hash['top_level_domain_is_suspicious'] : nil
  linked_services =
    hash.key?('linked_services') ? hash['linked_services'] : 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.
  RiskCheckEmail.new(is_deliverable: is_deliverable,
                     breach_count: breach_count,
                     first_breached_at: first_breached_at,
                     last_breached_at: last_breached_at,
                     domain_registered_at: domain_registered_at,
                     domain_is_free_provider: domain_is_free_provider,
                     domain_is_custom: domain_is_custom,
                     domain_is_disposable: domain_is_disposable,
                     top_level_domain_is_suspicious: top_level_domain_is_suspicious,
                     linked_services: linked_services,
                     risk_level: risk_level,
                     factors: factors,
                     additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/the_plaid_api/models/risk_check_email.rb', line 71

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['is_deliverable'] = 'is_deliverable'
  @_hash['breach_count'] = 'breach_count'
  @_hash['first_breached_at'] = 'first_breached_at'
  @_hash['last_breached_at'] = 'last_breached_at'
  @_hash['domain_registered_at'] = 'domain_registered_at'
  @_hash['domain_is_free_provider'] = 'domain_is_free_provider'
  @_hash['domain_is_custom'] = 'domain_is_custom'
  @_hash['domain_is_disposable'] = 'domain_is_disposable'
  @_hash['top_level_domain_is_suspicious'] =
    'top_level_domain_is_suspicious'
  @_hash['linked_services'] = 'linked_services'
  @_hash['risk_level'] = 'risk_level'
  @_hash['factors'] = 'factors'
  @_hash
end

.nullablesObject

An array for nullable fields



98
99
100
101
102
103
104
105
# File 'lib/the_plaid_api/models/risk_check_email.rb', line 98

def self.nullables
  %w[
    breach_count
    first_breached_at
    last_breached_at
    domain_registered_at
  ]
end

.optionalsObject

An array for optional fields



90
91
92
93
94
95
# File 'lib/the_plaid_api/models/risk_check_email.rb', line 90

def self.optionals
  %w[
    risk_level
    factors
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



194
195
196
197
198
199
200
201
202
203
204
205
# File 'lib/the_plaid_api/models/risk_check_email.rb', line 194

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} is_deliverable: #{@is_deliverable.inspect}, breach_count:"\
  " #{@breach_count.inspect}, first_breached_at: #{@first_breached_at.inspect},"\
  " last_breached_at: #{@last_breached_at.inspect}, domain_registered_at:"\
  " #{@domain_registered_at.inspect}, domain_is_free_provider:"\
  " #{@domain_is_free_provider.inspect}, domain_is_custom: #{@domain_is_custom.inspect},"\
  " domain_is_disposable: #{@domain_is_disposable.inspect}, top_level_domain_is_suspicious:"\
  " #{@top_level_domain_is_suspicious.inspect}, linked_services: #{@linked_services.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.



182
183
184
185
186
187
188
189
190
191
# File 'lib/the_plaid_api/models/risk_check_email.rb', line 182

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} is_deliverable: #{@is_deliverable}, breach_count: #{@breach_count},"\
  " first_breached_at: #{@first_breached_at}, last_breached_at: #{@last_breached_at},"\
  " domain_registered_at: #{@domain_registered_at}, domain_is_free_provider:"\
  " #{@domain_is_free_provider}, domain_is_custom: #{@domain_is_custom}, domain_is_disposable:"\
  " #{@domain_is_disposable}, top_level_domain_is_suspicious:"\
  " #{@top_level_domain_is_suspicious}, linked_services: #{@linked_services}, risk_level:"\
  " #{@risk_level}, factors: #{@factors}, additional_properties: #{@additional_properties}>"
end