Class: FdxV660Api::DigitalAssetSecurityEntity
- Inherits:
-
SecurityEntity
- Object
- CoreLibrary::BaseModel
- BaseModel
- SecurityEntity
- FdxV660Api::DigitalAssetSecurityEntity
- Defined in:
- lib/fdx_v660_api/models/digital_asset_security_entity.rb
Overview
A Digital Asset held on an investment account
Instance Attribute Summary collapse
-
#digital_units ⇒ String
Specify units to full precision with unlimited digits after decimal point.
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(digital_units: SKIP, security_category: 'Digital Asset Security entity', fi_attributes: SKIP, additional_properties: nil) ⇒ DigitalAssetSecurityEntity
constructor
A new instance of DigitalAssetSecurityEntity.
-
#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(digital_units: SKIP, security_category: 'Digital Asset Security entity', fi_attributes: SKIP, additional_properties: nil) ⇒ DigitalAssetSecurityEntity
Returns a new instance of DigitalAssetSecurityEntity.
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/fdx_v660_api/models/digital_asset_security_entity.rb', line 37 def initialize(digital_units: SKIP, security_category: 'Digital Asset Security entity', fi_attributes: SKIP, additional_properties: nil) @digital_units = digital_units unless digital_units == 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
#digital_units ⇒ String
Specify units to full precision with unlimited digits after decimal point
13 14 15 |
# File 'lib/fdx_v660_api/models/digital_asset_security_entity.rb', line 13 def digital_units @digital_units end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/fdx_v660_api/models/digital_asset_security_entity.rb', line 50 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. digital_units = hash.key?('digitalUnits') ? hash['digitalUnits'] : SKIP security_category = hash['securityCategory'] ||= 'Digital Asset 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. DigitalAssetSecurityEntity.new(digital_units: digital_units, 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.
16 17 18 19 20 21 |
# File 'lib/fdx_v660_api/models/digital_asset_security_entity.rb', line 16 def self.names @_hash = {} if @_hash.nil? @_hash['digital_units'] = 'digitalUnits' @_hash = super().merge(@_hash) @_hash end |
.nullables ⇒ Object
An array for nullable fields
32 33 34 35 |
# File 'lib/fdx_v660_api/models/digital_asset_security_entity.rb', line 32 def self.nullables _arr = [] (_arr << super()).flatten! end |
.optionals ⇒ Object
An array for optional fields
24 25 26 27 28 29 |
# File 'lib/fdx_v660_api/models/digital_asset_security_entity.rb', line 24 def self.optionals _arr = %w[ digital_units ] (_arr << super()).flatten! end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
84 85 86 87 88 89 90 |
# File 'lib/fdx_v660_api/models/digital_asset_security_entity.rb', line 84 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.
100 101 102 103 104 |
# File 'lib/fdx_v660_api/models/digital_asset_security_entity.rb', line 100 def inspect class_name = self.class.name.split('::').last super_string = super().inspect.sub(/^<[^ ]+ /, '').sub(/>$/, '') "<#{class_name} #{super_string}, digital_units: #{@digital_units.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
93 94 95 96 97 |
# File 'lib/fdx_v660_api/models/digital_asset_security_entity.rb', line 93 def to_s class_name = self.class.name.split('::').last super_string = super().sub(/^<[^ ]+ /, '').sub(/>$/, '') "<#{class_name} #{super_string}, digital_units: #{@digital_units}>" end |