Class: ThePlaidApi::BeaconReport

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

Overview

A Beacon Report describes the type of fraud committed by a user as well as the date the fraud was committed and the total amount of money lost due to the fraud incident. This information is used to block similar fraud attempts on your platform as well as alert other companies who screen a user with matching identity information. Other companies will not receive any new identity information, just what matched, plus information such as industry, type of fraud, and date of fraud. You can manage your fraud reports by adding, deleting, or editing reports as you get additional information on fraudulent users.

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(id:, beacon_user_id:, created_at:, type:, fraud_date:, event_date:, fraud_amount:, audit_trail:, additional_properties: nil) ⇒ BeaconReport

Returns a new instance of BeaconReport.



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/the_plaid_api/models/beacon_report.rb', line 90

def initialize(id:, beacon_user_id:, created_at:, type:, fraud_date:,
               event_date:, fraud_amount:, audit_trail:,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @id = id
  @beacon_user_id = beacon_user_id
  @created_at = created_at
  @type = type
  @fraud_date = fraud_date
  @event_date = event_date
  @fraud_amount = fraud_amount
  @audit_trail = audit_trail
  @additional_properties = additional_properties
end

Instance Attribute Details

#audit_trailBeaconAuditTrail

Information about the last change made to the parent object specifying what caused the change as well as when it occurred.

Returns:



61
62
63
# File 'lib/the_plaid_api/models/beacon_report.rb', line 61

def audit_trail
  @audit_trail
end

#beacon_user_idString

ID of the associated Beacon User.

Returns:

  • (String)


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

def beacon_user_id
  @beacon_user_id
end

#created_atDateTime

An ISO8601 formatted timestamp.

Returns:

  • (DateTime)


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

def created_at
  @created_at
end

#event_dateDate

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

Returns:

  • (Date)


51
52
53
# File 'lib/the_plaid_api/models/beacon_report.rb', line 51

def event_date
  @event_date
end

#fraud_amountFraudAmount

The amount and currency of the fraud or attempted fraud. ‘fraud_amount` should be omitted to indicate an unknown fraud amount.

Returns:



56
57
58
# File 'lib/the_plaid_api/models/beacon_report.rb', line 56

def fraud_amount
  @fraud_amount
end

#fraud_dateDate

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

Returns:

  • (Date)


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

def fraud_date
  @fraud_date
end

#idString

ID of the associated Beacon Report.

Returns:

  • (String)


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

def id
  @id
end

#typeBeaconReportType

The type of Beacon Report. ‘first_party`: If this is the same individual as the one who submitted the KYC. `stolen`: If this is a different individual from the one who submitted the KYC. `synthetic`: If this is an individual using fabricated information. `account_takeover`: If this individual’s account was compromised. ‘data_breach`: If this individual’s data was compromised in a breach. ‘unknown`: If you aren’t sure who committed the fraud.

Returns:



43
44
45
# File 'lib/the_plaid_api/models/beacon_report.rb', line 43

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# File 'lib/the_plaid_api/models/beacon_report.rb', line 108

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash.key?('id') ? hash['id'] : nil
  beacon_user_id =
    hash.key?('beacon_user_id') ? hash['beacon_user_id'] : nil
  created_at = if hash.key?('created_at')
                 (DateTimeHelper.from_rfc3339(hash['created_at']) if hash['created_at'])
               end
  type = hash.key?('type') ? hash['type'] : nil
  fraud_date = hash.key?('fraud_date') ? hash['fraud_date'] : nil
  event_date = hash.key?('event_date') ? hash['event_date'] : nil
  fraud_amount = FraudAmount.from_hash(hash['fraud_amount']) if hash['fraud_amount']
  audit_trail = BeaconAuditTrail.from_hash(hash['audit_trail']) if hash['audit_trail']

  # 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.
  BeaconReport.new(id: id,
                   beacon_user_id: beacon_user_id,
                   created_at: created_at,
                   type: type,
                   fraud_date: fraud_date,
                   event_date: event_date,
                   fraud_amount: fraud_amount,
                   audit_trail: audit_trail,
                   additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/the_plaid_api/models/beacon_report.rb', line 64

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['beacon_user_id'] = 'beacon_user_id'
  @_hash['created_at'] = 'created_at'
  @_hash['type'] = 'type'
  @_hash['fraud_date'] = 'fraud_date'
  @_hash['event_date'] = 'event_date'
  @_hash['fraud_amount'] = 'fraud_amount'
  @_hash['audit_trail'] = 'audit_trail'
  @_hash
end

.nullablesObject

An array for nullable fields



83
84
85
86
87
88
# File 'lib/the_plaid_api/models/beacon_report.rb', line 83

def self.nullables
  %w[
    fraud_date
    fraud_amount
  ]
end

.optionalsObject

An array for optional fields



78
79
80
# File 'lib/the_plaid_api/models/beacon_report.rb', line 78

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



157
158
159
160
161
162
163
# File 'lib/the_plaid_api/models/beacon_report.rb', line 157

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id.inspect}, beacon_user_id: #{@beacon_user_id.inspect}, created_at:"\
  " #{@created_at.inspect}, type: #{@type.inspect}, fraud_date: #{@fraud_date.inspect},"\
  " event_date: #{@event_date.inspect}, fraud_amount: #{@fraud_amount.inspect}, audit_trail:"\
  " #{@audit_trail.inspect}, additional_properties: #{@additional_properties}>"
end

#to_custom_created_atObject



143
144
145
# File 'lib/the_plaid_api/models/beacon_report.rb', line 143

def to_custom_created_at
  DateTimeHelper.to_rfc3339(created_at)
end

#to_sObject

Provides a human-readable string representation of the object.



148
149
150
151
152
153
154
# File 'lib/the_plaid_api/models/beacon_report.rb', line 148

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id}, beacon_user_id: #{@beacon_user_id}, created_at: #{@created_at},"\
  " type: #{@type}, fraud_date: #{@fraud_date}, event_date: #{@event_date}, fraud_amount:"\
  " #{@fraud_amount}, audit_trail: #{@audit_trail}, additional_properties:"\
  " #{@additional_properties}>"
end