Class: ThePlaidApi::ProtectEvent
- Defined in:
- lib/the_plaid_api/models/protect_event.rb
Overview
Event data for Protect events.
Instance Attribute Summary collapse
-
#app_visit ⇒ Object
This event type represents a user visiting the client application.
-
#protect_session_id ⇒ String
If present, contains the current Protect Session ID from the Plaid Pixel SDK.
-
#timestamp ⇒ DateTime
The timestamp of the event, in [ISO 8601](wikipedia.org/wiki/ISO_8601) format, e.g.
-
#user_sign_in ⇒ Object
This event type represents a user signing in to the application.
-
#user_sign_up ⇒ Object
This event type represents a user signing up for the application.
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(timestamp:, protect_session_id: SKIP, app_visit: SKIP, user_sign_in: SKIP, user_sign_up: SKIP, additional_properties: nil) ⇒ ProtectEvent
constructor
A new instance of ProtectEvent.
-
#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(timestamp:, protect_session_id: SKIP, app_visit: SKIP, user_sign_in: SKIP, user_sign_up: SKIP, additional_properties: nil) ⇒ ProtectEvent
Returns a new instance of ProtectEvent.
66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/the_plaid_api/models/protect_event.rb', line 66 def initialize(timestamp:, protect_session_id: SKIP, app_visit: SKIP, user_sign_in: SKIP, user_sign_up: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @timestamp = @protect_session_id = protect_session_id unless protect_session_id == SKIP @app_visit = app_visit unless app_visit == SKIP @user_sign_in = user_sign_in unless user_sign_in == SKIP @user_sign_up = user_sign_up unless user_sign_up == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#app_visit ⇒ Object
This event type represents a user visiting the client application.
26 27 28 |
# File 'lib/the_plaid_api/models/protect_event.rb', line 26 def app_visit @app_visit end |
#protect_session_id ⇒ String
If present, contains the current Protect Session ID from the Plaid Pixel SDK.
22 23 24 |
# File 'lib/the_plaid_api/models/protect_event.rb', line 22 def protect_session_id @protect_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ā`
17 18 19 |
# File 'lib/the_plaid_api/models/protect_event.rb', line 17 def @timestamp end |
#user_sign_in ⇒ Object
This event type represents a user signing in to the application.
30 31 32 |
# File 'lib/the_plaid_api/models/protect_event.rb', line 30 def user_sign_in @user_sign_in end |
#user_sign_up ⇒ Object
This event type represents a user signing up for the application.
34 35 36 |
# File 'lib/the_plaid_api/models/protect_event.rb', line 34 def user_sign_up @user_sign_up end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/the_plaid_api/models/protect_event.rb', line 81 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. = if hash.key?('timestamp') (DateTimeHelper.from_rfc3339(hash['timestamp']) if hash['timestamp']) end protect_session_id = hash.key?('protect_session_id') ? hash['protect_session_id'] : SKIP app_visit = hash.key?('app_visit') ? hash['app_visit'] : SKIP user_sign_in = hash.key?('user_sign_in') ? hash['user_sign_in'] : SKIP user_sign_up = hash.key?('user_sign_up') ? hash['user_sign_up'] : 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. ProtectEvent.new(timestamp: , protect_session_id: protect_session_id, app_visit: app_visit, user_sign_in: user_sign_in, user_sign_up: user_sign_up, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
37 38 39 40 41 42 43 44 45 |
# File 'lib/the_plaid_api/models/protect_event.rb', line 37 def self.names @_hash = {} if @_hash.nil? @_hash['timestamp'] = 'timestamp' @_hash['protect_session_id'] = 'protect_session_id' @_hash['app_visit'] = 'app_visit' @_hash['user_sign_in'] = 'user_sign_in' @_hash['user_sign_up'] = 'user_sign_up' @_hash end |
.nullables ⇒ Object
An array for nullable fields
58 59 60 61 62 63 64 |
# File 'lib/the_plaid_api/models/protect_event.rb', line 58 def self.nullables %w[ app_visit user_sign_in user_sign_up ] end |
.optionals ⇒ Object
An array for optional fields
48 49 50 51 52 53 54 55 |
# File 'lib/the_plaid_api/models/protect_event.rb', line 48 def self.optionals %w[ protect_session_id app_visit user_sign_in user_sign_up ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
123 124 125 126 127 128 129 |
# File 'lib/the_plaid_api/models/protect_event.rb', line 123 def inspect class_name = self.class.name.split('::').last "<#{class_name} timestamp: #{@timestamp.inspect}, protect_session_id:"\ " #{@protect_session_id.inspect}, app_visit: #{@app_visit.inspect}, user_sign_in:"\ " #{@user_sign_in.inspect}, user_sign_up: #{@user_sign_up.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_custom_timestamp ⇒ Object
110 111 112 |
# File 'lib/the_plaid_api/models/protect_event.rb', line 110 def DateTimeHelper.to_rfc3339() end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
115 116 117 118 119 120 |
# File 'lib/the_plaid_api/models/protect_event.rb', line 115 def to_s class_name = self.class.name.split('::').last "<#{class_name} timestamp: #{@timestamp}, protect_session_id: #{@protect_session_id},"\ " app_visit: #{@app_visit}, user_sign_in: #{@user_sign_in}, user_sign_up: #{@user_sign_up},"\ " additional_properties: #{@additional_properties}>" end |