Class: ThePlaidApi::LinkTokenAccountFilters

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

Overview

By default, Link will provide limited account filtering: it will only display Institutions that are compatible with all products supplied in the ‘products` parameter of `/link/token/create`, and, if `auth` is specified in the `products` array, will also filter out accounts other than `checking`, `savings`, and `cash management` accounts on the Account Select pane. You can further limit the accounts shown in Link by using `account_filters` to specify the account subtypes to be shown in Link. Only the specified subtypes will be shown. This filtering applies to both the Account Select view (if enabled) and the Institution Select view. Institutions that do not support the selected subtypes will be omitted from Link. To indicate that all subtypes should be shown, use the value `“all”`. If the `account_filters` filter is used, any account type for which a filter is not specified will be entirely omitted from Link. For a full list of valid types and subtypes, see the [Account schema](plaid.com/docs/api/accounts#account-type-schema). The filter may or may not impact the list of accounts shown by the institution in the OAuth account selection flow, depending on the specific institution. If the user selects excluded account subtypes in the OAuth flow, these accounts will not be added to the Item. If the user selects only excluded account subtypes, the link attempt will fail and the user will be prompted to try again.

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(depository: SKIP, credit: SKIP, loan: SKIP, investment: SKIP, other: SKIP, additional_properties: nil) ⇒ LinkTokenAccountFilters

Returns a new instance of LinkTokenAccountFilters.



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

def initialize(depository: SKIP, credit: SKIP, loan: SKIP, investment: SKIP,
               other: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @depository = depository unless depository == SKIP
  @credit = credit unless credit == SKIP
  @loan = loan unless loan == SKIP
  @investment = investment unless investment == SKIP
  @other = other unless other == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#creditCreditFilter

A filter to apply to ‘credit`-type accounts

Returns:



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

def credit
  @credit
end

#depositoryDepositoryFilter

A filter to apply to ‘depository`-type accounts

Returns:



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

def depository
  @depository
end

#investmentInvestmentFilter

A filter to apply to ‘investment`-type accounts (or `brokerage`-type accounts for API versions 2018-05-22 and earlier).

Returns:



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

def investment
  @investment
end

#loanLoanFilter

A filter to apply to ‘loan`-type accounts

Returns:



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

def loan
  @loan
end

#otherOtherFilter

A filter to apply to ‘other`-type accounts

Returns:



51
52
53
# File 'lib/the_plaid_api/models/link_token_account_filters.rb', line 51

def other
  @other
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
# File 'lib/the_plaid_api/models/link_token_account_filters.rb', line 94

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  depository = DepositoryFilter.from_hash(hash['depository']) if hash['depository']
  credit = CreditFilter.from_hash(hash['credit']) if hash['credit']
  loan = LoanFilter.from_hash(hash['loan']) if hash['loan']
  investment = InvestmentFilter.from_hash(hash['investment']) if hash['investment']
  other = OtherFilter.from_hash(hash['other']) if hash['other']

  # 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.
  LinkTokenAccountFilters.new(depository: depository,
                              credit: credit,
                              loan: loan,
                              investment: investment,
                              other: other,
                              additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



54
55
56
57
58
59
60
61
62
# File 'lib/the_plaid_api/models/link_token_account_filters.rb', line 54

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['depository'] = 'depository'
  @_hash['credit'] = 'credit'
  @_hash['loan'] = 'loan'
  @_hash['investment'] = 'investment'
  @_hash['other'] = 'other'
  @_hash
end

.nullablesObject

An array for nullable fields



76
77
78
# File 'lib/the_plaid_api/models/link_token_account_filters.rb', line 76

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    depository
    credit
    loan
    investment
    other
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



128
129
130
131
132
133
# File 'lib/the_plaid_api/models/link_token_account_filters.rb', line 128

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} depository: #{@depository.inspect}, credit: #{@credit.inspect}, loan:"\
  " #{@loan.inspect}, investment: #{@investment.inspect}, other: #{@other.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



121
122
123
124
125
# File 'lib/the_plaid_api/models/link_token_account_filters.rb', line 121

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} depository: #{@depository}, credit: #{@credit}, loan: #{@loan}, investment:"\
  " #{@investment}, other: #{@other}, additional_properties: #{@additional_properties}>"
end