Class: ThePlaidApi::AssetReportInvestmentSecurity

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/the_plaid_api/models/asset_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:, ticker_symbol:, type:, additional_properties: nil) ⇒ AssetReportInvestmentSecurity

Returns a new instance of AssetReportInvestmentSecurity.



67
68
69
70
71
72
73
74
75
76
77
# File 'lib/the_plaid_api/models/asset_report_investment_security.rb', line 67

def initialize(security_id:, name:, 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
  @ticker_symbol = ticker_symbol
  @type = type
  @additional_properties = additional_properties
end

Instance Attribute Details

#nameString

A descriptive name for the security, suitable for display.

Returns:

  • (String)


22
23
24
# File 'lib/the_plaid_api/models/asset_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/asset_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)


27
28
29
# File 'lib/the_plaid_api/models/asset_report_investment_security.rb', line 27

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)


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

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/the_plaid_api/models/asset_report_investment_security.rb', line 80

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
  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.
  AssetReportInvestmentSecurity.new(security_id: security_id,
                                    name: name,
                                    ticker_symbol: ticker_symbol,
                                    type: type,
                                    additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



44
45
46
47
48
49
50
51
# File 'lib/the_plaid_api/models/asset_report_investment_security.rb', line 44

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

.nullablesObject

An array for nullable fields



59
60
61
62
63
64
65
# File 'lib/the_plaid_api/models/asset_report_investment_security.rb', line 59

def self.nullables
  %w[
    name
    ticker_symbol
    type
  ]
end

.optionalsObject

An array for optional fields



54
55
56
# File 'lib/the_plaid_api/models/asset_report_investment_security.rb', line 54

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



112
113
114
115
116
117
# File 'lib/the_plaid_api/models/asset_report_investment_security.rb', line 112

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} security_id: #{@security_id.inspect}, name: #{@name.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.



105
106
107
108
109
# File 'lib/the_plaid_api/models/asset_report_investment_security.rb', line 105

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