Class: ThePlaidApi::BaseReportInvestmentSecurity

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

Overview

Investment security associated with the 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(security_id:, name:, isin:, cusip:, institution_security_id:, institution_id:, ticker_symbol:, type:, additional_properties: nil) ⇒ BaseReportInvestmentSecurity

Returns a new instance of BaseReportInvestmentSecurity.



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/the_plaid_api/models/base_report_investment_security.rb', line 104

def initialize(security_id:, name:, isin:, cusip:, institution_security_id:,
               institution_id:, ticker_symbol:, type:,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @security_id = security_id
  @name = name
  @isin = isin
  @cusip = cusip
  @institution_security_id = institution_security_id
  @institution_id = institution_id
  @ticker_symbol = ticker_symbol
  @type = type
  @additional_properties = additional_properties
end

Instance Attribute Details

#cusipString

9-character CUSIP, an identifier assigned to North American securities. A verified CUSIP Global Services license is required to receive this data. This field will be null by default for new customers, and null for existing customers starting March 12, 2024. If you would like access to this field, please start the verification process [here](docs.google.com/forms/d/e/1FAIpQLSd9asHEYEfmf8fxJTHZTAfAzW4 dugsnSu-HS2J51f1mxwd6Sw/viewform).

Returns:

  • (String)


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

def cusip
  @cusip
end

#institution_idString

If ‘institution_security_id` is present, this field indicates the Plaid `institution_id` of the institution to whom the identifier belongs.

Returns:

  • (String)


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

def institution_id
  @institution_id
end

#institution_security_idString

An identifier given to the security by the institution.

Returns:

  • (String)


46
47
48
# File 'lib/the_plaid_api/models/base_report_investment_security.rb', line 46

def institution_security_id
  @institution_security_id
end

#isinString

12-character ISIN, a globally unique securities identifier. A verified CUSIP Global Services license is required to receive this data. This field will be null by default for new customers, and null for existing customers starting March 12, 2024. If you would like access to this field, please start the verification process [here](docs.google.com/forms/d/e/1FAIpQLSd9asHEYEfmf8fxJTHZTAfAzW4 dugsnSu-HS2J51f1mxwd6Sw/viewform).

Returns:

  • (String)


32
33
34
# File 'lib/the_plaid_api/models/base_report_investment_security.rb', line 32

def isin
  @isin
end

#nameString

A descriptive name for the security, suitable for display.

Returns:

  • (String)


22
23
24
# File 'lib/the_plaid_api/models/base_report_investment_security.rb', line 22

def name
  @name
end

#security_idString

A unique, Plaid-specific identifier for the security, used to associate securities with holdings. Like all Plaid identifiers, the ‘security_id` is case sensitive. The `security_id` may change if inherent details of the security change due to a corporate action, for example, in the event of a ticker symbol change or CUSIP change.

Returns:

  • (String)


18
19
20
# File 'lib/the_plaid_api/models/base_report_investment_security.rb', line 18

def security_id
  @security_id
end

#ticker_symbolString

The security’s trading symbol for publicly traded securities, and otherwise a short identifier if available.

Returns:

  • (String)


56
57
58
# File 'lib/the_plaid_api/models/base_report_investment_security.rb', line 56

def ticker_symbol
  @ticker_symbol
end

#typeString

The security type of the holding. Valid security types are: ‘cash`: Cash, currency, and money market funds `cryptocurrency`: Digital or virtual currencies `derivative`: Options, warrants, and other derivative instruments `equity`: Domestic and foreign equities `etf`: Multi-asset exchange-traded investment funds `fixed income`: Bonds and certificates of deposit (CDs) `loan`: Loans and loan receivables `mutual fund`: Open- and closed-end vehicles pooling funds of multiple investors `other`: Unknown or other investment types

Returns:

  • (String)


70
71
72
# File 'lib/the_plaid_api/models/base_report_investment_security.rb', line 70

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/the_plaid_api/models/base_report_investment_security.rb', line 122

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  security_id = hash.key?('security_id') ? hash['security_id'] : nil
  name = hash.key?('name') ? hash['name'] : nil
  isin = hash.key?('isin') ? hash['isin'] : nil
  cusip = hash.key?('cusip') ? hash['cusip'] : nil
  institution_security_id =
    hash.key?('institution_security_id') ? hash['institution_security_id'] : nil
  institution_id =
    hash.key?('institution_id') ? hash['institution_id'] : nil
  ticker_symbol = hash.key?('ticker_symbol') ? hash['ticker_symbol'] : nil
  type = hash.key?('type') ? hash['type'] : 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.
  BaseReportInvestmentSecurity.new(security_id: security_id,
                                   name: name,
                                   isin: isin,
                                   cusip: cusip,
                                   institution_security_id: institution_security_id,
                                   institution_id: institution_id,
                                   ticker_symbol: ticker_symbol,
                                   type: type,
                                   additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/the_plaid_api/models/base_report_investment_security.rb', line 73

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['security_id'] = 'security_id'
  @_hash['name'] = 'name'
  @_hash['isin'] = 'isin'
  @_hash['cusip'] = 'cusip'
  @_hash['institution_security_id'] = 'institution_security_id'
  @_hash['institution_id'] = 'institution_id'
  @_hash['ticker_symbol'] = 'ticker_symbol'
  @_hash['type'] = 'type'
  @_hash
end

.nullablesObject

An array for nullable fields



92
93
94
95
96
97
98
99
100
101
102
# File 'lib/the_plaid_api/models/base_report_investment_security.rb', line 92

def self.nullables
  %w[
    name
    isin
    cusip
    institution_security_id
    institution_id
    ticker_symbol
    type
  ]
end

.optionalsObject

An array for optional fields



87
88
89
# File 'lib/the_plaid_api/models/base_report_investment_security.rb', line 87

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



166
167
168
169
170
171
172
173
# File 'lib/the_plaid_api/models/base_report_investment_security.rb', line 166

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} security_id: #{@security_id.inspect}, name: #{@name.inspect}, isin:"\
  " #{@isin.inspect}, cusip: #{@cusip.inspect}, institution_security_id:"\
  " #{@institution_security_id.inspect}, institution_id: #{@institution_id.inspect},"\
  " ticker_symbol: #{@ticker_symbol.inspect}, type: #{@type.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



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

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} security_id: #{@security_id}, name: #{@name}, isin: #{@isin}, cusip:"\
  " #{@cusip}, institution_security_id: #{@institution_security_id}, institution_id:"\
  " #{@institution_id}, ticker_symbol: #{@ticker_symbol}, type: #{@type},"\
  " additional_properties: #{@additional_properties}>"
end