Class: ThePlaidApi::ConsentedAccount

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

Overview

A financial institution account.

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_id: SKIP, mask: SKIP, name: SKIP, official_name: SKIP, type: SKIP, subtype: SKIP, additional_properties: nil) ⇒ ConsentedAccount

Returns a new instance of ConsentedAccount.



80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/the_plaid_api/models/consented_account.rb', line 80

def initialize(account_id: SKIP, mask: SKIP, name: SKIP,
               official_name: SKIP, type: SKIP, subtype: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @account_id =  unless  == SKIP
  @mask = mask unless mask == SKIP
  @name = name unless name == SKIP
  @official_name = official_name unless official_name == SKIP
  @type = type unless type == SKIP
  @subtype = subtype unless subtype == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#account_idString

Plaid’s unique identifier for the account. Like all Plaid identifiers, the ‘account_id` is case sensitive.

Returns:

  • (String)


15
16
17
# File 'lib/the_plaid_api/models/consented_account.rb', line 15

def 
  @account_id
end

#maskString

The last 2-4 alphanumeric characters of an account’s official account number

Returns:

  • (String)


20
21
22
# File 'lib/the_plaid_api/models/consented_account.rb', line 20

def mask
  @mask
end

#nameString

The name of the account, either assigned by the user or by the financial institution itself

Returns:

  • (String)


25
26
27
# File 'lib/the_plaid_api/models/consented_account.rb', line 25

def name
  @name
end

#official_nameString

The official name of the account as given by the financial institution

Returns:

  • (String)


29
30
31
# File 'lib/the_plaid_api/models/consented_account.rb', line 29

def official_name
  @official_name
end

#subtypeAccountSubtype

See the [Account type schema](plaid.com/docs/api/accounts/#account-type-schema) for a full listing of account types and corresponding subtypes.

Returns:



47
48
49
# File 'lib/the_plaid_api/models/consented_account.rb', line 47

def subtype
  @subtype
end

#typeAccountType

‘investment:` Investment account. In API versions 2018-05-22 and earlier, this type is called `brokerage` instead. `credit:` Credit card `depository:` Depository account `loan:` Loan account `other:` Non-specified account type See the [Account type schema](plaid.com/docs/api/accounts#account-type-schema) for a full listing of account types and corresponding subtypes.

Returns:



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

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
# File 'lib/the_plaid_api/models/consented_account.rb', line 96

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   = hash.key?('account_id') ? hash['account_id'] : SKIP
  mask = hash.key?('mask') ? hash['mask'] : SKIP
  name = hash.key?('name') ? hash['name'] : SKIP
  official_name = hash.key?('official_name') ? hash['official_name'] : SKIP
  type = hash.key?('type') ? hash['type'] : SKIP
  subtype = hash.key?('subtype') ? hash['subtype'] : 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.
  ConsentedAccount.new(account_id: ,
                       mask: mask,
                       name: name,
                       official_name: official_name,
                       type: type,
                       subtype: subtype,
                       additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['account_id'] = 'account_id'
  @_hash['mask'] = 'mask'
  @_hash['name'] = 'name'
  @_hash['official_name'] = 'official_name'
  @_hash['type'] = 'type'
  @_hash['subtype'] = 'subtype'
  @_hash
end

.nullablesObject

An array for nullable fields



74
75
76
77
78
# File 'lib/the_plaid_api/models/consented_account.rb', line 74

def self.nullables
  %w[
    subtype
  ]
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    account_id
    mask
    name
    official_name
    type
    subtype
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



133
134
135
136
137
138
# File 'lib/the_plaid_api/models/consented_account.rb', line 133

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} account_id: #{@account_id.inspect}, mask: #{@mask.inspect}, name:"\
  " #{@name.inspect}, official_name: #{@official_name.inspect}, type: #{@type.inspect},"\
  " subtype: #{@subtype.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



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

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} account_id: #{@account_id}, mask: #{@mask}, name: #{@name}, official_name:"\
  " #{@official_name}, type: #{@type}, subtype: #{@subtype}, additional_properties:"\
  " #{@additional_properties}>"
end