Class: ThePlaidApi::SyncUpdatesAvailableWebhook
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ThePlaidApi::SyncUpdatesAvailableWebhook
- Defined in:
- lib/the_plaid_api/models/sync_updates_available_webhook.rb
Overview
Fired when an Item’s transactions change. This can be due to any event resulting in new changes, such as an initial 30-day transactions fetch upon the initialization of an Item with transactions, the backfill of historical transactions that occurs shortly after, or when changes are populated from a regularly-scheduled transactions update job. It is recommended to listen for the ‘SYNC_UPDATES_AVAILABLE` webhook when using the `/transactions/sync` endpoint. Note that when using `/transactions/sync` the older webhooks `INITIAL_UPDATE`, `HISTORICAL_UPDATE`, `DEFAULT_UPDATE`, and `TRANSACTIONS_REMOVED`, which are intended for use with `/transactions/get`, will also continue to be sent in order to maintain backwards compatibility. It is not necessary to listen for and respond to those webhooks when using `/transactions/sync`. After receipt of this webhook, the new changes can be fetched for the Item from `/transactions/sync`. Note that to receive this webhook for an Item, `/transactions/sync` must have been called at least once on that Item. This means that, unlike the `INITIAL_UPDATE` and `HISTORICAL_UPDATE` webhooks, it will not fire immediately upon Item creation. If `/transactions/sync` is called on an Item that was not initialized with Transactions, the webhook will fire twice: once the first 30 days of transactions data has been fetched, and a second time when all available historical transactions data has been fetched. This webhook will fire in the Sandbox environment as it would in Production. It can also be manually triggered in Sandbox by calling `/sandbox/item/fire_webhook`.
Instance Attribute Summary collapse
-
#environment ⇒ WebhookEnvironmentValues
The Plaid environment the webhook was sent from.
-
#historical_update_complete ⇒ TrueClass | FalseClass
Indicates if historical pull information (maximum transaction history requested, up to 2 years) is available.
-
#initial_update_complete ⇒ TrueClass | FalseClass
Indicates if initial pull information (most recent 30 days of transaction history) is available.
-
#item_id ⇒ String
The ‘item_id` of the Item associated with this webhook, warning, or error.
-
#user_id ⇒ String
The Plaid ‘user_id` of the User associated with this webhook, warning, or error.
-
#webhook_code ⇒ String
‘SYNC_UPDATES_AVAILABLE`.
-
#webhook_type ⇒ String
‘TRANSACTIONS`.
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:, item_id:, initial_update_complete:, historical_update_complete:, environment:, user_id: SKIP, additional_properties: nil) ⇒ SyncUpdatesAvailableWebhook
constructor
A new instance of SyncUpdatesAvailableWebhook.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#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:, item_id:, initial_update_complete:, historical_update_complete:, environment:, user_id: SKIP, additional_properties: nil) ⇒ SyncUpdatesAvailableWebhook
Returns a new instance of SyncUpdatesAvailableWebhook.
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/the_plaid_api/models/sync_updates_available_webhook.rb', line 89 def initialize(webhook_type:, webhook_code:, item_id:, initial_update_complete:, historical_update_complete:, environment:, user_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 @item_id = item_id @user_id = user_id unless user_id == SKIP @initial_update_complete = initial_update_complete @historical_update_complete = historical_update_complete @environment = environment @additional_properties = additional_properties end |
Instance Attribute Details
#environment ⇒ WebhookEnvironmentValues
The Plaid environment the webhook was sent from
62 63 64 |
# File 'lib/the_plaid_api/models/sync_updates_available_webhook.rb', line 62 def environment @environment end |
#historical_update_complete ⇒ TrueClass | FalseClass
Indicates if historical pull information (maximum transaction history requested, up to 2 years) is available.
58 59 60 |
# File 'lib/the_plaid_api/models/sync_updates_available_webhook.rb', line 58 def historical_update_complete @historical_update_complete end |
#initial_update_complete ⇒ TrueClass | FalseClass
Indicates if initial pull information (most recent 30 days of transaction history) is available.
53 54 55 |
# File 'lib/the_plaid_api/models/sync_updates_available_webhook.rb', line 53 def initial_update_complete @initial_update_complete end |
#item_id ⇒ String
The ‘item_id` of the Item associated with this webhook, warning, or error
43 44 45 |
# File 'lib/the_plaid_api/models/sync_updates_available_webhook.rb', line 43 def item_id @item_id end |
#user_id ⇒ String
The Plaid ‘user_id` of the User associated with this webhook, warning, or error.
48 49 50 |
# File 'lib/the_plaid_api/models/sync_updates_available_webhook.rb', line 48 def user_id @user_id end |
#webhook_code ⇒ String
‘SYNC_UPDATES_AVAILABLE`
39 40 41 |
# File 'lib/the_plaid_api/models/sync_updates_available_webhook.rb', line 39 def webhook_code @webhook_code end |
#webhook_type ⇒ String
‘TRANSACTIONS`
35 36 37 |
# File 'lib/the_plaid_api/models/sync_updates_available_webhook.rb', line 35 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 |
# File 'lib/the_plaid_api/models/sync_updates_available_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 item_id = hash.key?('item_id') ? hash['item_id'] : nil initial_update_complete = hash.key?('initial_update_complete') ? hash['initial_update_complete'] : nil historical_update_complete = hash.key?('historical_update_complete') ? hash['historical_update_complete'] : nil environment = hash.key?('environment') ? hash['environment'] : nil user_id = hash.key?('user_id') ? hash['user_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. SyncUpdatesAvailableWebhook.new(webhook_type: webhook_type, webhook_code: webhook_code, item_id: item_id, initial_update_complete: initial_update_complete, historical_update_complete: historical_update_complete, environment: environment, user_id: user_id, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/the_plaid_api/models/sync_updates_available_webhook.rb', line 65 def self.names @_hash = {} if @_hash.nil? @_hash['webhook_type'] = 'webhook_type' @_hash['webhook_code'] = 'webhook_code' @_hash['item_id'] = 'item_id' @_hash['user_id'] = 'user_id' @_hash['initial_update_complete'] = 'initial_update_complete' @_hash['historical_update_complete'] = 'historical_update_complete' @_hash['environment'] = 'environment' @_hash end |
.nullables ⇒ Object
An array for nullable fields
85 86 87 |
# File 'lib/the_plaid_api/models/sync_updates_available_webhook.rb', line 85 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
78 79 80 81 82 |
# File 'lib/the_plaid_api/models/sync_updates_available_webhook.rb', line 78 def self.optionals %w[ user_id ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
148 149 150 151 152 153 154 155 |
# File 'lib/the_plaid_api/models/sync_updates_available_webhook.rb', line 148 def inspect class_name = self.class.name.split('::').last "<#{class_name} webhook_type: #{@webhook_type.inspect}, webhook_code:"\ " #{@webhook_code.inspect}, item_id: #{@item_id.inspect}, user_id: #{@user_id.inspect},"\ " initial_update_complete: #{@initial_update_complete.inspect}, historical_update_complete:"\ " #{@historical_update_complete.inspect}, environment: #{@environment.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
139 140 141 142 143 144 145 |
# File 'lib/the_plaid_api/models/sync_updates_available_webhook.rb', line 139 def to_s class_name = self.class.name.split('::').last "<#{class_name} webhook_type: #{@webhook_type}, webhook_code: #{@webhook_code}, item_id:"\ " #{@item_id}, user_id: #{@user_id}, initial_update_complete: #{@initial_update_complete},"\ " historical_update_complete: #{@historical_update_complete}, environment: #{@environment},"\ " additional_properties: #{@additional_properties}>" end |