Class: FdxV660Api::UsGovernmentSecurityIncome
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- FdxV660Api::UsGovernmentSecurityIncome
- Defined in:
- lib/fdx_v660_api/models/us_government_security_income.rb
Overview
Details of dividend income portion earned from a US government security
Instance Attribute Summary collapse
-
#agency_incomes ⇒ Array[UsGovernmentSecurityIncome1]
Details of dividend income portion earned from a US government security.
-
#security_name ⇒ String
Name of fund or security.
-
#total_dividends ⇒ Float
Total dividends from this fund.
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.
Instance Method Summary collapse
-
#initialize(security_name: SKIP, total_dividends: SKIP, agency_incomes: SKIP, additional_properties: nil) ⇒ UsGovernmentSecurityIncome
constructor
A new instance of UsGovernmentSecurityIncome.
-
#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_name: SKIP, total_dividends: SKIP, agency_incomes: SKIP, additional_properties: nil) ⇒ UsGovernmentSecurityIncome
Returns a new instance of UsGovernmentSecurityIncome.
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/fdx_v660_api/models/us_government_security_income.rb', line 47 def initialize(security_name: SKIP, total_dividends: SKIP, agency_incomes: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @security_name = security_name unless security_name == SKIP @total_dividends = total_dividends unless total_dividends == SKIP @agency_incomes = agency_incomes unless agency_incomes == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#agency_incomes ⇒ Array[UsGovernmentSecurityIncome1]
Details of dividend income portion earned from a US government security
22 23 24 |
# File 'lib/fdx_v660_api/models/us_government_security_income.rb', line 22 def agency_incomes @agency_incomes end |
#security_name ⇒ String
Name of fund or security
14 15 16 |
# File 'lib/fdx_v660_api/models/us_government_security_income.rb', line 14 def security_name @security_name end |
#total_dividends ⇒ Float
Total dividends from this fund
18 19 20 |
# File 'lib/fdx_v660_api/models/us_government_security_income.rb', line 18 def total_dividends @total_dividends end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/fdx_v660_api/models/us_government_security_income.rb', line 59 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. security_name = hash.key?('securityName') ? hash['securityName'] : SKIP total_dividends = hash.key?('totalDividends') ? hash['totalDividends'] : SKIP # Parameter is an array, so we need to iterate through it agency_incomes = nil unless hash['agencyIncomes'].nil? agency_incomes = [] hash['agencyIncomes'].each do |structure| agency_incomes << (UsGovernmentSecurityIncome1.from_hash(structure) if structure) end end agency_incomes = SKIP unless hash.key?('agencyIncomes') # 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. UsGovernmentSecurityIncome.new(security_name: security_name, total_dividends: total_dividends, agency_incomes: agency_incomes, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
25 26 27 28 29 30 31 |
# File 'lib/fdx_v660_api/models/us_government_security_income.rb', line 25 def self.names @_hash = {} if @_hash.nil? @_hash['security_name'] = 'securityName' @_hash['total_dividends'] = 'totalDividends' @_hash['agency_incomes'] = 'agencyIncomes' @_hash end |
.nullables ⇒ Object
An array for nullable fields
43 44 45 |
# File 'lib/fdx_v660_api/models/us_government_security_income.rb', line 43 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
34 35 36 37 38 39 40 |
# File 'lib/fdx_v660_api/models/us_government_security_income.rb', line 34 def self.optionals %w[ security_name total_dividends agency_incomes ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
99 100 101 102 103 104 |
# File 'lib/fdx_v660_api/models/us_government_security_income.rb', line 99 def inspect class_name = self.class.name.split('::').last "<#{class_name} security_name: #{@security_name.inspect}, total_dividends:"\ " #{@total_dividends.inspect}, agency_incomes: #{@agency_incomes.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
92 93 94 95 96 |
# File 'lib/fdx_v660_api/models/us_government_security_income.rb', line 92 def to_s class_name = self.class.name.split('::').last "<#{class_name} security_name: #{@security_name}, total_dividends: #{@total_dividends},"\ " agency_incomes: #{@agency_incomes}, additional_properties: #{@additional_properties}>" end |