Class: ThePlaidApi::ConsentEvent
- Defined in:
- lib/the_plaid_api/models/consent_event.rb
Overview
Describes a consent event.
Instance Attribute Summary collapse
-
#consented_accounts ⇒ Array[ConsentedAccount]
An array containing the accounts associated with the Item for which authorizations are granted.
-
#consented_data_scopes ⇒ Array[String]
A list of strings containing the full list of data scopes the end user has consented to for the Item.
-
#consented_use_cases ⇒ Array[String]
A list of strings containing the full list of use cases the end user has consented to for the Item.
-
#created_at ⇒ DateTime
The date and time when the consent event occurred, in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.
-
#event_code ⇒ ConsentEventCode
Codes describing the object of a consent event.
-
#event_type ⇒ ConsentEventType
A broad categorization of the consent event.
-
#initiator ⇒ ConsentEventInitiator
The entity that initiated collection of consent.
-
#institution_id ⇒ String
Unique identifier for the institution associated with the Item.
-
#institution_name ⇒ String
The full name of the institution associated with the Item.
-
#item_id ⇒ String
The Plaid Item ID.
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(item_id: SKIP, created_at: SKIP, event_type: SKIP, event_code: SKIP, institution_id: SKIP, institution_name: SKIP, initiator: SKIP, consented_use_cases: SKIP, consented_data_scopes: SKIP, consented_accounts: SKIP, additional_properties: nil) ⇒ ConsentEvent
constructor
A new instance of ConsentEvent.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_created_at ⇒ 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(item_id: SKIP, created_at: SKIP, event_type: SKIP, event_code: SKIP, institution_id: SKIP, institution_name: SKIP, initiator: SKIP, consented_use_cases: SKIP, consented_data_scopes: SKIP, consented_accounts: SKIP, additional_properties: nil) ⇒ ConsentEvent
Returns a new instance of ConsentEvent.
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/the_plaid_api/models/consent_event.rb', line 108 def initialize(item_id: SKIP, created_at: SKIP, event_type: SKIP, event_code: SKIP, institution_id: SKIP, institution_name: SKIP, initiator: SKIP, consented_use_cases: SKIP, consented_data_scopes: SKIP, consented_accounts: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @item_id = item_id unless item_id == SKIP @created_at = created_at unless created_at == SKIP @event_type = event_type unless event_type == SKIP @event_code = event_code unless event_code == SKIP @institution_id = institution_id unless institution_id == SKIP @institution_name = institution_name unless institution_name == SKIP @initiator = initiator unless initiator == SKIP @consented_use_cases = unless == SKIP @consented_data_scopes = unless == SKIP @consented_accounts = unless == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#consented_accounts ⇒ Array[ConsentedAccount]
An array containing the accounts associated with the Item for which authorizations are granted.
66 67 68 |
# File 'lib/the_plaid_api/models/consent_event.rb', line 66 def @consented_accounts end |
#consented_data_scopes ⇒ Array[String]
A list of strings containing the full list of data scopes the end user has consented to for the Item. These correspond to consented products; see the [full mapping](plaid.com/docs/link/data-transparency-messaging-migration -guide/#data-scopes-by-product) of data scopes and products.
61 62 63 |
# File 'lib/the_plaid_api/models/consent_event.rb', line 61 def @consented_data_scopes end |
#consented_use_cases ⇒ Array[String]
A list of strings containing the full list of use cases the end user has consented to for the Item. See the [full list](plaid.com/docs/link/data-transparency-messaging-migration-gu ide/#updating-link-customizations) of use cases.
53 54 55 |
# File 'lib/the_plaid_api/models/consent_event.rb', line 53 def @consented_use_cases end |
#created_at ⇒ DateTime
The date and time when the consent event occurred, in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.
23 24 25 |
# File 'lib/the_plaid_api/models/consent_event.rb', line 23 def created_at @created_at end |
#event_code ⇒ ConsentEventCode
Codes describing the object of a consent event.
31 32 33 |
# File 'lib/the_plaid_api/models/consent_event.rb', line 31 def event_code @event_code end |
#event_type ⇒ ConsentEventType
A broad categorization of the consent event.
27 28 29 |
# File 'lib/the_plaid_api/models/consent_event.rb', line 27 def event_type @event_type end |
#initiator ⇒ ConsentEventInitiator
The entity that initiated collection of consent.
45 46 47 |
# File 'lib/the_plaid_api/models/consent_event.rb', line 45 def initiator @initiator end |
#institution_id ⇒ String
Unique identifier for the institution associated with the Item. Field is ‘null` for Items created via Same Day Micro-deposits.
36 37 38 |
# File 'lib/the_plaid_api/models/consent_event.rb', line 36 def institution_id @institution_id end |
#institution_name ⇒ String
The full name of the institution associated with the Item. Field is ‘null` for Items created via Same Day Micro-deposits.
41 42 43 |
# File 'lib/the_plaid_api/models/consent_event.rb', line 41 def institution_name @institution_name end |
#item_id ⇒ String
The Plaid Item ID. The ‘item_id` is always unique; linking the same account at the same institution twice will result in two Items with different `item_id` values. Like all Plaid identifiers, the `item_id` is case-sensitive.
18 19 20 |
# File 'lib/the_plaid_api/models/consent_event.rb', line 18 def item_id @item_id end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
130 131 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 180 181 |
# File 'lib/the_plaid_api/models/consent_event.rb', line 130 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. item_id = hash.key?('item_id') ? hash['item_id'] : SKIP created_at = if hash.key?('created_at') (DateTimeHelper.from_rfc3339(hash['created_at']) if hash['created_at']) else SKIP end event_type = hash.key?('event_type') ? hash['event_type'] : SKIP event_code = hash.key?('event_code') ? hash['event_code'] : SKIP institution_id = hash.key?('institution_id') ? hash['institution_id'] : SKIP institution_name = hash.key?('institution_name') ? hash['institution_name'] : SKIP initiator = hash.key?('initiator') ? hash['initiator'] : SKIP = hash.key?('consented_use_cases') ? hash['consented_use_cases'] : SKIP = hash.key?('consented_data_scopes') ? hash['consented_data_scopes'] : SKIP # Parameter is an array, so we need to iterate through it = nil unless hash['consented_accounts'].nil? = [] hash['consented_accounts'].each do |structure| << (ConsentedAccount.from_hash(structure) if structure) end end = SKIP unless hash.key?('consented_accounts') # 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. ConsentEvent.new(item_id: item_id, created_at: created_at, event_type: event_type, event_code: event_code, institution_id: institution_id, institution_name: institution_name, initiator: initiator, consented_use_cases: , consented_data_scopes: , consented_accounts: , additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/the_plaid_api/models/consent_event.rb', line 69 def self.names @_hash = {} if @_hash.nil? @_hash['item_id'] = 'item_id' @_hash['created_at'] = 'created_at' @_hash['event_type'] = 'event_type' @_hash['event_code'] = 'event_code' @_hash['institution_id'] = 'institution_id' @_hash['institution_name'] = 'institution_name' @_hash['initiator'] = 'initiator' @_hash['consented_use_cases'] = 'consented_use_cases' @_hash['consented_data_scopes'] = 'consented_data_scopes' @_hash['consented_accounts'] = 'consented_accounts' @_hash end |
.nullables ⇒ Object
An array for nullable fields
101 102 103 104 105 106 |
# File 'lib/the_plaid_api/models/consent_event.rb', line 101 def self.nullables %w[ institution_id institution_name ] end |
.optionals ⇒ Object
An array for optional fields
85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/the_plaid_api/models/consent_event.rb', line 85 def self.optionals %w[ item_id created_at event_type event_code institution_id institution_name initiator consented_use_cases consented_data_scopes consented_accounts ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
199 200 201 202 203 204 205 206 207 |
# File 'lib/the_plaid_api/models/consent_event.rb', line 199 def inspect class_name = self.class.name.split('::').last "<#{class_name} item_id: #{@item_id.inspect}, created_at: #{@created_at.inspect},"\ " event_type: #{@event_type.inspect}, event_code: #{@event_code.inspect}, institution_id:"\ " #{@institution_id.inspect}, institution_name: #{@institution_name.inspect}, initiator:"\ " #{@initiator.inspect}, consented_use_cases: #{@consented_use_cases.inspect},"\ " consented_data_scopes: #{@consented_data_scopes.inspect}, consented_accounts:"\ " #{@consented_accounts.inspect}, additional_properties: #{@additional_properties}>" end |
#to_custom_created_at ⇒ Object
183 184 185 |
# File 'lib/the_plaid_api/models/consent_event.rb', line 183 def to_custom_created_at DateTimeHelper.to_rfc3339(created_at) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
188 189 190 191 192 193 194 195 196 |
# File 'lib/the_plaid_api/models/consent_event.rb', line 188 def to_s class_name = self.class.name.split('::').last "<#{class_name} item_id: #{@item_id}, created_at: #{@created_at}, event_type:"\ " #{@event_type}, event_code: #{@event_code}, institution_id: #{@institution_id},"\ " institution_name: #{@institution_name}, initiator: #{@initiator}, consented_use_cases:"\ " #{@consented_use_cases}, consented_data_scopes: #{@consented_data_scopes},"\ " consented_accounts: #{@consented_accounts}, additional_properties:"\ " #{@additional_properties}>" end |