Class: Plaid::SecurityOverride

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/plaid/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`, `isin`, or `sedol`) 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.



71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/plaid/models/security_override.rb', line 71

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)


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

def currency
  @currency
end

#cusipString

9-character CUSIP, an identifier assigned to North American securities.

Returns:

  • (String)


23
24
25
# File 'lib/plaid/models/security_override.rb', line 23

def cusip
  @cusip
end

#isinString

12-character ISIN, a globally unique securities identifier.

Returns:

  • (String)


19
20
21
# File 'lib/plaid/models/security_override.rb', line 19

def isin
  @isin
end

#nameString

A descriptive name for the security, suitable for display.

Returns:

  • (String)


31
32
33
# File 'lib/plaid/models/security_override.rb', line 31

def name
  @name
end

#sedolString

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

Returns:

  • (String)


27
28
29
# File 'lib/plaid/models/security_override.rb', line 27

def sedol
  @sedol
end

#ticker_symbolString

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

Returns:

  • (String)


36
37
38
# File 'lib/plaid/models/security_override.rb', line 36

def ticker_symbol
  @ticker_symbol
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/plaid/models/security_override.rb', line 87

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.



43
44
45
46
47
48
49
50
51
52
# File 'lib/plaid/models/security_override.rb', line 43

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



67
68
69
# File 'lib/plaid/models/security_override.rb', line 67

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

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.



124
125
126
127
128
129
# File 'lib/plaid/models/security_override.rb', line 124

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.



116
117
118
119
120
121
# File 'lib/plaid/models/security_override.rb', line 116

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