Class: ThePlaidApi::ProtectUserEventWebhook
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ThePlaidApi::ProtectUserEventWebhook
- Defined in:
- lib/the_plaid_api/models/protect_user_event_webhook.rb
Overview
Fired when there has been a new user event. The webhook payload contains limited information about the event. For full event details, call [‘/protect/event/get`](plaid.com/docs/api/products/protect/#protecte ventget).
Instance Attribute Summary collapse
-
#client_user_id ⇒ String
The ‘client_user_id` provided by the client when the user was created via `/user/create` or Link.
-
#environment ⇒ WebhookEnvironmentValues
The Plaid environment the webhook was sent from.
-
#event_id ⇒ String
The event ID of the user event that occurred.
-
#event_type ⇒ String
The type of user event that occurred.
-
#link_session_id ⇒ String
An identifier for the Link session this event occurred in.
-
#timestamp ⇒ DateTime
The timestamp of the event, in [ISO 8601](wikipedia.org/wiki/ISO_8601) format, e.g.
-
#user_id ⇒ String
The Plaid User ID.
-
#webhook_code ⇒ String
‘PROTECT_USER_EVENT`.
-
#webhook_type ⇒ String
‘“PROTECT”`.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(webhook_type:, webhook_code:, event_id:, event_type:, timestamp:, user_id:, environment:, client_user_id: SKIP, link_session_id: SKIP, additional_properties: nil) ⇒ ProtectUserEventWebhook
constructor
A new instance of ProtectUserEventWebhook.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_timestamp ⇒ Object
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(webhook_type:, webhook_code:, event_id:, event_type:, timestamp:, user_id:, environment:, client_user_id: SKIP, link_session_id: SKIP, additional_properties: nil) ⇒ ProtectUserEventWebhook
Returns a new instance of ProtectUserEventWebhook.
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/the_plaid_api/models/protect_user_event_webhook.rb', line 87 def initialize(webhook_type:, webhook_code:, event_id:, event_type:, timestamp:, user_id:, environment:, client_user_id: SKIP, link_session_id: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @webhook_type = webhook_type @webhook_code = webhook_code @event_id = event_id @event_type = event_type @timestamp = @user_id = user_id @client_user_id = client_user_id unless client_user_id == SKIP @link_session_id = link_session_id unless link_session_id == SKIP @environment = environment @additional_properties = additional_properties end |
Instance Attribute Details
#client_user_id ⇒ String
The ‘client_user_id` provided by the client when the user was created via `/user/create` or Link.
45 46 47 |
# File 'lib/the_plaid_api/models/protect_user_event_webhook.rb', line 45 def client_user_id @client_user_id end |
#environment ⇒ WebhookEnvironmentValues
The Plaid environment the webhook was sent from
53 54 55 |
# File 'lib/the_plaid_api/models/protect_user_event_webhook.rb', line 53 def environment @environment end |
#event_id ⇒ String
The event ID of the user event that occurred.
26 27 28 |
# File 'lib/the_plaid_api/models/protect_user_event_webhook.rb', line 26 def event_id @event_id end |
#event_type ⇒ String
The type of user event that occurred.
30 31 32 |
# File 'lib/the_plaid_api/models/protect_user_event_webhook.rb', line 30 def event_type @event_type end |
#link_session_id ⇒ String
An identifier for the Link session this event occurred in
49 50 51 |
# File 'lib/the_plaid_api/models/protect_user_event_webhook.rb', line 49 def link_session_id @link_session_id end |
#timestamp ⇒ DateTime
The timestamp of the event, in [ISO 8601](wikipedia.org/wiki/ISO_8601) format, e.g. ‘“2017-09-14T14:42:19.350Z”`
36 37 38 |
# File 'lib/the_plaid_api/models/protect_user_event_webhook.rb', line 36 def @timestamp end |
#user_id ⇒ String
The Plaid User ID.
40 41 42 |
# File 'lib/the_plaid_api/models/protect_user_event_webhook.rb', line 40 def user_id @user_id end |
#webhook_code ⇒ String
‘PROTECT_USER_EVENT`
22 23 24 |
# File 'lib/the_plaid_api/models/protect_user_event_webhook.rb', line 22 def webhook_code @webhook_code end |
#webhook_type ⇒ String
‘“PROTECT”`
18 19 20 |
# File 'lib/the_plaid_api/models/protect_user_event_webhook.rb', line 18 def webhook_type @webhook_type end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
106 107 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 142 |
# File 'lib/the_plaid_api/models/protect_user_event_webhook.rb', line 106 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. webhook_type = hash.key?('webhook_type') ? hash['webhook_type'] : nil webhook_code = hash.key?('webhook_code') ? hash['webhook_code'] : nil event_id = hash.key?('event_id') ? hash['event_id'] : nil event_type = hash.key?('event_type') ? hash['event_type'] : nil = if hash.key?('timestamp') (DateTimeHelper.from_rfc3339(hash['timestamp']) if hash['timestamp']) end user_id = hash.key?('user_id') ? hash['user_id'] : nil environment = hash.key?('environment') ? hash['environment'] : nil client_user_id = hash.key?('client_user_id') ? hash['client_user_id'] : SKIP link_session_id = hash.key?('link_session_id') ? hash['link_session_id'] : 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. ProtectUserEventWebhook.new(webhook_type: webhook_type, webhook_code: webhook_code, event_id: event_id, event_type: event_type, timestamp: , user_id: user_id, environment: environment, client_user_id: client_user_id, link_session_id: link_session_id, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/the_plaid_api/models/protect_user_event_webhook.rb', line 56 def self.names @_hash = {} if @_hash.nil? @_hash['webhook_type'] = 'webhook_type' @_hash['webhook_code'] = 'webhook_code' @_hash['event_id'] = 'event_id' @_hash['event_type'] = 'event_type' @_hash['timestamp'] = 'timestamp' @_hash['user_id'] = 'user_id' @_hash['client_user_id'] = 'client_user_id' @_hash['link_session_id'] = 'link_session_id' @_hash['environment'] = 'environment' @_hash end |
.nullables ⇒ Object
An array for nullable fields
79 80 81 82 83 84 85 |
# File 'lib/the_plaid_api/models/protect_user_event_webhook.rb', line 79 def self.nullables %w[ user_id client_user_id link_session_id ] end |
.optionals ⇒ Object
An array for optional fields
71 72 73 74 75 76 |
# File 'lib/the_plaid_api/models/protect_user_event_webhook.rb', line 71 def self.optionals %w[ client_user_id link_session_id ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
158 159 160 161 162 163 164 165 |
# File 'lib/the_plaid_api/models/protect_user_event_webhook.rb', line 158 def inspect class_name = self.class.name.split('::').last "<#{class_name} webhook_type: #{@webhook_type.inspect}, webhook_code:"\ " #{@webhook_code.inspect}, event_id: #{@event_id.inspect}, event_type:"\ " #{@event_type.inspect}, timestamp: #{@timestamp.inspect}, user_id: #{@user_id.inspect},"\ " client_user_id: #{@client_user_id.inspect}, link_session_id: #{@link_session_id.inspect},"\ " environment: #{@environment.inspect}, additional_properties: #{@additional_properties}>" end |
#to_custom_timestamp ⇒ Object
144 145 146 |
# File 'lib/the_plaid_api/models/protect_user_event_webhook.rb', line 144 def DateTimeHelper.to_rfc3339() end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
149 150 151 152 153 154 155 |
# File 'lib/the_plaid_api/models/protect_user_event_webhook.rb', line 149 def to_s class_name = self.class.name.split('::').last "<#{class_name} webhook_type: #{@webhook_type}, webhook_code: #{@webhook_code}, event_id:"\ " #{@event_id}, event_type: #{@event_type}, timestamp: #{@timestamp}, user_id: #{@user_id},"\ " client_user_id: #{@client_user_id}, link_session_id: #{@link_session_id}, environment:"\ " #{@environment}, additional_properties: #{@additional_properties}>" end |