Class: Plaid::DepositoryAccount

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

Overview

An account type holding cash, in which funds are deposited. Supported products for ‘depository` accounts are: Auth, Balance, Transactions, Identity, Payment Initiation, and Assets.

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(checking:, savings:, hsa:, cd:, money_market:, paypal:, prepaid:, cash_management:, ebt:, additional_properties: nil) ⇒ DepositoryAccount

Returns a new instance of DepositoryAccount.



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/plaid/models/depository_account.rb', line 76

def initialize(checking:, savings:, hsa:, cd:, money_market:, paypal:,
               prepaid:, cash_management:, ebt:, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @checking = checking
  @savings = savings
  @hsa = hsa
  @cd = cd
  @money_market = money_market
  @paypal = paypal
  @prepaid = prepaid
  @cash_management = cash_management
  @ebt = ebt
  @additional_properties = additional_properties
end

Instance Attribute Details

#cash_managementString

A cash management account, typically a cash account at a brokerage

Returns:

  • (String)


44
45
46
# File 'lib/plaid/models/depository_account.rb', line 44

def cash_management
  @cash_management
end

#cdString

Certificate of deposit account

Returns:

  • (String)


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

def cd
  @cd
end

#checkingString

Checking account

Returns:

  • (String)


16
17
18
# File 'lib/plaid/models/depository_account.rb', line 16

def checking
  @checking
end

#ebtString

An Electronic Benefit Transfer (EBT) account, used by certain public assistance programs to distribute funds (US only)

Returns:

  • (String)


49
50
51
# File 'lib/plaid/models/depository_account.rb', line 49

def ebt
  @ebt
end

#hsaString

Health Savings Account (US only) that can only hold cash

Returns:

  • (String)


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

def hsa
  @hsa
end

#money_marketString

Money market account

Returns:

  • (String)


32
33
34
# File 'lib/plaid/models/depository_account.rb', line 32

def money_market
  @money_market
end

#paypalString

PayPal depository account

Returns:

  • (String)


36
37
38
# File 'lib/plaid/models/depository_account.rb', line 36

def paypal
  @paypal
end

#prepaidString

Prepaid debit card

Returns:

  • (String)


40
41
42
# File 'lib/plaid/models/depository_account.rb', line 40

def prepaid
  @prepaid
end

#savingsString

Savings account

Returns:

  • (String)


20
21
22
# File 'lib/plaid/models/depository_account.rb', line 20

def savings
  @savings
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



94
95
96
97
98
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/plaid/models/depository_account.rb', line 94

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  checking = hash.key?('checking') ? hash['checking'] : nil
  savings = hash.key?('savings') ? hash['savings'] : nil
  hsa = hash.key?('hsa') ? hash['hsa'] : nil
  cd = hash.key?('cd') ? hash['cd'] : nil
  money_market = hash.key?('money market') ? hash['money market'] : nil
  paypal = hash.key?('paypal') ? hash['paypal'] : nil
  prepaid = hash.key?('prepaid') ? hash['prepaid'] : nil
  cash_management =
    hash.key?('cash management') ? hash['cash management'] : nil
  ebt = hash.key?('ebt') ? hash['ebt'] : 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.
  DepositoryAccount.new(checking: checking,
                        savings: savings,
                        hsa: hsa,
                        cd: cd,
                        money_market: money_market,
                        paypal: paypal,
                        prepaid: prepaid,
                        cash_management: cash_management,
                        ebt: ebt,
                        additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/plaid/models/depository_account.rb', line 52

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['checking'] = 'checking'
  @_hash['savings'] = 'savings'
  @_hash['hsa'] = 'hsa'
  @_hash['cd'] = 'cd'
  @_hash['money_market'] = 'money market'
  @_hash['paypal'] = 'paypal'
  @_hash['prepaid'] = 'prepaid'
  @_hash['cash_management'] = 'cash management'
  @_hash['ebt'] = 'ebt'
  @_hash
end

.nullablesObject

An array for nullable fields



72
73
74
# File 'lib/plaid/models/depository_account.rb', line 72

def self.nullables
  []
end

.optionalsObject

An array for optional fields



67
68
69
# File 'lib/plaid/models/depository_account.rb', line 67

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



138
139
140
141
142
143
144
145
# File 'lib/plaid/models/depository_account.rb', line 138

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} checking: #{@checking.inspect}, savings: #{@savings.inspect}, hsa:"\
  " #{@hsa.inspect}, cd: #{@cd.inspect}, money_market: #{@money_market.inspect}, paypal:"\
  " #{@paypal.inspect}, prepaid: #{@prepaid.inspect}, cash_management:"\
  " #{@cash_management.inspect}, ebt: #{@ebt.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



130
131
132
133
134
135
# File 'lib/plaid/models/depository_account.rb', line 130

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} checking: #{@checking}, savings: #{@savings}, hsa: #{@hsa}, cd: #{@cd},"\
  " money_market: #{@money_market}, paypal: #{@paypal}, prepaid: #{@prepaid}, cash_management:"\
  " #{@cash_management}, ebt: #{@ebt}, additional_properties: #{@additional_properties}>"
end