Class: FdxV660Api::SecurityEntity
- Defined in:
- lib/fdx_v660_api/models/security_entity.rb
Overview
A base Security entity which defines the type of this security
Direct Known Subclasses
AnnuitySecurityEntity, CertificateOfDepositSecurityEntity, DebtSecurityEntity, DigitalAssetSecurityEntity, MutualFundSecurityEntity, OptionSecurityEntity, OtherSecurityEntity, StockSecurityEntity, SweepSecurityEntity
Instance Attribute Summary collapse
-
#fi_attributes ⇒ Array[FiAttributeEntity]
Array of FI-specific attributes.
-
#security_category ⇒ String
TODO: Write general description for this method.
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.
Instance Method Summary collapse
-
#initialize(security_category: 'Security entity', fi_attributes: SKIP, additional_properties: nil) ⇒ SecurityEntity
constructor
A new instance of SecurityEntity.
-
#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(security_category: 'Security entity', fi_attributes: SKIP, additional_properties: nil) ⇒ SecurityEntity
Returns a new instance of SecurityEntity.
59 60 61 62 63 64 65 66 67 |
# File 'lib/fdx_v660_api/models/security_entity.rb', line 59 def initialize(security_category: 'Security entity', fi_attributes: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @security_category = security_category unless security_category == SKIP @fi_attributes = fi_attributes unless fi_attributes == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#fi_attributes ⇒ Array[FiAttributeEntity]
Array of FI-specific attributes
18 19 20 |
# File 'lib/fdx_v660_api/models/security_entity.rb', line 18 def fi_attributes @fi_attributes end |
#security_category ⇒ String
TODO: Write general description for this method
14 15 16 |
# File 'lib/fdx_v660_api/models/security_entity.rb', line 14 def security_category @security_category end |
Class Method Details
.discriminators ⇒ Object
Discriminators mapping.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/fdx_v660_api/models/security_entity.rb', line 21 def self.discriminators if @_discriminators.nil? @_discriminators = {} @_discriminators['Annuity Security entity'] = AnnuitySecurityEntity @_discriminators['Certificate Of Deposit Security entity'] = CertificateOfDepositSecurityEntity @_discriminators['Debt Security entity'] = DebtSecurityEntity @_discriminators['Digital Asset Security entity'] = DigitalAssetSecurityEntity @_discriminators['Mutual Fund Security entity'] = MutualFundSecurityEntity @_discriminators['Option Security entity'] = OptionSecurityEntity @_discriminators['Other Security entity'] = OtherSecurityEntity @_discriminators['Stock Security entity'] = StockSecurityEntity @_discriminators['Sweep Security entity'] = SweepSecurityEntity @_discriminators['Bond Security entity'] = BondSecurityEntity end @_discriminators end |
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/fdx_v660_api/models/security_entity.rb', line 70 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. security_category = hash['securityCategory'] ||= '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. SecurityEntity.new(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.
39 40 41 42 43 44 |
# File 'lib/fdx_v660_api/models/security_entity.rb', line 39 def self.names @_hash = {} if @_hash.nil? @_hash['security_category'] = 'securityCategory' @_hash['fi_attributes'] = 'fiAttributes' @_hash end |
.nullables ⇒ Object
An array for nullable fields
55 56 57 |
# File 'lib/fdx_v660_api/models/security_entity.rb', line 55 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
47 48 49 50 51 52 |
# File 'lib/fdx_v660_api/models/security_entity.rb', line 47 def self.optionals %w[ security_category fi_attributes ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
112 113 114 115 116 |
# File 'lib/fdx_v660_api/models/security_entity.rb', line 112 def inspect class_name = self.class.name.split('::').last "<#{class_name} security_category: #{@security_category.inspect}, fi_attributes:"\ " #{@fi_attributes.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
105 106 107 108 109 |
# File 'lib/fdx_v660_api/models/security_entity.rb', line 105 def to_s class_name = self.class.name.split('::').last "<#{class_name} security_category: #{@security_category}, fi_attributes: #{@fi_attributes},"\ " additional_properties: #{@additional_properties}>" end |