Class: ThePlaidApi::ProcessorInitialUpdateWebhook

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

Overview

This webhook is only sent to [Plaid processor partners](plaid.com/docs/auth/partnerships/). Fired when an Item’s initial transaction pull is completed. Once this webhook has been fired, transaction data for the most recent 30 days can be fetched for the Item. This webhook will also be fired if account selections for the Item are updated, with ‘new_transactions` set to the number of net new transactions pulled after the account selection update. This webhook is intended for use with `/processor/transactions/get`; if you are using the newer `/processor/transactions/sync` endpoint, this webhook will still be fired to maintain backwards compatibility, but it is recommended to listen for and respond to the `SYNC_UPDATES_AVAILABLE` webhook instead.

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:, new_transactions:, account_id:, environment:, error: SKIP, additional_properties: nil) ⇒ ProcessorInitialUpdateWebhook

Returns a new instance of ProcessorInitialUpdateWebhook.



72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/the_plaid_api/models/processor_initial_update_webhook.rb', line 72

def initialize(webhook_type:, webhook_code:, new_transactions:, account_id:,
               environment:, error: 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
  @error = error unless error == SKIP
  @new_transactions = new_transactions
  @account_id = 
  @environment = environment
  @additional_properties = additional_properties
end

Instance Attribute Details

#account_idString

The ID of the account.

Returns:

  • (String)


40
41
42
# File 'lib/the_plaid_api/models/processor_initial_update_webhook.rb', line 40

def 
  @account_id
end

#environmentWebhookEnvironmentValues

The Plaid environment the webhook was sent from



44
45
46
# File 'lib/the_plaid_api/models/processor_initial_update_webhook.rb', line 44

def environment
  @environment
end

#errorString

The error code associated with the webhook.

Returns:

  • (String)


32
33
34
# File 'lib/the_plaid_api/models/processor_initial_update_webhook.rb', line 32

def error
  @error
end

#new_transactionsFloat

The number of new transactions available.

Returns:

  • (Float)


36
37
38
# File 'lib/the_plaid_api/models/processor_initial_update_webhook.rb', line 36

def new_transactions
  @new_transactions
end

#webhook_codeString

‘INITIAL_UPDATE`

Returns:

  • (String)


28
29
30
# File 'lib/the_plaid_api/models/processor_initial_update_webhook.rb', line 28

def webhook_code
  @webhook_code
end

#webhook_typeString

‘TRANSACTIONS`

Returns:

  • (String)


24
25
26
# File 'lib/the_plaid_api/models/processor_initial_update_webhook.rb', line 24

def webhook_type
  @webhook_type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/the_plaid_api/models/processor_initial_update_webhook.rb', line 87

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
  new_transactions =
    hash.key?('new_transactions') ? hash['new_transactions'] : nil
   = hash.key?('account_id') ? hash['account_id'] : nil
  environment = hash.key?('environment') ? hash['environment'] : nil
  error = hash.key?('error') ? hash['error'] : 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.
  ProcessorInitialUpdateWebhook.new(webhook_type: webhook_type,
                                    webhook_code: webhook_code,
                                    new_transactions: new_transactions,
                                    account_id: ,
                                    environment: environment,
                                    error: error,
                                    additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



47
48
49
50
51
52
53
54
55
56
# File 'lib/the_plaid_api/models/processor_initial_update_webhook.rb', line 47

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

.nullablesObject

An array for nullable fields



66
67
68
69
70
# File 'lib/the_plaid_api/models/processor_initial_update_webhook.rb', line 66

def self.nullables
  %w[
    error
  ]
end

.optionalsObject

An array for optional fields



59
60
61
62
63
# File 'lib/the_plaid_api/models/processor_initial_update_webhook.rb', line 59

def self.optionals
  %w[
    error
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



125
126
127
128
129
130
131
# File 'lib/the_plaid_api/models/processor_initial_update_webhook.rb', line 125

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

#to_sObject

Provides a human-readable string representation of the object.



117
118
119
120
121
122
# File 'lib/the_plaid_api/models/processor_initial_update_webhook.rb', line 117

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