Class: Plaid::DepositSwitchStateUpdateWebhook

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/plaid/models/deposit_switch_state_update_webhook.rb

Overview

Fired when the status of a deposit switch request has changed.

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: SKIP, webhook_code: SKIP, state: SKIP, deposit_switch_id: SKIP, additional_properties: nil) ⇒ DepositSwitchStateUpdateWebhook

Returns a new instance of DepositSwitchStateUpdateWebhook.



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

def initialize(webhook_type: SKIP, webhook_code: SKIP, state: SKIP,
               deposit_switch_id: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @webhook_type = webhook_type unless webhook_type == SKIP
  @webhook_code = webhook_code unless webhook_code == SKIP
  @state = state unless state == SKIP
  @deposit_switch_id = deposit_switch_id unless deposit_switch_id == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#deposit_switch_idString

The ID of the deposit switch.

Returns:

  • (String)


35
36
37
# File 'lib/plaid/models/deposit_switch_state_update_webhook.rb', line 35

def deposit_switch_id
  @deposit_switch_id
end

#stateString

The state, or status, of the deposit switch. ‘initialized`: The deposit switch has been initialized with the user entering the information required to submit the deposit switch request. `processing`: The deposit switch request has been submitted and is being processed. `completed`: The user’s employer has fulfilled and completed the deposit switch request. ‘error`: There was an error processing the deposit switch request. For more information, see the [Deposit Switch API reference](/docs/api/products#deposit_switchget).

Returns:

  • (String)


31
32
33
# File 'lib/plaid/models/deposit_switch_state_update_webhook.rb', line 31

def state
  @state
end

#webhook_codeString

‘“SWITCH_STATE_UPDATE”`

Returns:

  • (String)


18
19
20
# File 'lib/plaid/models/deposit_switch_state_update_webhook.rb', line 18

def webhook_code
  @webhook_code
end

#webhook_typeString

‘“DEPOSIT_SWITCH”`

Returns:

  • (String)


14
15
16
# File 'lib/plaid/models/deposit_switch_state_update_webhook.rb', line 14

def webhook_type
  @webhook_type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/plaid/models/deposit_switch_state_update_webhook.rb', line 75

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  webhook_type = hash.key?('webhook_type') ? hash['webhook_type'] : SKIP
  webhook_code = hash.key?('webhook_code') ? hash['webhook_code'] : SKIP
  state = hash.key?('state') ? hash['state'] : SKIP
  deposit_switch_id =
    hash.key?('deposit_switch_id') ? hash['deposit_switch_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.
  DepositSwitchStateUpdateWebhook.new(webhook_type: webhook_type,
                                      webhook_code: webhook_code,
                                      state: state,
                                      deposit_switch_id: deposit_switch_id,
                                      additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



38
39
40
41
42
43
44
45
# File 'lib/plaid/models/deposit_switch_state_update_webhook.rb', line 38

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['webhook_type'] = 'webhook_type'
  @_hash['webhook_code'] = 'webhook_code'
  @_hash['state'] = 'state'
  @_hash['deposit_switch_id'] = 'deposit_switch_id'
  @_hash
end

.nullablesObject

An array for nullable fields



58
59
60
# File 'lib/plaid/models/deposit_switch_state_update_webhook.rb', line 58

def self.nullables
  []
end

.optionalsObject

An array for optional fields



48
49
50
51
52
53
54
55
# File 'lib/plaid/models/deposit_switch_state_update_webhook.rb', line 48

def self.optionals
  %w[
    webhook_type
    webhook_code
    state
    deposit_switch_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



109
110
111
112
113
114
# File 'lib/plaid/models/deposit_switch_state_update_webhook.rb', line 109

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

#to_sObject

Provides a human-readable string representation of the object.



101
102
103
104
105
106
# File 'lib/plaid/models/deposit_switch_state_update_webhook.rb', line 101

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