Class: ThePlaidApi::ProcessorTokenWebhookUpdate

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

Overview

This webhook is only sent to [Plaid processor partners](plaid.com/docs/auth/partnerships/). Fired when a processor updates the webhook URL for a processor token via ‘/processor/token/webhook/update`.

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:, new_webhook_url:, environment:, error: SKIP, additional_properties: nil) ⇒ ProcessorTokenWebhookUpdate

Returns a new instance of ProcessorTokenWebhookUpdate.



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

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

Instance Attribute Details

#account_idString

The ID of the account.

Returns:

  • (String)


37
38
39
# File 'lib/the_plaid_api/models/processor_token_webhook_update.rb', line 37

def 
  @account_id
end

#environmentWebhookEnvironmentValues

The Plaid environment the webhook was sent from



45
46
47
# File 'lib/the_plaid_api/models/processor_token_webhook_update.rb', line 45

def environment
  @environment
end

#errorError

Errors are identified by ‘error_code` and categorized by `error_type`. Use these in preference to HTTP status codes to identify and handle specific errors. HTTP status codes are set and provide the broadest categorization of errors: 4xx codes are for developer- or user-related errors, and 5xx codes are for Plaid-related errors, and the status will be 2xx in non-error cases. An Item with a non-`null` error object will only be part of an API response when calling `/item/get` to view Item status. Otherwise, error fields will be `null` if no error has occurred; if an error has occurred, an error code will be returned instead.

Returns:



33
34
35
# File 'lib/the_plaid_api/models/processor_token_webhook_update.rb', line 33

def error
  @error
end

#new_webhook_urlString

The new webhook URL.

Returns:

  • (String)


41
42
43
# File 'lib/the_plaid_api/models/processor_token_webhook_update.rb', line 41

def new_webhook_url
  @new_webhook_url
end

#webhook_codeString

‘WEBHOOK_UPDATE_ACKNOWLEDGED`

Returns:

  • (String)


21
22
23
# File 'lib/the_plaid_api/models/processor_token_webhook_update.rb', line 21

def webhook_code
  @webhook_code
end

#webhook_typeString

‘PROCESSOR_TOKEN`

Returns:

  • (String)


17
18
19
# File 'lib/the_plaid_api/models/processor_token_webhook_update.rb', line 17

def webhook_type
  @webhook_type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
115
# File 'lib/the_plaid_api/models/processor_token_webhook_update.rb', line 88

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
  new_webhook_url =
    hash.key?('new_webhook_url') ? hash['new_webhook_url'] : nil
  environment = hash.key?('environment') ? hash['environment'] : nil
  error = Error.from_hash(hash['error']) if hash['error']

  # 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.
  ProcessorTokenWebhookUpdate.new(webhook_type: webhook_type,
                                  webhook_code: webhook_code,
                                  account_id: ,
                                  new_webhook_url: new_webhook_url,
                                  environment: environment,
                                  error: error,
                                  additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

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

.nullablesObject

An array for nullable fields



67
68
69
70
71
# File 'lib/the_plaid_api/models/processor_token_webhook_update.rb', line 67

def self.nullables
  %w[
    error
  ]
end

.optionalsObject

An array for optional fields



60
61
62
63
64
# File 'lib/the_plaid_api/models/processor_token_webhook_update.rb', line 60

def self.optionals
  %w[
    error
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

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

#to_sObject

Provides a human-readable string representation of the object.



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

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