Class: ThePlaidApi::SecurityOverride

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

Overview

Specify the security associated with the holding or investment transaction. When inputting custom security data to the Sandbox, Plaid will perform post-data-retrieval normalization and enrichment. These processes may cause the data returned by the Sandbox to be slightly different from the data you input. An ISO-4217 currency code and a security identifier (‘ticker_symbol`, `cusip`, or `isin`) are required.

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(isin: SKIP, cusip: SKIP, sedol: SKIP, name: SKIP, ticker_symbol: SKIP, currency: SKIP, additional_properties: nil) ⇒ SecurityOverride

Returns a new instance of SecurityOverride.



84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/the_plaid_api/models/security_override.rb', line 84

def initialize(isin: SKIP, cusip: SKIP, sedol: SKIP, name: SKIP,
               ticker_symbol: SKIP, currency: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @isin = isin unless isin == SKIP
  @cusip = cusip unless cusip == SKIP
  @sedol = sedol unless sedol == SKIP
  @name = name unless name == SKIP
  @ticker_symbol = ticker_symbol unless ticker_symbol == SKIP
  @currency = currency unless currency == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#currencyString

Either a valid ‘iso_currency_code` or `unofficial_currency_code`

Returns:

  • (String)


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

def currency
  @currency
end

#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 [request ISIN/CUSIP access here](docs.google.com/forms/d/e/1FAIpQLSd9asHEYEfmf8fxJTHZTAfAzW4d ugsnSu-HS2J51f1mxwd6Sw/viewform).

Returns:

  • (String)


35
36
37
# File 'lib/the_plaid_api/models/security_override.rb', line 35

def cusip
  @cusip
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 [request ISIN/CUSIP access here](docs.google.com/forms/d/e/1FAIpQLSd9asHEYEfmf8fxJTHZTAfAzW4d ugsnSu-HS2J51f1mxwd6Sw/viewform).

Returns:

  • (String)


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

def isin
  @isin
end

#nameString

A descriptive name for the security, suitable for display.

Returns:

  • (String)


44
45
46
# File 'lib/the_plaid_api/models/security_override.rb', line 44

def name
  @name
end

#sedolString

(Deprecated) 7-character SEDOL, an identifier assigned to securities in the UK.

Returns:

  • (String)


40
41
42
# File 'lib/the_plaid_api/models/security_override.rb', line 40

def sedol
  @sedol
end

#ticker_symbolString

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

Returns:

  • (String)


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

def ticker_symbol
  @ticker_symbol
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/the_plaid_api/models/security_override.rb', line 100

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  isin = hash.key?('isin') ? hash['isin'] : SKIP
  cusip = hash.key?('cusip') ? hash['cusip'] : SKIP
  sedol = hash.key?('sedol') ? hash['sedol'] : SKIP
  name = hash.key?('name') ? hash['name'] : SKIP
  ticker_symbol = hash.key?('ticker_symbol') ? hash['ticker_symbol'] : SKIP
  currency = hash.key?('currency') ? hash['currency'] : 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.
  SecurityOverride.new(isin: isin,
                       cusip: cusip,
                       sedol: sedol,
                       name: name,
                       ticker_symbol: ticker_symbol,
                       currency: currency,
                       additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



56
57
58
59
60
61
62
63
64
65
# File 'lib/the_plaid_api/models/security_override.rb', line 56

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['isin'] = 'isin'
  @_hash['cusip'] = 'cusip'
  @_hash['sedol'] = 'sedol'
  @_hash['name'] = 'name'
  @_hash['ticker_symbol'] = 'ticker_symbol'
  @_hash['currency'] = 'currency'
  @_hash
end

.nullablesObject

An array for nullable fields



80
81
82
# File 'lib/the_plaid_api/models/security_override.rb', line 80

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    isin
    cusip
    sedol
    name
    ticker_symbol
    currency
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



137
138
139
140
141
142
# File 'lib/the_plaid_api/models/security_override.rb', line 137

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

#to_sObject

Provides a human-readable string representation of the object.



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

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