Class: ThePlaidApi::ProcessorSyncUpdatesAvailableWebhook

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

Overview

This webhook is only sent to [Plaid processor partners](plaid.com/docs/auth/partnerships/). 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 `/processor/transactions/sync` endpoint. Note that when using `/processor/transactions/sync` the older webhooks `INITIAL_UPDATE`, `HISTORICAL_UPDATE`, `DEFAULT_UPDATE`, and `TRANSACTIONS_REMOVED`, which are intended for use with `/processor/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 `/processor/transactions/sync`. After receipt of this webhook, the new changes can be fetched for the Item from `/processor/transactions/sync`. Note that to receive this webhook for an Item, `/processor/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 typically not fire in the Sandbox environment, due to the lack of dynamic transactions data. To test this webhook in Sandbox, call `/sandbox/item/fire_webhook`.

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(webhook_type:, webhook_code:, account_id:, initial_update_complete:, historical_update_complete:, environment:, additional_properties: nil) ⇒ ProcessorSyncUpdatesAvailableWebhook

Returns a new instance of ProcessorSyncUpdatesAvailableWebhook.



83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/the_plaid_api/models/processor_sync_updates_available_webhook.rb', line 83

def initialize(webhook_type:, webhook_code:, account_id:,
               initial_update_complete:, historical_update_complete:,
               environment:, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @webhook_type = webhook_type
  @webhook_code = webhook_code
  @account_id = 
  @initial_update_complete = initial_update_complete
  @historical_update_complete = historical_update_complete
  @environment = environment
  @additional_properties = additional_properties
end

Instance Attribute Details

#account_idString

The ID of the account.

Returns:

  • (String)


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

def 
  @account_id
end

#environmentWebhookEnvironmentValues

The Plaid environment the webhook was sent from



59
60
61
# File 'lib/the_plaid_api/models/processor_sync_updates_available_webhook.rb', line 59

def environment
  @environment
end

#historical_update_completeTrueClass | FalseClass

Indicates if historical pull information is available.

Returns:

  • (TrueClass | FalseClass)


55
56
57
# File 'lib/the_plaid_api/models/processor_sync_updates_available_webhook.rb', line 55

def historical_update_complete
  @historical_update_complete
end

#initial_update_completeTrueClass | FalseClass

Indicates if initial pull information is available.

Returns:

  • (TrueClass | FalseClass)


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

def initial_update_complete
  @initial_update_complete
end

#webhook_codeString

‘SYNC_UPDATES_AVAILABLE`

Returns:

  • (String)


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

def webhook_code
  @webhook_code
end

#webhook_typeString

‘TRANSACTIONS`

Returns:

  • (String)


39
40
41
# File 'lib/the_plaid_api/models/processor_sync_updates_available_webhook.rb', line 39

def webhook_type
  @webhook_type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



99
100
101
102
103
104
105
106
107
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/processor_sync_updates_available_webhook.rb', line 99

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
   = hash.key?('account_id') ? hash['account_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

  # 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.
  ProcessorSyncUpdatesAvailableWebhook.new(webhook_type: webhook_type,
                                           webhook_code: webhook_code,
                                           account_id: ,
                                           initial_update_complete: initial_update_complete,
                                           historical_update_complete: historical_update_complete,
                                           environment: environment,
                                           additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



62
63
64
65
66
67
68
69
70
71
# File 'lib/the_plaid_api/models/processor_sync_updates_available_webhook.rb', line 62

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['webhook_type'] = 'webhook_type'
  @_hash['webhook_code'] = 'webhook_code'
  @_hash['account_id'] = 'account_id'
  @_hash['initial_update_complete'] = 'initial_update_complete'
  @_hash['historical_update_complete'] = 'historical_update_complete'
  @_hash['environment'] = 'environment'
  @_hash
end

.nullablesObject

An array for nullable fields



79
80
81
# File 'lib/the_plaid_api/models/processor_sync_updates_available_webhook.rb', line 79

def self.nullables
  []
end

.optionalsObject

An array for optional fields



74
75
76
# File 'lib/the_plaid_api/models/processor_sync_updates_available_webhook.rb', line 74

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



139
140
141
142
143
144
145
146
# File 'lib/the_plaid_api/models/processor_sync_updates_available_webhook.rb', line 139

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} webhook_type: #{@webhook_type.inspect}, webhook_code:"\
  " #{@webhook_code.inspect}, account_id: #{@account_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_sObject

Provides a human-readable string representation of the object.



130
131
132
133
134
135
136
# File 'lib/the_plaid_api/models/processor_sync_updates_available_webhook.rb', line 130

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} webhook_type: #{@webhook_type}, webhook_code: #{@webhook_code}, account_id:"\
  " #{@account_id}, initial_update_complete: #{@initial_update_complete},"\
  " historical_update_complete: #{@historical_update_complete}, environment: #{@environment},"\
  " additional_properties: #{@additional_properties}>"
end