Class: ProtonApi::FinancialHealthCheckRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/proton_api/models/financial_health_check_request.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ FinancialHealthCheckRequest

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/proton_api/models/financial_health_check_request.rb', line 71

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?(:'ratio_targets')
    self.ratio_targets = attributes[:'ratio_targets']
  end

  if attributes.has_key?(:'liquid_assets')
    self.liquid_assets = attributes[:'liquid_assets']
  end

  if attributes.has_key?(:'total_liabilities')
    self.total_liabilities = attributes[:'total_liabilities']
  end

  if attributes.has_key?(:'gross_annual_income')
    self.gross_annual_income = attributes[:'gross_annual_income']
  end

  if attributes.has_key?(:'short_term_liabilities')
    self.short_term_liabilities = attributes[:'short_term_liabilities']
  end

  if attributes.has_key?(:'lookback_periods')
    self.lookback_periods = attributes[:'lookback_periods']
  else
    self.lookback_periods = 3
  end

  if attributes.has_key?(:'non_liquid_assets')
    self.non_liquid_assets = attributes[:'non_liquid_assets']
  end

  if attributes.has_key?(:'monthly_expenses')
    self.monthly_expenses = attributes[:'monthly_expenses']
  end

  if attributes.has_key?(:'net_monthly_income')
    self.net_monthly_income = attributes[:'net_monthly_income']
  end
end

Instance Attribute Details

#client_idObject

Returns the value of attribute client_id.



17
18
19
# File 'lib/proton_api/models/financial_health_check_request.rb', line 17

def client_id
  @client_id
end

#gross_annual_incomeObject

Returns the value of attribute gross_annual_income.



25
26
27
# File 'lib/proton_api/models/financial_health_check_request.rb', line 25

def gross_annual_income
  @gross_annual_income
end

#liquid_assetsObject

Returns the value of attribute liquid_assets.



21
22
23
# File 'lib/proton_api/models/financial_health_check_request.rb', line 21

def liquid_assets
  @liquid_assets
end

#lookback_periodsObject

Returns the value of attribute lookback_periods.



29
30
31
# File 'lib/proton_api/models/financial_health_check_request.rb', line 29

def lookback_periods
  @lookback_periods
end

#monthly_expensesObject

Returns the value of attribute monthly_expenses.



33
34
35
# File 'lib/proton_api/models/financial_health_check_request.rb', line 33

def monthly_expenses
  @monthly_expenses
end

#net_monthly_incomeObject

Returns the value of attribute net_monthly_income.



35
36
37
# File 'lib/proton_api/models/financial_health_check_request.rb', line 35

def net_monthly_income
  @net_monthly_income
end

#non_liquid_assetsObject

Returns the value of attribute non_liquid_assets.



31
32
33
# File 'lib/proton_api/models/financial_health_check_request.rb', line 31

def non_liquid_assets
  @non_liquid_assets
end

#ratio_targetsObject

Returns the value of attribute ratio_targets.



19
20
21
# File 'lib/proton_api/models/financial_health_check_request.rb', line 19

def ratio_targets
  @ratio_targets
end

#short_term_liabilitiesObject

Returns the value of attribute short_term_liabilities.



27
28
29
# File 'lib/proton_api/models/financial_health_check_request.rb', line 27

def short_term_liabilities
  @short_term_liabilities
end

#total_liabilitiesObject

Returns the value of attribute total_liabilities.



23
24
25
# File 'lib/proton_api/models/financial_health_check_request.rb', line 23

def total_liabilities
  @total_liabilities
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/proton_api/models/financial_health_check_request.rb', line 38

def self.attribute_map
  {
    :'client_id' => :'client_id',
    :'ratio_targets' => :'ratio_targets',
    :'liquid_assets' => :'liquid_assets',
    :'total_liabilities' => :'total_liabilities',
    :'gross_annual_income' => :'gross_annual_income',
    :'short_term_liabilities' => :'short_term_liabilities',
    :'lookback_periods' => :'lookback_periods',
    :'non_liquid_assets' => :'non_liquid_assets',
    :'monthly_expenses' => :'monthly_expenses',
    :'net_monthly_income' => :'net_monthly_income'
  }
end

.swagger_typesObject

Attribute type mapping.



54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/proton_api/models/financial_health_check_request.rb', line 54

