Class: Plaid::DepositSwitchTargetAccount

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

Overview

DepositSwitchTargetAccount Model.

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(account_number:, routing_number:, account_name:, account_subtype:, additional_properties: nil) ⇒ DepositSwitchTargetAccount

Returns a new instance of DepositSwitchTargetAccount.



50
51
52
53
54
55
56
57
58
59
60
# File 'lib/plaid/models/deposit_switch_target_account.rb', line 50

def initialize(account_number:, routing_number:, account_name:,
               account_subtype:, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @account_number = 
  @routing_number = routing_number
  @account_name = 
  @account_subtype = 
  @additional_properties = additional_properties
end

Instance Attribute Details

#account_nameString

The name of the deposit switch destination account, as it will be displayed to the end user in the Deposit Switch interface. It is not required to match the name used in online banking.

Returns:

  • (String)


24
25
26
# File 'lib/plaid/models/deposit_switch_target_account.rb', line 24

def 
  @account_name
end

#account_numberString

Account number for deposit switch destination

Returns:

  • (String)


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

def 
  @account_number
end

#account_subtypeAccountSubtype1

The account subtype of the account, either ‘checking` or `savings`.

Returns:



28
29
30
# File 'lib/plaid/models/deposit_switch_target_account.rb', line 28

def 
  @account_subtype
end

#routing_numberString

Routing number for deposit switch destination

Returns:

  • (String)


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

def routing_number
  @routing_number
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/plaid/models/deposit_switch_target_account.rb', line 63

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   =
    hash.key?('account_number') ? hash['account_number'] : nil
  routing_number =
    hash.key?('routing_number') ? hash['routing_number'] : nil
   = hash.key?('account_name') ? hash['account_name'] : nil
   =
    hash.key?('account_subtype') ? hash['account_subtype'] : 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.
  DepositSwitchTargetAccount.new(account_number: ,
                                 routing_number: routing_number,
                                 account_name: ,
                                 account_subtype: ,
                                 additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



31
32
33
34
35
36
37
38
# File 'lib/plaid/models/deposit_switch_target_account.rb', line 31

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['account_number'] = 'account_number'
  @_hash['routing_number'] = 'routing_number'
  @_hash['account_name'] = 'account_name'
  @_hash['account_subtype'] = 'account_subtype'
  @_hash
end

.nullablesObject

An array for nullable fields



46
47
48
# File 'lib/plaid/models/deposit_switch_target_account.rb', line 46

def self.nullables
  []
end

.optionalsObject

An array for optional fields



41
42
43
# File 'lib/plaid/models/deposit_switch_target_account.rb', line 41

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



99
100
101
102
103
104
# File 'lib/plaid/models/deposit_switch_target_account.rb', line 99

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} account_number: #{@account_number.inspect}, routing_number:"\
  " #{@routing_number.inspect}, account_name: #{@account_name.inspect}, account_subtype:"\
  " #{@account_subtype.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



91
92
93
94
95
96
# File 'lib/plaid/models/deposit_switch_target_account.rb', line 91

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} account_number: #{@account_number}, routing_number: #{@routing_number},"\
  " account_name: #{@account_name}, account_subtype: #{@account_subtype},"\
  " additional_properties: #{@additional_properties}>"
end