Class: FdxV660Api::DebtSecurityEntity
- Inherits:
-
SecurityEntity
- Object
- CoreLibrary::BaseModel
- BaseModel
- SecurityEntity
- FdxV660Api::DebtSecurityEntity
- Defined in:
- lib/fdx_v660_api/models/debt_security_entity.rb
Overview
An investment in a debt security
Direct Known Subclasses
Instance Attribute Summary collapse
-
#bond_maturity_date ⇒ Date
Bond maturity date.
-
#call_date ⇒ Date
Next call date.
-
#call_price ⇒ Float
Bond call price.
-
#call_type ⇒ CallType2
Type of next call.
-
#coupon_date ⇒ Date
Maturity date for next coupon.
-
#coupon_mature_frequency ⇒ CouponMatureFrequency2
When coupons mature.
-
#coupon_rate ⇒ Float
Bond coupon rate for next closest call date.
-
#debt_class ⇒ DebtClass2
Classification of debt.
-
#debt_type ⇒ DebtType2
Debt type.
-
#par_value ⇒ Float
Par value amount.
-
#yield_to_call ⇒ Float
Yield to next call.
-
#yield_to_maturity ⇒ Float
Yield to maturity.
Attributes inherited from SecurityEntity
#fi_attributes, #security_category
Class Method Summary collapse
-
.discriminators ⇒ Object
Discriminators mapping.
-
.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(par_value: SKIP, debt_type: SKIP, debt_class: SKIP, coupon_rate: SKIP, coupon_date: SKIP, coupon_mature_frequency: SKIP, call_price: SKIP, yield_to_call: SKIP, call_date: SKIP, call_type: SKIP, yield_to_maturity: SKIP, bond_maturity_date: SKIP, security_category: 'Debt Security entity', fi_attributes: SKIP, additional_properties: nil) ⇒ DebtSecurityEntity
constructor
A new instance of DebtSecurityEntity.
-
#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 BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(par_value: SKIP, debt_type: SKIP, debt_class: SKIP, coupon_rate: SKIP, coupon_date: SKIP, coupon_mature_frequency: SKIP, call_price: SKIP, yield_to_call: SKIP, call_date: SKIP, call_type: SKIP, yield_to_maturity: SKIP, bond_maturity_date: SKIP, security_category: 'Debt Security entity', fi_attributes: SKIP, additional_properties: nil) ⇒ DebtSecurityEntity
Returns a new instance of DebtSecurityEntity.
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/fdx_v660_api/models/debt_security_entity.rb', line 112 def initialize(par_value: SKIP, debt_type: SKIP, debt_class: SKIP, coupon_rate: SKIP, coupon_date: SKIP, coupon_mature_frequency: SKIP, call_price: SKIP, yield_to_call: SKIP, call_date: SKIP, call_type: SKIP, yield_to_maturity: SKIP, bond_maturity_date: SKIP, security_category: 'Debt Security entity', fi_attributes: SKIP, additional_properties: nil) @par_value = par_value unless par_value == SKIP @debt_type = debt_type unless debt_type == SKIP @debt_class = debt_class unless debt_class == SKIP @coupon_rate = coupon_rate unless coupon_rate == SKIP @coupon_date = coupon_date unless coupon_date == SKIP @coupon_mature_frequency = coupon_mature_frequency unless coupon_mature_frequency == SKIP @call_price = call_price unless call_price == SKIP @yield_to_call = yield_to_call unless yield_to_call == SKIP @call_date = call_date unless call_date == SKIP @call_type = call_type unless call_type == SKIP @yield_to_maturity = yield_to_maturity unless yield_to_maturity == SKIP @bond_maturity_date = bond_maturity_date unless bond_maturity_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
#bond_maturity_date ⇒ Date
Bond maturity date
57 58 59 |
# File 'lib/fdx_v660_api/models/debt_security_entity.rb', line 57 def bond_maturity_date @bond_maturity_date end |
#call_date ⇒ Date
Next call date
45 46 47 |
# File 'lib/fdx_v660_api/models/debt_security_entity.rb', line 45 def call_date @call_date end |
#call_price ⇒ Float
Bond call price
37 38 39 |
# File 'lib/fdx_v660_api/models/debt_security_entity.rb', line 37 def call_price @call_price end |
#call_type ⇒ CallType2
Type of next call. One of CALL, PUT, PREFUND, MATURITY
49 50 51 |
# File 'lib/fdx_v660_api/models/debt_security_entity.rb', line 49 def call_type @call_type end |
#coupon_date ⇒ Date
Maturity date for next coupon
29 30 31 |
# File 'lib/fdx_v660_api/models/debt_security_entity.rb', line 29 def coupon_date @coupon_date end |
#coupon_mature_frequency ⇒ CouponMatureFrequency2
When coupons mature. One of MONTHLY, QUARTERLY, SEMIANNUAL, ANNUAL, OTHER
33 34 35 |
# File 'lib/fdx_v660_api/models/debt_security_entity.rb', line 33 def coupon_mature_frequency @coupon_mature_frequency end |
#coupon_rate ⇒ Float
Bond coupon rate for next closest call date
25 26 27 |
# File 'lib/fdx_v660_api/models/debt_security_entity.rb', line 25 def coupon_rate @coupon_rate end |
#debt_class ⇒ DebtClass2
Classification of debt. One of TREASURY, MUNICIPAL, CORPORATE, OTHER
21 22 23 |
# File 'lib/fdx_v660_api/models/debt_security_entity.rb', line 21 def debt_class @debt_class end |
#debt_type ⇒ DebtType2
Debt type. One of COUPON, ZERO
17 18 19 |
# File 'lib/fdx_v660_api/models/debt_security_entity.rb', line 17 def debt_type @debt_type end |
#par_value ⇒ Float
Par value amount
13 14 15 |
# File 'lib/fdx_v660_api/models/debt_security_entity.rb', line 13 def par_value @par_value end |
#yield_to_call ⇒ Float
Yield to next call
41 42 43 |
# File 'lib/fdx_v660_api/models/debt_security_entity.rb', line 41 def yield_to_call @yield_to_call end |
#yield_to_maturity ⇒ Float
Yield to maturity
53 54 55 |
# File 'lib/fdx_v660_api/models/debt_security_entity.rb', line 53 def yield_to_maturity @yield_to_maturity end |
Class Method Details
.discriminators ⇒ Object
Discriminators mapping.
60 61 62 63 64 65 66 |
# File 'lib/fdx_v660_api/models/debt_security_entity.rb', line 60 def self.discriminators if @_discriminators.nil? @_discriminators = {} @_discriminators['Bond Security entity'] = BondSecurityEntity end @_discriminators end |
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
# File 'lib/fdx_v660_api/models/debt_security_entity.rb', line 140 def self.from_hash(hash) return nil unless hash # Delegate unboxing to another function if a discriminator # value for a child class is present. unboxer = discriminators[hash['securityCategory']] return unboxer.send(:from_hash, hash) if unboxer # Extract variables from the hash. par_value = hash.key?('parValue') ? hash['parValue'] : SKIP debt_type = hash.key?('debtType') ? hash['debtType'] : SKIP debt_class = hash.key?('debtClass') ? hash['debtClass'] : SKIP coupon_rate = hash.key?('couponRate') ? hash['couponRate'] : SKIP coupon_date = hash.key?('couponDate') ? hash['couponDate'] : SKIP coupon_mature_frequency = hash.key?('couponMatureFrequency') ? hash['couponMatureFrequency'] : SKIP call_price = hash.key?('callPrice') ? hash['callPrice'] : SKIP yield_to_call = hash.key?('yieldToCall') ? hash['yieldToCall'] : SKIP call_date = hash.key?('callDate') ? hash['callDate'] : SKIP call_type = hash.key?('callType') ? hash['callType'] : SKIP yield_to_maturity = hash.key?('yieldToMaturity') ? hash['yieldToMaturity'] : SKIP bond_maturity_date = hash.key?('bondMaturityDate') ? hash['bondMaturityDate'] : SKIP security_category = hash['securityCategory'] ||= 'Debt 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. DebtSecurityEntity.new(par_value: par_value, debt_type: debt_type, debt_class: debt_class, coupon_rate: coupon_rate, coupon_date: coupon_date, coupon_mature_frequency: coupon_mature_frequency, call_price: call_price, yield_to_call: yield_to_call, call_date: call_date, call_type: call_type, yield_to_maturity: yield_to_maturity, bond_maturity_date: bond_maturity_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.
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/fdx_v660_api/models/debt_security_entity.rb', line 69 def self.names @_hash = {} if @_hash.nil? @_hash['par_value'] = 'parValue' @_hash['debt_type'] = 'debtType' @_hash['debt_class'] = 'debtClass' @_hash['coupon_rate'] = 'couponRate' @_hash['coupon_date'] = 'couponDate' @_hash['coupon_mature_frequency'] = 'couponMatureFrequency' @_hash['call_price'] = 'callPrice' @_hash['yield_to_call'] = 'yieldToCall' @_hash['call_date'] = 'callDate' @_hash['call_type'] = 'callType' @_hash['yield_to_maturity'] = 'yieldToMaturity' @_hash['bond_maturity_date'] = 'bondMaturityDate' @_hash = super().merge(@_hash) @_hash end |
.nullables ⇒ Object
An array for nullable fields
107 108 109 110 |
# File 'lib/fdx_v660_api/models/debt_security_entity.rb', line 107 def self.nullables _arr = [] (_arr << super()).flatten! end |
.optionals ⇒ Object
An array for optional fields
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/fdx_v660_api/models/debt_security_entity.rb', line 88 def self.optionals _arr = %w[ par_value debt_type debt_class coupon_rate coupon_date coupon_mature_frequency call_price yield_to_call call_date call_type yield_to_maturity bond_maturity_date ] (_arr << super()).flatten! end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
203 204 205 206 207 208 209 210 211 212 213 214 |
# File 'lib/fdx_v660_api/models/debt_security_entity.rb', line 203 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash # Delegate validation to another function if a discriminator # value for a child class is present. validator = discriminators[value['securityCategory']] return validator.send(:validate, value) if validator true end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
228 229 230 231 232 233 234 235 236 237 238 |
# File 'lib/fdx_v660_api/models/debt_security_entity.rb', line 228 def inspect class_name = self.class.name.split('::').last super_string = super().inspect.sub(/^<[^ ]+ /, '').sub(/>$/, '') "<#{class_name} #{super_string}, par_value: #{@par_value.inspect}, debt_type:"\ " #{@debt_type.inspect}, debt_class: #{@debt_class.inspect}, coupon_rate:"\ " #{@coupon_rate.inspect}, coupon_date: #{@coupon_date.inspect}, coupon_mature_frequency:"\ " #{@coupon_mature_frequency.inspect}, call_price: #{@call_price.inspect}, yield_to_call:"\ " #{@yield_to_call.inspect}, call_date: #{@call_date.inspect}, call_type:"\ " #{@call_type.inspect}, yield_to_maturity: #{@yield_to_maturity.inspect},"\ " bond_maturity_date: #{@bond_maturity_date.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
217 218 219 220 221 222 223 224 225 |
# File 'lib/fdx_v660_api/models/debt_security_entity.rb', line 217 def to_s class_name = self.class.name.split('::').last super_string = super().sub(/^<[^ ]+ /, '').sub(/>$/, '') "<#{class_name} #{super_string}, par_value: #{@par_value}, debt_type: #{@debt_type},"\ " debt_class: #{@debt_class}, coupon_rate: #{@coupon_rate}, coupon_date: #{@coupon_date},"\ " coupon_mature_frequency: #{@coupon_mature_frequency}, call_price: #{@call_price},"\ " yield_to_call: #{@yield_to_call}, call_date: #{@call_date}, call_type: #{@call_type},"\ " yield_to_maturity: #{@yield_to_maturity}, bond_maturity_date: #{@bond_maturity_date}>" end |