Class: FdxV660Api::StockSecurityEntity
- Inherits:
-
SecurityEntity
- Object
- CoreLibrary::BaseModel
- BaseModel
- SecurityEntity
- FdxV660Api::StockSecurityEntity
- Defined in:
- lib/fdx_v660_api/models/stock_security_entity.rb
Overview
A stock security
Instance Attribute Summary collapse
-
#myield ⇒ Float
The current yield.
-
#reinvest_dividends ⇒ TrueClass | FalseClass
Selection to reinvest dividends.
-
#stock_type ⇒ StockType2
COMMON, PREFERRED, CONVERTIBLE, OTHER.
-
#units_street ⇒ Float
The units in the FI's street name as a positive quantity.
-
#units_user ⇒ Float
The units in user's name directly as a positive quantity.
-
#yield_as_of_date ⇒ Date
Yield as-of date.
Attributes inherited from SecurityEntity
#fi_attributes, #security_category
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(units_street: SKIP, units_user: SKIP, reinvest_dividends: SKIP, stock_type: SKIP, myield: SKIP, yield_as_of_date: SKIP, security_category: 'Stock Security entity', fi_attributes: SKIP, additional_properties: nil) ⇒ StockSecurityEntity
constructor
A new instance of StockSecurityEntity.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from SecurityEntity
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(units_street: SKIP, units_user: SKIP, reinvest_dividends: SKIP, stock_type: SKIP, myield: SKIP, yield_as_of_date: SKIP, security_category: 'Stock Security entity', fi_attributes: SKIP, additional_properties: nil) ⇒ StockSecurityEntity
Returns a new instance of StockSecurityEntity.
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/fdx_v660_api/models/stock_security_entity.rb', line 67 def initialize(units_street: SKIP, units_user: SKIP, reinvest_dividends: SKIP, stock_type: SKIP, myield: SKIP, yield_as_of_date: SKIP, security_category: 'Stock Security entity', fi_attributes: SKIP, additional_properties: nil) @units_street = units_street unless units_street == SKIP @units_user = units_user unless units_user == SKIP @reinvest_dividends = reinvest_dividends unless reinvest_dividends == SKIP @stock_type = stock_type unless stock_type == SKIP @myield = myield unless myield == SKIP @yield_as_of_date = yield_as_of_date unless yield_as_of_date == SKIP @additional_properties = additional_properties # Call the constructor of the base class super(security_category: security_category, fi_attributes: fi_attributes, additional_properties: additional_properties) end |
Instance Attribute Details
#myield ⇒ Float
The current yield
29 30 31 |
# File 'lib/fdx_v660_api/models/stock_security_entity.rb', line 29 def myield @myield end |
#reinvest_dividends ⇒ TrueClass | FalseClass
Selection to reinvest dividends
21 22 23 |
# File 'lib/fdx_v660_api/models/stock_security_entity.rb', line 21 def reinvest_dividends @reinvest_dividends end |
#stock_type ⇒ StockType2
COMMON, PREFERRED, CONVERTIBLE, OTHER
25 26 27 |
# File 'lib/fdx_v660_api/models/stock_security_entity.rb', line 25 def stock_type @stock_type end |
#units_street ⇒ Float
The units in the FI's street name as a positive quantity
13 14 15 |
# File 'lib/fdx_v660_api/models/stock_security_entity.rb', line 13 def units_street @units_street end |
#units_user ⇒ Float
The units in user's name directly as a positive quantity
17 18 19 |
# File 'lib/fdx_v660_api/models/stock_security_entity.rb', line 17 def units_user @units_user end |
#yield_as_of_date ⇒ Date
Yield as-of date
33 34 35 |
# File 'lib/fdx_v660_api/models/stock_security_entity.rb', line 33 def yield_as_of_date @yield_as_of_date 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 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/fdx_v660_api/models/stock_security_entity.rb', line 87 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. units_street = hash.key?('unitsStreet') ? hash['unitsStreet'] : SKIP units_user = hash.key?('unitsUser') ? hash['unitsUser'] : SKIP reinvest_dividends = hash.key?('reinvestDividends') ? hash['reinvestDividends'] : SKIP stock_type = hash.key?('stockType') ? hash['stockType'] : SKIP myield = hash.key?('yield') ? hash['yield'] : SKIP yield_as_of_date = hash.key?('yieldAsOfDate') ? hash['yieldAsOfDate'] : SKIP security_category = hash['securityCategory'] ||= 'Stock Security entity' # Parameter is an array, so we need to iterate through it fi_attributes = nil unless hash['fiAttributes'].nil? fi_attributes = [] hash['fiAttributes'].each do |structure| fi_attributes << (FiAttributeEntity.from_hash(structure) if structure) end end fi_attributes = SKIP unless hash.key?('fiAttributes') # 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. StockSecurityEntity.new(units_street: units_street, units_user: units_user, reinvest_dividends: reinvest_dividends, stock_type: stock_type, myield: myield, yield_as_of_date: yield_as_of_date, security_category: security_category, fi_attributes: fi_attributes, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/fdx_v660_api/models/stock_security_entity.rb', line 36 def self.names @_hash = {} if @_hash.nil? @_hash['units_street'] = 'unitsStreet' @_hash['units_user'] = 'unitsUser' @_hash['reinvest_dividends'] = 'reinvestDividends' @_hash['stock_type'] = 'stockType' @_hash['myield'] = 'yield' @_hash['yield_as_of_date'] = 'yieldAsOfDate' @_hash = super().merge(@_hash) @_hash end |
.nullables ⇒ Object
An array for nullable fields
62 63 64 65 |
# File 'lib/fdx_v660_api/models/stock_security_entity.rb', line 62 def self.nullables _arr = [] (_arr << super()).flatten! end |
.optionals ⇒ Object
An array for optional fields
49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/fdx_v660_api/models/stock_security_entity.rb', line 49 def self.optionals _arr = %w[ units_street units_user reinvest_dividends stock_type myield yield_as_of_date ] (_arr << super()).flatten! end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
132 133 134 135 136 137 138 |
# File 'lib/fdx_v660_api/models/stock_security_entity.rb', line 132 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
150 151 152 153 154 155 156 157 |
# File 'lib/fdx_v660_api/models/stock_security_entity.rb', line 150 def inspect class_name = self.class.name.split('::').last super_string = super().inspect.sub(/^<[^ ]+ /, '').sub(/>$/, '') "<#{class_name} #{super_string}, units_street: #{@units_street.inspect}, units_user:"\ " #{@units_user.inspect}, reinvest_dividends: #{@reinvest_dividends.inspect}, stock_type:"\ " #{@stock_type.inspect}, myield: #{@myield.inspect}, yield_as_of_date:"\ " #{@yield_as_of_date.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
141 142 143 144 145 146 147 |
# File 'lib/fdx_v660_api/models/stock_security_entity.rb', line 141 def to_s class_name = self.class.name.split('::').last super_string = super().sub(/^<[^ ]+ /, '').sub(/>$/, '') "<#{class_name} #{super_string}, units_street: #{@units_street}, units_user:"\ " #{@units_user}, reinvest_dividends: #{@reinvest_dividends}, stock_type: #{@stock_type},"\ " myield: #{@myield}, yield_as_of_date: #{@yield_as_of_date}>" end |