Class: ProtonApi::LifeInsuranceNeedsCalculatorRequest
- Inherits:
-
Object
- Object
- ProtonApi::LifeInsuranceNeedsCalculatorRequest
- Defined in:
- lib/proton_api/models/life_insurance_needs_calculator_request.rb
Instance Attribute Summary collapse
-
#beneficiary_bequest_config ⇒ Object
Returns the value of attribute beneficiary_bequest_config.
-
#benefit_amount_rounding ⇒ Object
Returns the value of attribute benefit_amount_rounding.
-
#children_education_config ⇒ Object
Returns the value of attribute children_education_config.
-
#client_id ⇒ Object
Returns the value of attribute client_id.
-
#education_inflation_rate ⇒ Object
Returns the value of attribute education_inflation_rate.
-
#end_of_life_expenses ⇒ Object
Returns the value of attribute end_of_life_expenses.
-
#existing_life_insurance ⇒ Object
Returns the value of attribute existing_life_insurance.
-
#general_inflation_rate ⇒ Object
Returns the value of attribute general_inflation_rate.
-
#income_config ⇒ Object
Returns the value of attribute income_config.
-
#interest_rate ⇒ Object
Returns the value of attribute interest_rate.
-
#liquid_assets ⇒ Object
Returns the value of attribute liquid_assets.
-
#margin_of_error ⇒ Object
Returns the value of attribute margin_of_error.
-
#mortgage_balance ⇒ Object
Returns the value of attribute mortgage_balance.
-
#other_debt ⇒ Object
Returns the value of attribute other_debt.
-
#tax_rate ⇒ Object
Returns the value of attribute tax_rate.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.swagger_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_deserialize(type, value) ⇒ Object
Deserialized data.
-
#_to_hash(value) ⇒ Hash
For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ LifeInsuranceNeedsCalculatorRequest
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
String presentation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ LifeInsuranceNeedsCalculatorRequest
Initializes the object
91 92 93 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 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 |
# File 'lib/proton_api/models/life_insurance_needs_calculator_request.rb', line 91 def initialize(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } if attributes.has_key?(:'client_id') self.client_id = attributes[:'client_id'] end if attributes.has_key?(:'beneficiary_bequest_config') if (value = attributes[:'beneficiary_bequest_config']).is_a?(Array) self.beneficiary_bequest_config = value end end if attributes.has_key?(:'education_inflation_rate') self.education_inflation_rate = attributes[:'education_inflation_rate'] else self.education_inflation_rate = 0.0 end if attributes.has_key?(:'margin_of_error') self.margin_of_error = attributes[:'margin_of_error'] else self.margin_of_error = 0.0 end if attributes.has_key?(:'liquid_assets') self.liquid_assets = attributes[:'liquid_assets'] end if attributes.has_key?(:'tax_rate') self.tax_rate = attributes[:'tax_rate'] else self.tax_rate = 0.0 end if attributes.has_key?(:'other_debt') self.other_debt = attributes[:'other_debt'] end if attributes.has_key?(:'end_of_life_expenses') self.end_of_life_expenses = attributes[:'end_of_life_expenses'] end if attributes.has_key?(:'existing_life_insurance') self.existing_life_insurance = attributes[:'existing_life_insurance'] end if attributes.has_key?(:'income_config') if (value = attributes[:'income_config']).is_a?(Array) self.income_config = value end end if attributes.has_key?(:'mortgage_balance') self.mortgage_balance = attributes[:'mortgage_balance'] end if attributes.has_key?(:'benefit_amount_rounding') self.benefit_amount_rounding = attributes[:'benefit_amount_rounding'] else self.benefit_amount_rounding = 0 end if attributes.has_key?(:'interest_rate') self.interest_rate = attributes[:'interest_rate'] end if attributes.has_key?(:'children_education_config') if (value = attributes[:'children_education_config']).is_a?(Array) self.children_education_config = value end end if attributes.has_key?(:'general_inflation_rate') self.general_inflation_rate = attributes[:'general_inflation_rate'] else self.general_inflation_rate = 0.0 end end |
Instance Attribute Details
#beneficiary_bequest_config ⇒ Object
Returns the value of attribute beneficiary_bequest_config.
19 20 21 |
# File 'lib/proton_api/models/life_insurance_needs_calculator_request.rb', line 19 def beneficiary_bequest_config @beneficiary_bequest_config end |
#benefit_amount_rounding ⇒ Object
Returns the value of attribute benefit_amount_rounding.
39 40 41 |
# File 'lib/proton_api/models/life_insurance_needs_calculator_request.rb', line 39 def benefit_amount_rounding @benefit_amount_rounding end |
#children_education_config ⇒ Object
Returns the value of attribute children_education_config.
43 44 45 |
# File 'lib/proton_api/models/life_insurance_needs_calculator_request.rb', line 43 def children_education_config @children_education_config end |
#client_id ⇒ Object
Returns the value of attribute client_id.
17 18 19 |
# File 'lib/proton_api/models/life_insurance_needs_calculator_request.rb', line 17 def client_id @client_id end |
#education_inflation_rate ⇒ Object
Returns the value of attribute education_inflation_rate.
21 22 23 |
# File 'lib/proton_api/models/life_insurance_needs_calculator_request.rb', line 21 def education_inflation_rate @education_inflation_rate end |
#end_of_life_expenses ⇒ Object
Returns the value of attribute end_of_life_expenses.
31 32 33 |
# File 'lib/proton_api/models/life_insurance_needs_calculator_request.rb', line 31 def end_of_life_expenses @end_of_life_expenses end |
#existing_life_insurance ⇒ Object
Returns the value of attribute existing_life_insurance.
33 34 35 |
# File 'lib/proton_api/models/life_insurance_needs_calculator_request.rb', line 33 def existing_life_insurance @existing_life_insurance end |
#general_inflation_rate ⇒ Object
Returns the value of attribute general_inflation_rate.
45 46 47 |
# File 'lib/proton_api/models/life_insurance_needs_calculator_request.rb', line 45 def general_inflation_rate @general_inflation_rate end |
#income_config ⇒ Object
Returns the value of attribute income_config.
35 36 37 |
# File 'lib/proton_api/models/life_insurance_needs_calculator_request.rb', line 35 def income_config @income_config end |
#interest_rate ⇒ Object
Returns the value of attribute interest_rate.
41 42 43 |
# File 'lib/proton_api/models/life_insurance_needs_calculator_request.rb', line 41 def interest_rate @interest_rate end |
#liquid_assets ⇒ Object
Returns the value of attribute liquid_assets.
25 26 27 |
# File 'lib/proton_api/models/life_insurance_needs_calculator_request.rb', line 25 def liquid_assets @liquid_assets end |
#margin_of_error ⇒ Object
Returns the value of attribute margin_of_error.
23 24 25 |
# File 'lib/proton_api/models/life_insurance_needs_calculator_request.rb', line 23 def margin_of_error @margin_of_error end |
#mortgage_balance ⇒ Object
Returns the value of attribute mortgage_balance.
37 38 39 |
# File 'lib/proton_api/models/life_insurance_needs_calculator_request.rb', line 37 def mortgage_balance @mortgage_balance end |
#other_debt ⇒ Object
Returns the value of attribute other_debt.
29 30 31 |
# File 'lib/proton_api/models/life_insurance_needs_calculator_request.rb', line 29 def other_debt @other_debt end |
#tax_rate ⇒ Object
Returns the value of attribute tax_rate.
27 28 29 |
# File 'lib/proton_api/models/life_insurance_needs_calculator_request.rb', line 27 def tax_rate @tax_rate end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/proton_api/models/life_insurance_needs_calculator_request.rb', line 48 def self.attribute_map { :'client_id' => :'client_id', :'beneficiary_bequest_config' => :'beneficiary_bequest_config', :'education_inflation_rate' => :'education_inflation_rate', :'margin_of_error' => :'margin_of_error', :'liquid_assets' => :'liquid_assets', :'tax_rate' => :'tax_rate', :'other_debt' => :'other_debt', :'end_of_life_expenses' => :'end_of_life_expenses', :'existing_life_insurance' => :'existing_life_insurance', :'income_config' => :'income_config', :'mortgage_balance' => :'mortgage_balance', :'benefit_amount_rounding' => :'benefit_amount_rounding', :'interest_rate' => :'interest_rate', :'children_education_config' => :'children_education_config', :'general_inflation_rate' => :'general_inflation_rate' } end |
.swagger_types ⇒ Object
Attribute type mapping.
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/proton_api/models/life_insurance_needs_calculator_request.rb', line 69 def self.swagger_types { :'client_id' => :'String', :'beneficiary_bequest_config' => :'Array<BeneficiaryBequestConfig>', :'education_inflation_rate' => :'Float', :'margin_of_error' => :'Float', :'liquid_assets' => :'Float', :'tax_rate' => :'Float', :'other_debt' => :'Float', :'end_of_life_expenses' => :'Float', :'existing_life_insurance' => :'Float', :'income_config' => :'Array<IncomeConfig>', :'mortgage_balance' => :'Float', :'benefit_amount_rounding' => :'Integer', :'interest_rate' => :'Float', :'children_education_config' => :'Array<ChildrenEducationConfig>', :'general_inflation_rate' => :'Float' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 |
# File 'lib/proton_api/models/life_insurance_needs_calculator_request.rb', line 381 def ==(o) return true if self.equal?(o) self.class == o.class && client_id == o.client_id && beneficiary_bequest_config == o.beneficiary_bequest_config && education_inflation_rate == o.education_inflation_rate && margin_of_error == o.margin_of_error && liquid_assets == o.liquid_assets && tax_rate == o.tax_rate && other_debt == o.other_debt && end_of_life_expenses == o.end_of_life_expenses && existing_life_insurance == o.existing_life_insurance && income_config == o.income_config && mortgage_balance == o.mortgage_balance && benefit_amount_rounding == o.benefit_amount_rounding && interest_rate == o.interest_rate && children_education_config == o.children_education_config && general_inflation_rate == o.general_inflation_rate end |
#_deserialize(type, value) ⇒ Object
Returns Deserialized data.
436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 |
# File 'lib/proton_api/models/life_insurance_needs_calculator_request.rb', line 436 def _deserialize(type, value) case type.to_sym when :DateTime value when :Date value when :String value.to_s when :Integer value.to_i when :Float value.to_f when :BOOLEAN if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model temp_model = ProtonApi.const_get(type).new temp_model.build_from_hash(value) end end |
#_to_hash(value) ⇒ Hash
For object, use to_hash. Otherwise, just return the value
500 501 502 503 504 505 506 507 508 509 510 511 512 |
# File 'lib/proton_api/models/life_insurance_needs_calculator_request.rb', line 500 def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 |
# File 'lib/proton_api/models/life_insurance_needs_calculator_request.rb', line 416 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end # or else data not found in attributes(hash), not an issue as the data can be optional end self end |
#eql?(o) ⇒ Boolean
403 404 405 |
# File 'lib/proton_api/models/life_insurance_needs_calculator_request.rb', line 403 def eql?(o) self == o end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
409 410 411 |
# File 'lib/proton_api/models/life_insurance_needs_calculator_request.rb', line 409 def hash [client_id, beneficiary_bequest_config, education_inflation_rate, margin_of_error, liquid_assets, tax_rate, other_debt, end_of_life_expenses, existing_life_insurance, income_config, mortgage_balance, benefit_amount_rounding, interest_rate, children_education_config, general_inflation_rate].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 |
# File 'lib/proton_api/models/life_insurance_needs_calculator_request.rb', line 176 def list_invalid_properties invalid_properties = Array.new if !@education_inflation_rate.nil? && @education_inflation_rate < -1 invalid_properties.push('invalid value for "education_inflation_rate", must be greater than or equal to -1.') end if !@margin_of_error.nil? && @margin_of_error < 0 invalid_properties.push('invalid value for "margin_of_error", must be greater than or equal to 0.') end if !@liquid_assets.nil? && @liquid_assets < 0 invalid_properties.push('invalid value for "liquid_assets", must be greater than or equal to 0.') end if !@tax_rate.nil? && @tax_rate > 1 invalid_properties.push('invalid value for "tax_rate", must be smaller than or equal to 1.') end if !@tax_rate.nil? && @tax_rate < 0 invalid_properties.push('invalid value for "tax_rate", must be greater than or equal to 0.') end if !@other_debt.nil? && @other_debt < 0 invalid_properties.push('invalid value for "other_debt", must be greater than or equal to 0.') end if !@end_of_life_expenses.nil? && @end_of_life_expenses < 0 invalid_properties.push('invalid value for "end_of_life_expenses", must be greater than or equal to 0.') end if !@existing_life_insurance.nil? && @existing_life_insurance < 0 invalid_properties.push('invalid value for "existing_life_insurance", must be greater than or equal to 0.') end if !@mortgage_balance.nil? && @mortgage_balance < 0 invalid_properties.push('invalid value for "mortgage_balance", must be greater than or equal to 0.') end if !@benefit_amount_rounding.nil? && @benefit_amount_rounding > 12 invalid_properties.push('invalid value for "benefit_amount_rounding", must be smaller than or equal to 12.') end if !@benefit_amount_rounding.nil? && @benefit_amount_rounding < 0 invalid_properties.push('invalid value for "benefit_amount_rounding", must be greater than or equal to 0.') end if @interest_rate.nil? invalid_properties.push('invalid value for "interest_rate", interest_rate cannot be nil.') end if @interest_rate < -1 invalid_properties.push('invalid value for "interest_rate", must be greater than or equal to -1.') end if !@general_inflation_rate.nil? && @general_inflation_rate < -1 invalid_properties.push('invalid value for "general_inflation_rate", must be greater than or equal to -1.') end invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
481 482 483 |
# File 'lib/proton_api/models/life_insurance_needs_calculator_request.rb', line 481 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
487 488 489 490 491 492 493 494 495 |
# File 'lib/proton_api/models/life_insurance_needs_calculator_request.rb', line 487 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) next if value.nil? hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns String presentation of the object.
475 476 477 |
# File 'lib/proton_api/models/life_insurance_needs_calculator_request.rb', line 475 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 |
# File 'lib/proton_api/models/life_insurance_needs_calculator_request.rb', line 239 def valid? return false if !@education_inflation_rate.nil? && @education_inflation_rate < -1 return false if !@margin_of_error.nil? && @margin_of_error < 0 return false if !@liquid_assets.nil? && @liquid_assets < 0 return false if !@tax_rate.nil? && @tax_rate > 1 return false if !@tax_rate.nil? && @tax_rate < 0 return false if !@other_debt.nil? && @other_debt < 0 return false if !@end_of_life_expenses.nil? && @end_of_life_expenses < 0 return false if !@existing_life_insurance.nil? && @existing_life_insurance < 0 return false if !@mortgage_balance.nil? && @mortgage_balance < 0 return false if !@benefit_amount_rounding.nil? && @benefit_amount_rounding > 12 return false if !@benefit_amount_rounding.nil? && @benefit_amount_rounding < 0 return false if @interest_rate.nil? return false if @interest_rate < -1 return false if !@general_inflation_rate.nil? && @general_inflation_rate < -1 true end |