Class: FdxV660Api::MutualFundSecurityEntity

Inherits:
SecurityEntity show all
Defined in:
lib/fdx_v660_api/models/mutual_fund_security_entity.rb

Overview

A mutual fund

Instance Attribute Summary collapse

Attributes inherited from SecurityEntity

#fi_attributes, #security_category

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from SecurityEntity

discriminators

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(mutual_fund_type: SKIP, units_street: SKIP, units_user: SKIP, reinvest_dividends: SKIP, reinvest_capital_gains: SKIP, myield: SKIP, yield_as_of_date: SKIP, security_category: 'Mutual Fund Security entity', fi_attributes: SKIP, additional_properties: nil) ⇒ MutualFundSecurityEntity

Returns a new instance of MutualFundSecurityEntity.



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/fdx_v660_api/models/mutual_fund_security_entity.rb', line 73

def initialize(mutual_fund_type: SKIP, units_street: SKIP, units_user: SKIP,
               reinvest_dividends: SKIP, reinvest_capital_gains: SKIP,
               myield: SKIP, yield_as_of_date: SKIP,
               security_category: 'Mutual Fund Security entity',
               fi_attributes: SKIP, additional_properties: nil)
  @mutual_fund_type = mutual_fund_type unless mutual_fund_type == SKIP
  @units_street = units_street unless units_street == SKIP
  @units_user = units_user unless units_user == SKIP
  @reinvest_dividends = reinvest_dividends unless reinvest_dividends == SKIP
  @reinvest_capital_gains = reinvest_capital_gains unless reinvest_capital_gains == 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

#mutual_fund_typeMutualFundType2

Mutual fund type. One of OPENEND, CLOSEEND, OTHER

Returns:



13
14
15
# File 'lib/fdx_v660_api/models/mutual_fund_security_entity.rb', line 13

def mutual_fund_type
  @mutual_fund_type
end

#myieldFloat

Current yield reported as portion of the fund's assets

Returns:

  • (Float)


33
34
35
# File 'lib/fdx_v660_api/models/mutual_fund_security_entity.rb', line 33

def myield
  @myield
end

#reinvest_capital_gainsTrueClass | FalseClass

Reinvest capital gains

Returns:

  • (TrueClass | FalseClass)


29
30
31
# File 'lib/fdx_v660_api/models/mutual_fund_security_entity.rb', line 29

def reinvest_capital_gains
  @reinvest_capital_gains
end

#reinvest_dividendsTrueClass | FalseClass

Reinvest dividends

Returns:

  • (TrueClass | FalseClass)


25
26
27
# File 'lib/fdx_v660_api/models/mutual_fund_security_entity.rb', line 25

def reinvest_dividends
  @reinvest_dividends
end

#units_streetFloat

Units in the FI's street name, positive quantity

Returns:

  • (Float)


17
18
19
# File 'lib/fdx_v660_api/models/mutual_fund_security_entity.rb', line 17

def units_street
  @units_street
end

#units_userFloat

Units in user's name directly, positive quantity

Returns:

  • (Float)


21
22
23
# File 'lib/fdx_v660_api/models/mutual_fund_security_entity.rb', line 21

def units_user
  @units_user
end

#yield_as_of_dateDate

As-of date for yield value

Returns:

  • (Date)


37
38
39
# File 'lib/fdx_v660_api/models/mutual_fund_security_entity.rb', line 37

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.



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
129
130
131
132
133
134
135
136
137
138
139
140
# File 'lib/fdx_v660_api/models/mutual_fund_security_entity.rb', line 94

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  mutual_fund_type =
    hash.key?('mutualFundType') ? hash['mutualFundType'] : SKIP
  units_street = hash.key?('unitsStreet') ? hash['unitsStreet'] : SKIP
  units_user = hash.key?('unitsUser') ? hash['unitsUser'] : SKIP
  reinvest_dividends =
    hash.key?('reinvestDividends') ? hash['reinvestDividends'] : SKIP
  reinvest_capital_gains =
    hash.key?('reinvestCapitalGains') ? hash['reinvestCapitalGains'] : SKIP
  myield = hash.key?('yield') ? hash['yield'] : SKIP
  yield_as_of_date =
    hash.key?('yieldAsOfDate') ? hash['yieldAsOfDate'] : SKIP
  security_category =
    hash['securityCategory'] ||= 'Mutual Fund 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.
  MutualFundSecurityEntity.new(mutual_fund_type: mutual_fund_type,
                               units_street: units_street,
                               units_user: units_user,
                               reinvest_dividends: reinvest_dividends,
                               reinvest_capital_gains: reinvest_capital_gains,
                               myield: myield,
                               yield_as_of_date: yield_as_of_date,
                               security_category: security_category,
                               fi_attributes: fi_attributes,
                               additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/fdx_v660_api/models/mutual_fund_security_entity.rb', line 40

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['mutual_fund_type'] = 'mutualFundType'
  @_hash['units_street'] = 'unitsStreet'
  @_hash['units_user'] = 'unitsUser'
  @_hash['reinvest_dividends'] = 'reinvestDividends'
  @_hash['reinvest_capital_gains'] = 'reinvestCapitalGains'
  @_hash['myield'] = 'yield'
  @_hash['yield_as_of_date'] = 'yieldAsOfDate'
  @_hash = super().merge(@_hash)
  @_hash
end

.nullablesObject

An array for nullable fields



68
69
70
71
# File 'lib/fdx_v660_api/models/mutual_fund_security_entity.rb', line 68

def self.nullables
  _arr = []
  (_arr << super()).flatten!
end

.optionalsObject

An array for optional fields



54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/fdx_v660_api/models/mutual_fund_security_entity.rb', line 54

def self.optionals
  _arr = %w[
    mutual_fund_type
    units_street
    units_user
    reinvest_dividends
    reinvest_capital_gains
    myield
    yield_as_of_date
  ]
  (_arr << super()).flatten!
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



144
145
146
147
148
149
150
# File 'lib/fdx_v660_api/models/mutual_fund_security_entity.rb', line 144

def self.validate(value)
  return true if value.instance_of? self

  return false unless value.instance_of? Hash

  true
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



163
164
165
166
167
168
169
170
171
# File 'lib/fdx_v660_api/models/mutual_fund_security_entity.rb', line 163

def inspect
  class_name = self.class.name.split('::').last
  super_string = super().inspect.sub(/^<[^ ]+ /, '').sub(/>$/, '')
  "<#{class_name} #{super_string}, mutual_fund_type: #{@mutual_fund_type.inspect},"\
  " units_street: #{@units_street.inspect}, units_user: #{@units_user.inspect},"\
  " reinvest_dividends: #{@reinvest_dividends.inspect}, reinvest_capital_gains:"\
  " #{@reinvest_capital_gains.inspect}, myield: #{@myield.inspect}, yield_as_of_date:"\
  " #{@yield_as_of_date.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



153
154
155
156
157
158
159
160
# File 'lib/fdx_v660_api/models/mutual_fund_security_entity.rb', line 153

def to_s
  class_name = self.class.name.split('::').last
  super_string = super().sub(/^<[^ ]+ /, '').sub(/>$/, '')
  "<#{class_name} #{super_string}, mutual_fund_type: #{@mutual_fund_type}, units_street:"\
  " #{@units_street}, units_user: #{@units_user}, reinvest_dividends: #{@reinvest_dividends},"\
  " reinvest_capital_gains: #{@reinvest_capital_gains}, myield: #{@myield}, yield_as_of_date:"\
  " #{@yield_as_of_date}>"
end