Class: ThePlaidApi::CraPartnerInsightsItemAccount

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

Overview

Account data corresponding to the item from which Partner Insights were generated from

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(mask:, metadata:, name:, official_name:, subtype:, owners:, account_id: SKIP, additional_properties: nil) ⇒ CraPartnerInsightsItemAccount

Returns a new instance of CraPartnerInsightsItemAccount.



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/the_plaid_api/models/cra_partner_insights_item_account.rb', line 90

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

  @account_id =  unless  == SKIP
  @mask = mask
  @metadata = 
  @name = name
  @official_name = official_name
  @subtype = subtype
  @type = 'depository'
  @owners = owners
  @additional_properties = additional_properties
end

Instance Attribute Details

#account_idString

Plaid’s unique identifier for the account. This value will not change unless Plaid can’t reconcile the account with the data returned by the financial institution. This may occur, for example, when the name of the account changes. If this happens a new ‘account_id` will be assigned to the account. If an account with a specific `account_id` disappears instead of changing, the account is likely closed. Closed accounts are not returned by the Plaid API. Like all Plaid identifiers, the `account_id` is case sensitive.

Returns:

  • (String)


23
24
25
# File 'lib/the_plaid_api/models/cra_partner_insights_item_account.rb', line 23

def 
  @account_id
end

#maskString

The last 2-4 alphanumeric characters of an account’s official account number. Note that the mask may be non-unique between an Item’s accounts, and it may also not match the mask that the bank displays to the user.

Returns:

  • (String)


30
31
32
# File 'lib/the_plaid_api/models/cra_partner_insights_item_account.rb', line 30

def mask
  @mask
end

#metadataCraPartnerInsightsItemAccountMetadata

An object containing metadata about the extracted account.



34
35
36
# File 'lib/the_plaid_api/models/cra_partner_insights_item_account.rb', line 34

def 
  @metadata
end

#nameString

The name of the account

Returns:

  • (String)


38
39
40
# File 'lib/the_plaid_api/models/cra_partner_insights_item_account.rb', line 38

def name
  @name
end

#official_nameString

The official name of the bank account.

Returns:

  • (String)


42
43
44
# File 'lib/the_plaid_api/models/cra_partner_insights_item_account.rb', line 42

def official_name
  @official_name
end

#ownersArray[Owner]

Data returned by the financial institution about the account owner or owners. Identity information is optional, so field may return an empty array.

Returns:



59
60
61
# File 'lib/the_plaid_api/models/cra_partner_insights_item_account.rb', line 59

def owners
  @owners
end

#subtypeDepositoryAccountSubtype

Valid account subtypes for depository accounts. For a list containing descriptions of each subtype, see [Account schemas](plaid.com/docs/api/accounts/#StandaloneAccountType-deposi tory).



49
50
51
# File 'lib/the_plaid_api/models/cra_partner_insights_item_account.rb', line 49

def subtype
  @subtype
end

#typeString (readonly)

The account type. This will always be ‘depository`.

Returns:

  • (String)


53
54
55
# File 'lib/the_plaid_api/models/cra_partner_insights_item_account.rb', line 53

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/the_plaid_api/models/cra_partner_insights_item_account.rb', line 107

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  mask = hash.key?('mask') ? hash['mask'] : nil
   = CraPartnerInsightsItemAccountMetadata.from_hash(hash['metadata']) if
    hash['metadata']
  name = hash.key?('name') ? hash['name'] : nil
  official_name = hash.key?('official_name') ? hash['official_name'] : nil
  subtype = hash.key?('subtype') ? hash['subtype'] : nil
  # Parameter is an array, so we need to iterate through it
  owners = nil
  unless hash['owners'].nil?
    owners = []
    hash['owners'].each do |structure|
      owners << (Owner.from_hash(structure) if structure)
    end
  end

  owners = nil unless hash.key?('owners')
   = hash.key?('account_id') ? hash['account_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.
  CraPartnerInsightsItemAccount.new(mask: mask,
                                    metadata: ,
                                    name: name,
                                    official_name: official_name,
                                    subtype: subtype,
                                    owners: owners,
                                    account_id: ,
                                    additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

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

.nullablesObject

An array for nullable fields



83
84
85
86
87
88
# File 'lib/the_plaid_api/models/cra_partner_insights_item_account.rb', line 83

def self.nullables
  %w[
    mask
    official_name
  ]
end

.optionalsObject

An array for optional fields



76
77
78
79
80
# File 'lib/the_plaid_api/models/cra_partner_insights_item_account.rb', line 76

def self.optionals
  %w[
    account_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



156
157
158
159
160
161
162
# File 'lib/the_plaid_api/models/cra_partner_insights_item_account.rb', line 156

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

#to_sObject

Provides a human-readable string representation of the object.



148
149
150
151
152
153
# File 'lib/the_plaid_api/models/cra_partner_insights_item_account.rb', line 148

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