def self.swagger_types
  {
    :'client_id' => :'String',
    :'ratio_targets' => :'RatioTargets',
    :'liquid_assets' => :'Float',
    :'total_liabilities' => :'Float',
    :'gross_annual_income' => :'Float',
    :'short_term_liabilities' => :'Float',
    :'lookback_periods' => :'Integer',
    :'non_liquid_assets' => :'Float',
    :'monthly_expenses' => :'Float',
    :'net_monthly_income' => :'Float'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



255
256
257
258
259
260
261
262
263
264
265
266
267
268
# File 'lib/proton_api/models/financial_health_check_request.rb', line 255

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      client_id == o.client_id &&
      ratio_targets == o.ratio_targets &&
      liquid_assets == o.liquid_assets &&
      total_liabilities == o.total_liabilities &&
      gross_annual_income == o.gross_annual_income &&
      short_term_liabilities == o.short_term_liabilities &&
      lookback_periods == o.lookback_periods &&
      non_liquid_assets == o.non_liquid_assets &&
      monthly_expenses == o.monthly_expenses &&
      net_monthly_income == o.net_monthly_income
end

#_deserialize(type, value) ⇒ Object

Returns Deserialized data.

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
# File 'lib/proton_api/models/financial_health_check_request.rb', line 305

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

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



369
370
371
372
373
374
375
376
377
378
379
380
381
# File 'lib/proton_api/models/financial_health_check_request.rb', line 369

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

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
# File 'lib/proton_api/models/financial_health_check_request.rb', line 285

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

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


272
273
274
# File 'lib/proton_api/models/financial_health_check_request.rb', line 272

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



278
279
280
# File 'lib/proton_api/models/financial_health_check_request.rb', line 278

def hash
  [client_id, ratio_targets, liquid_assets, total_liabilities, gross_annual_income, short_term_liabilities, lookback_periods, non_liquid_assets, monthly_expenses, net_monthly_income].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



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
# File 'lib/proton_api/models/financial_health_check_request.rb', line 122

def list_invalid_properties
  invalid_properties = Array.new
  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 !@total_liabilities.nil? && @total_liabilities < 0
    invalid_properties.push('invalid value for "total_liabilities", must be greater than or equal to 0.')
  end

  if !@gross_annual_income.nil? && @gross_annual_income < 0
    invalid_properties.push('invalid value for "gross_annual_income", must be greater than or equal to 0.')
  end

  if !@short_term_liabilities.nil? && @short_term_liabilities < 0
    invalid_properties.push('invalid value for "short_term_liabilities", must be greater than or equal to 0.')
  end

  if !@lookback_periods.nil? && @lookback_periods < 1
    invalid_properties.push('invalid value for "lookback_periods", must be greater than or equal to 1.')
  end

  if !@non_liquid_assets.nil? && @non_liquid_assets < 0
    invalid_properties.push('invalid value for "non_liquid_assets", must be greater than or equal to 0.')
  end

  if !@monthly_expenses.nil? && @monthly_expenses < 0
    invalid_properties.push('invalid value for "monthly_expenses", must be greater than or equal to 0.')
  end

  if !@net_monthly_income.nil? && @net_monthly_income < 0
    invalid_properties.push('invalid value for "net_monthly_income", must be greater than or equal to 0.')
  end

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



350
351
352
# File 'lib/proton_api/models/financial_health_check_request.rb', line 350

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



356
357
358
359
360
361
362
363
364
# File 'lib/proton_api/models/financial_health_check_request.rb', line 356

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_sString

Returns String presentation of the object.

Returns:

  • (String)

    String presentation of the object



344
345
346
# File 'lib/proton_api/models/financial_health_check_request.rb', line 344

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



161
162
163
164
165
166
167
168
169
170
171
# File 'lib/proton_api/models/financial_health_check_request.rb', line 161

def valid?
  return false if !@liquid_assets.nil? && @liquid_assets < 0
  return false if !@total_liabilities.nil? && @total_liabilities < 0
  return false if !@gross_annual_income.nil? && @gross_annual_income < 0
  return false if !@short_term_liabilities.nil? && @short_term_liabilities < 0
  return false if !@lookback_periods.nil? && @lookback_periods < 1
  return false if !@non_liquid_assets.nil? && @non_liquid_assets < 0
  return false if !@monthly_expenses.nil? && @monthly_expenses < 0
  return false if !@net_monthly_income.nil? && @net_monthly_income < 0
  true
end