Class: ThePlaidApi::AssetHolding

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

Overview

Documentation not found in the MISMO model viewer and not provided by Freddie Mac.

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(asset_holding_id:, currency:, asset_holding_description:, asset_holding_symbol:, asset_holding_security_name:, asset_holding_units:, asset_holding_market_value_amount:, asset_holding_current_price_amount:, asset_holding_type:, asset_holding_restricted_indicator:, asset_holding_vested_amount:, additional_properties: nil) ⇒ AssetHolding

Returns a new instance of AssetHolding.



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

def initialize(asset_holding_id:, currency:, asset_holding_description:,
               asset_holding_symbol:, asset_holding_security_name:,
               asset_holding_units:, asset_holding_market_value_amount:,
               asset_holding_current_price_amount:, asset_holding_type:,
               asset_holding_restricted_indicator:,
               asset_holding_vested_amount:, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @asset_holding_id = asset_holding_id
  @currency = currency
  @asset_holding_description = asset_holding_description
  @asset_holding_symbol = asset_holding_symbol
  @asset_holding_security_name = asset_holding_security_name
  @asset_holding_units = asset_holding_units
  @asset_holding_market_value_amount = asset_holding_market_value_amount
  @asset_holding_current_price_amount = asset_holding_current_price_amount
  @asset_holding_type = asset_holding_type
  @asset_holding_restricted_indicator = asset_holding_restricted_indicator
  @asset_holding_vested_amount = asset_holding_vested_amount
  @additional_properties = additional_properties
end

Instance Attribute Details

#asset_holding_current_price_amountFloat

current price of investment holding

Returns:

  • (Float)


43
44
45
# File 'lib/the_plaid_api/models/asset_holding.rb', line 43

def asset_holding_current_price_amount
  @asset_holding_current_price_amount
end

#asset_holding_descriptionString

Description of holding

Returns:

  • (String)


23
24
25
# File 'lib/the_plaid_api/models/asset_holding.rb', line 23

def asset_holding_description
  @asset_holding_description
end

#asset_holding_idString

Unique id of investment position

Returns:

  • (String)


15
16
17
# File 'lib/the_plaid_api/models/asset_holding.rb', line 15

def asset_holding_id
  @asset_holding_id
end

#asset_holding_market_value_amountFloat

market value of investment position

Returns:

  • (Float)


39
40
41
# File 'lib/the_plaid_api/models/asset_holding.rb', line 39

def asset_holding_market_value_amount
  @asset_holding_market_value_amount
end

#asset_holding_restricted_indicatorAssetHoldingRestrictedIndicator

Whether or not the stock is restricted, i.e. “Restricted” or “Not Restricted”



52
53
54
# File 'lib/the_plaid_api/models/asset_holding.rb', line 52

def asset_holding_restricted_indicator
  @asset_holding_restricted_indicator
end

#asset_holding_security_nameString

Security name of investment holding

Returns:

  • (String)


31
32
33
# File 'lib/the_plaid_api/models/asset_holding.rb', line 31

def asset_holding_security_name
  @asset_holding_security_name
end

#asset_holding_symbolString

Investment position’s market ticker symbol

Returns:

  • (String)


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

def asset_holding_symbol
  @asset_holding_symbol
end

#asset_holding_typeAssetHoldingType

Type of holding (e.g. bond, stock, crypto, other)

Returns:



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

def asset_holding_type
  @asset_holding_type
end

#asset_holding_unitsFloat

Number of units of holding

Returns:

  • (Float)


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

def asset_holding_units
  @asset_holding_units
end

#asset_holding_vested_amountFloat

Amount of holding vested

Returns:

  • (Float)


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

def asset_holding_vested_amount
  @asset_holding_vested_amount
end

#currencyString

US Dollar

Returns:

  • (String)


19
20
21
# File 'lib/the_plaid_api/models/asset_holding.rb', line 19

def currency
  @currency
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/the_plaid_api/models/asset_holding.rb', line 124

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  asset_holding_id =
    hash.key?('AssetHoldingID') ? hash['AssetHoldingID'] : nil
  currency = hash.key?('Currency') ? hash['Currency'] : nil
  asset_holding_description =
    hash.key?('AssetHoldingDescription') ? hash['AssetHoldingDescription'] : nil
  asset_holding_symbol =
    hash.key?('AssetHoldingSymbol') ? hash['AssetHoldingSymbol'] : nil
  asset_holding_security_name =
    hash.key?('AssetHoldingSecurityName') ? hash['AssetHoldingSecurityName'] : nil
  asset_holding_units =
    hash.key?('AssetHoldingUnits') ? hash['AssetHoldingUnits'] : nil
  asset_holding_market_value_amount =
    hash.key?('AssetHoldingMarketValueAmount') ? hash['AssetHoldingMarketValueAmount'] : nil
  asset_holding_current_price_amount =
    hash.key?('AssetHoldingCurrentPriceAmount') ? hash['AssetHoldingCurrentPriceAmount'] : nil
  asset_holding_type =
    hash.key?('AssetHoldingType') ? hash['AssetHoldingType'] : nil
  asset_holding_restricted_indicator =
    hash.key?('AssetHoldingRestrictedIndicator') ? hash['AssetHoldingRestrictedIndicator'] : nil
  asset_holding_vested_amount =
    hash.key?('AssetHoldingVestedAmount') ? hash['AssetHoldingVestedAmount'] : 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.
  AssetHolding.new(asset_holding_id: asset_holding_id,
                   currency: currency,
                   asset_holding_description: asset_holding_description,
                   asset_holding_symbol: asset_holding_symbol,
                   asset_holding_security_name: asset_holding_security_name,
                   asset_holding_units: asset_holding_units,
                   asset_holding_market_value_amount: asset_holding_market_value_amount,
                   asset_holding_current_price_amount: asset_holding_current_price_amount,
                   asset_holding_type: asset_holding_type,
                   asset_holding_restricted_indicator: asset_holding_restricted_indicator,
                   asset_holding_vested_amount: asset_holding_vested_amount,
                   additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/the_plaid_api/models/asset_holding.rb', line 59

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['asset_holding_id'] = 'AssetHoldingID'
  @_hash['currency'] = 'Currency'
  @_hash['asset_holding_description'] = 'AssetHoldingDescription'
  @_hash['asset_holding_symbol'] = 'AssetHoldingSymbol'
  @_hash['asset_holding_security_name'] = 'AssetHoldingSecurityName'
  @_hash['asset_holding_units'] = 'AssetHoldingUnits'
  @_hash['asset_holding_market_value_amount'] =
    'AssetHoldingMarketValueAmount'
  @_hash['asset_holding_current_price_amount'] =
    'AssetHoldingCurrentPriceAmount'
  @_hash['asset_holding_type'] = 'AssetHoldingType'
  @_hash['asset_holding_restricted_indicator'] =
    'AssetHoldingRestrictedIndicator'
  @_hash['asset_holding_vested_amount'] = 'AssetHoldingVestedAmount'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  %w[
    asset_holding_id
    currency
    asset_holding_description
    asset_holding_symbol
    asset_holding_security_name
    asset_holding_units
    asset_holding_market_value_amount
    asset_holding_current_price_amount
    asset_holding_type
    asset_holding_restricted_indicator
    asset_holding_vested_amount
  ]
end

.optionalsObject

An array for optional fields



79
80
81
# File 'lib/the_plaid_api/models/asset_holding.rb', line 79

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



187
188
189
190
191
192
193
194
195
196
197
198
199
200
# File 'lib/the_plaid_api/models/asset_holding.rb', line 187

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} asset_holding_id: #{@asset_holding_id.inspect}, currency:"\
  " #{@currency.inspect}, asset_holding_description: #{@asset_holding_description.inspect},"\
  " asset_holding_symbol: #{@asset_holding_symbol.inspect}, asset_holding_security_name:"\
  " #{@asset_holding_security_name.inspect}, asset_holding_units:"\
  " #{@asset_holding_units.inspect}, asset_holding_market_value_amount:"\
  " #{@asset_holding_market_value_amount.inspect}, asset_holding_current_price_amount:"\
  " #{@asset_holding_current_price_amount.inspect}, asset_holding_type:"\
  " #{@asset_holding_type.inspect}, asset_holding_restricted_indicator:"\
  " #{@asset_holding_restricted_indicator.inspect}, asset_holding_vested_amount:"\
  " #{@asset_holding_vested_amount.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



173
174
175
176
177
178
179
180
181
182
183
184
# File 'lib/the_plaid_api/models/asset_holding.rb', line 173

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} asset_holding_id: #{@asset_holding_id}, currency: #{@currency},"\
  " asset_holding_description: #{@asset_holding_description}, asset_holding_symbol:"\
  " #{@asset_holding_symbol}, asset_holding_security_name: #{@asset_holding_security_name},"\
  " asset_holding_units: #{@asset_holding_units}, asset_holding_market_value_amount:"\
  " #{@asset_holding_market_value_amount}, asset_holding_current_price_amount:"\
  " #{@asset_holding_current_price_amount}, asset_holding_type: #{@asset_holding_type},"\
  " asset_holding_restricted_indicator: #{@asset_holding_restricted_indicator},"\
  " asset_holding_vested_amount: #{@asset_holding_vested_amount}, additional_properties:"\
  " #{@additional_properties}>"
end