hydrogen-proton-api 1.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (217) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/README.md +82 -0
  4. data/Rakefile +8 -0
  5. data/git_push.sh +55 -0
  6. data/lib/proton_api.rb +141 -0
  7. data/lib/proton_api/api/annuities_api.rb +347 -0
  8. data/lib/proton_api/api/business_financial_management_api.rb +293 -0
  9. data/lib/proton_api/api/cards_api.rb +185 -0
  10. data/lib/proton_api/api/financial_health_api.rb +239 -0
  11. data/lib/proton_api/api/financial_planning_api.rb +671 -0
  12. data/lib/proton_api/api/goals_api.rb +347 -0
  13. data/lib/proton_api/api/life_insurance_api.rb +77 -0
  14. data/lib/proton_api/api/personal_financial_management_api.rb +347 -0
  15. data/lib/proton_api/api/portfolio_construction_api.rb +77 -0
  16. data/lib/proton_api/api/portfolio_management_api.rb +77 -0
  17. data/lib/proton_api/api/risk_scoring_api.rb +185 -0
  18. data/lib/proton_api/api/simulations_api.rb +401 -0
  19. data/lib/proton_api/api/util_api.rb +185 -0
  20. data/lib/proton_api/api_client.rb +391 -0
  21. data/lib/proton_api/api_error.rb +38 -0
  22. data/lib/proton_api/auth_configuration.rb +181 -0
  23. data/lib/proton_api/configuration.rb +209 -0
  24. data/lib/proton_api/environment.rb +36 -0
  25. data/lib/proton_api/models/accumulation_goal_deposit_config.rb +338 -0
  26. data/lib/proton_api/models/annuity_calculator_accumulation_horizon_request.rb +459 -0
  27. data/lib/proton_api/models/annuity_calculator_annuity_amount_request.rb +461 -0
  28. data/lib/proton_api/models/annuity_calculator_decumulation_horizon_request.rb +459 -0
  29. data/lib/proton_api/models/annuity_calculator_deposit_amount_request.rb +468 -0
  30. data/lib/proton_api/models/annuity_calculator_initial_balance_request.rb +468 -0
  31. data/lib/proton_api/models/annuity_deposit_schedule.rb +254 -0
  32. data/lib/proton_api/models/answer.rb +186 -0
  33. data/lib/proton_api/models/backtest_request.rb +295 -0
  34. data/lib/proton_api/models/beneficiary_bequest_config.rb +257 -0
  35. data/lib/proton_api/models/budget_aggregation_account.rb +186 -0
  36. data/lib/proton_api/models/budget_calculator_request.rb +334 -0
  37. data/lib/proton_api/models/budget_component.rb +228 -0
  38. data/lib/proton_api/models/budget_details.rb +337 -0
  39. data/lib/proton_api/models/business_financial_health_check_request.rb +484 -0
  40. data/lib/proton_api/models/business_invoice_analysis_request.rb +361 -0
  41. data/lib/proton_api/models/calculator_deposit_schedule.rb +228 -0
  42. data/lib/proton_api/models/calculator_deposit_schedule1.rb +254 -0
  43. data/lib/proton_api/models/card_analysis_request.rb +372 -0
  44. data/lib/proton_api/models/card_limit_check_request.rb +231 -0
  45. data/lib/proton_api/models/card_transaction_authorization_request.rb +422 -0
  46. data/lib/proton_api/models/cash_analysis_request.rb +340 -0
  47. data/lib/proton_api/models/cash_flow_analysis_request.rb +366 -0
  48. data/lib/proton_api/models/children_education_config.rb +221 -0
  49. data/lib/proton_api/models/customer_analysis_request.rb +292 -0
  50. data/lib/proton_api/models/decision_tree_result_request.rb +236 -0
  51. data/lib/proton_api/models/decumulation_goal_deposit_config.rb +335 -0
  52. data/lib/proton_api/models/dimensional_risk_score_request.rb +282 -0
  53. data/lib/proton_api/models/diversification_score_request.rb +324 -0
  54. data/lib/proton_api/models/education_calculator_annual_cost_request.rb +450 -0
  55. data/lib/proton_api/models/education_calculator_deposit_amount_request.rb +483 -0
  56. data/lib/proton_api/models/education_calculator_percent_covered_request.rb +448 -0
  57. data/lib/proton_api/models/education_config.rb +271 -0
  58. data/lib/proton_api/models/emergency_fund_calculator_request.rb +561 -0
  59. data/lib/proton_api/models/event_study_request.rb +317 -0
  60. data/lib/proton_api/models/fee_analysis_request.rb +239 -0
  61. data/lib/proton_api/models/financial_health_check_request.rb +384 -0
  62. data/lib/proton_api/models/financial_picture_request.rb +270 -0
  63. data/lib/proton_api/models/financial_statement_analysis_request.rb +461 -0
  64. data/lib/proton_api/models/goal_accumulation_allocation_request.rb +729 -0
  65. data/lib/proton_api/models/goal_accumulation_recommendation_request.rb +622 -0
  66. data/lib/proton_api/models/goal_accumulation_status_request.rb +622 -0
  67. data/lib/proton_api/models/goal_config.rb +222 -0
  68. data/lib/proton_api/models/goal_decumulation_allocation_request.rb +764 -0
  69. data/lib/proton_api/models/goal_decumulation_recommendation_request.rb +657 -0
  70. data/lib/proton_api/models/goal_decumulation_status_request.rb +657 -0
  71. data/lib/proton_api/models/goal_withdrawal_config.rb +335 -0
  72. data/lib/proton_api/models/guaranteed_rate_benefit.rb +272 -0
  73. data/lib/proton_api/models/income_config.rb +266 -0
  74. data/lib/proton_api/models/life_insurance_needs_calculator_request.rb +515 -0
  75. data/lib/proton_api/models/location.rb +183 -0
  76. data/lib/proton_api/models/monte_carlo_request.rb +504 -0
  77. data/lib/proton_api/models/mortgage_calculator_down_payment_request.rb +299 -0
  78. data/lib/proton_api/models/mortgage_calculator_home_price_request.rb +299 -0
  79. data/lib/proton_api/models/mortgage_calculator_periodic_payment_request.rb +299 -0
  80. data/lib/proton_api/models/mvo_request.rb +366 -0
  81. data/lib/proton_api/models/opt_config.rb +300 -0
  82. data/lib/proton_api/models/opt_config1.rb +260 -0
  83. data/lib/proton_api/models/order_rebalance_request.rb +398 -0
  84. data/lib/proton_api/models/performance_calculator_request.rb +687 -0
  85. data/lib/proton_api/models/periods.rb +220 -0
  86. data/lib/proton_api/models/portfolio_optimization_score_request.rb +356 -0
  87. data/lib/proton_api/models/portfolio_what_if_request.rb +351 -0
  88. data/lib/proton_api/models/purchase_calculator_amount_request.rb +401 -0
  89. data/lib/proton_api/models/purchase_calculator_deposit_amount_request.rb +434 -0
  90. data/lib/proton_api/models/purchase_calculator_horizon_request.rb +356 -0
  91. data/lib/proton_api/models/ratio_targets.rb +328 -0
  92. data/lib/proton_api/models/ratio_targets1.rb +328 -0
  93. data/lib/proton_api/models/rebalancing_signal_request.rb +238 -0
  94. data/lib/proton_api/models/recommendation_config.rb +357 -0
  95. data/lib/proton_api/models/recommendation_config1.rb +346 -0
  96. data/lib/proton_api/models/recurring_transaction_analysis_request.rb +400 -0
  97. data/lib/proton_api/models/retirement_calculator_deposit_amount_request.rb +509 -0
  98. data/lib/proton_api/models/retirement_calculator_expenses_request.rb +476 -0
  99. data/lib/proton_api/models/retirement_calculator_percent_covered_request.rb +474 -0
  100. data/lib/proton_api/models/risk_allocation_request.rb +316 -0
  101. data/lib/proton_api/models/risk_score_request.rb +239 -0
  102. data/lib/proton_api/models/savings_calculator_request.rb +395 -0
  103. data/lib/proton_api/models/savings_deposit_schedule.rb +276 -0
  104. data/lib/proton_api/models/scenario_analysis_request.rb +401 -0
  105. data/lib/proton_api/models/sensitivity_analysis_request.rb +399 -0
  106. data/lib/proton_api/models/sensitivity_factor.rb +278 -0
  107. data/lib/proton_api/models/settings.rb +287 -0
  108. data/lib/proton_api/models/spending_analysis_request.rb +505 -0
  109. data/lib/proton_api/models/variable_annuity_request.rb +700 -0
  110. data/lib/proton_api/models/w_config.rb +382 -0
  111. data/lib/proton_api/models/w_config1.rb +347 -0
  112. data/lib/proton_api/version.rb +15 -0
  113. data/proton_api.gemspec +46 -0
  114. data/spec/api/annuities_api_spec.rb +107 -0
  115. data/spec/api/business_financial_management_api_spec.rb +95 -0
  116. data/spec/api/cards_api_spec.rb +71 -0
  117. data/spec/api/financial_health_api_spec.rb +83 -0
  118. data/spec/api/financial_planning_api_spec.rb +179 -0
  119. data/spec/api/goals_api_spec.rb +107 -0
  120. data/spec/api/life_insurance_api_spec.rb +47 -0
  121. data/spec/api/personal_financial_management_api_spec.rb +107 -0
  122. data/spec/api/portfolio_construction_api_spec.rb +47 -0
  123. data/spec/api/portfolio_management_api_spec.rb +47 -0
  124. data/spec/api/risk_scoring_api_spec.rb +71 -0
  125. data/spec/api/simulations_api_spec.rb +119 -0
  126. data/spec/api/util_api_spec.rb +71 -0
  127. data/spec/api_client_spec.rb +243 -0
  128. data/spec/configuration_spec.rb +42 -0
  129. data/spec/models/accumulation_goal_deposit_config_spec.rb +89 -0
  130. data/spec/models/annuity_calculator_accumulation_horizon_request_spec.rb +111 -0
  131. data/spec/models/annuity_calculator_annuity_amount_request_spec.rb +111 -0
  132. data/spec/models/annuity_calculator_decumulation_horizon_request_spec.rb +111 -0
  133. data/spec/models/annuity_calculator_deposit_amount_request_spec.rb +111 -0
  134. data/spec/models/annuity_calculator_initial_balance_request_spec.rb +111 -0
  135. data/spec/models/annuity_deposit_schedule_spec.rb +57 -0
  136. data/spec/models/answer_spec.rb +41 -0
  137. data/spec/models/backtest_request_spec.rb +95 -0
  138. data/spec/models/beneficiary_bequest_config_spec.rb +53 -0
  139. data/spec/models/budget_aggregation_account_spec.rb +41 -0
  140. data/spec/models/budget_calculator_request_spec.rb +105 -0
  141. data/spec/models/budget_component_spec.rb +53 -0
  142. data/spec/models/budget_details_spec.rb +99 -0
  143. data/spec/models/business_financial_health_check_request_spec.rb +143 -0
  144. data/spec/models/business_invoice_analysis_request_spec.rb +123 -0
  145. data/spec/models/calculator_deposit_schedule1_spec.rb +57 -0
  146. data/spec/models/calculator_deposit_schedule_spec.rb +51 -0
  147. data/spec/models/card_analysis_request_spec.rb +129 -0
  148. data/spec/models/card_limit_check_request_spec.rb +65 -0
  149. data/spec/models/card_transaction_authorization_request_spec.rb +157 -0
  150. data/spec/models/cash_analysis_request_spec.rb +115 -0
  151. data/spec/models/cash_flow_analysis_request_spec.rb +135 -0
  152. data/spec/models/children_education_config_spec.rb +47 -0
  153. data/spec/models/customer_analysis_request_spec.rb +101 -0
  154. data/spec/models/decision_tree_result_request_spec.rb +51 -0
  155. data/spec/models/decumulation_goal_deposit_config_spec.rb +89 -0
  156. data/spec/models/dimensional_risk_score_request_spec.rb +89 -0
  157. data/spec/models/diversification_score_request_spec.rb +111 -0
  158. data/spec/models/education_calculator_annual_cost_request_spec.rb +101 -0
  159. data/spec/models/education_calculator_deposit_amount_request_spec.rb +107 -0
  160. data/spec/models/education_calculator_percent_covered_request_spec.rb +101 -0
  161. data/spec/models/education_config_spec.rb +53 -0
  162. data/spec/models/emergency_fund_calculator_request_spec.rb +141 -0
  163. data/spec/models/event_study_request_spec.rb +109 -0
  164. data/spec/models/fee_analysis_request_spec.rb +77 -0
  165. data/spec/models/financial_health_check_request_spec.rb +95 -0
  166. data/spec/models/financial_picture_request_spec.rb +95 -0
  167. data/spec/models/financial_statement_analysis_request_spec.rb +155 -0
  168. data/spec/models/goal_accumulation_allocation_request_spec.rb +215 -0
  169. data/spec/models/goal_accumulation_recommendation_request_spec.rb +173 -0
  170. data/spec/models/goal_accumulation_status_request_spec.rb +173 -0
  171. data/spec/models/goal_config_spec.rb +47 -0
  172. data/spec/models/goal_decumulation_allocation_request_spec.rb +221 -0
  173. data/spec/models/goal_decumulation_recommendation_request_spec.rb +179 -0
  174. data/spec/models/goal_decumulation_status_request_spec.rb +179 -0
  175. data/spec/models/goal_withdrawal_config_spec.rb +89 -0
  176. data/spec/models/guaranteed_rate_benefit_spec.rb +59 -0
  177. data/spec/models/income_config_spec.rb +53 -0
  178. data/spec/models/life_insurance_needs_calculator_request_spec.rb +125 -0
  179. data/spec/models/location_spec.rb +41 -0
  180. data/spec/models/monte_carlo_request_spec.rb +179 -0
  181. data/spec/models/mortgage_calculator_down_payment_request_spec.rb +59 -0
  182. data/spec/models/mortgage_calculator_home_price_request_spec.rb +59 -0
  183. data/spec/models/mortgage_calculator_periodic_payment_request_spec.rb +59 -0
  184. data/spec/models/mvo_request_spec.rb +113 -0
  185. data/spec/models/opt_config1_spec.rb +69 -0
  186. data/spec/models/opt_config_spec.rb +81 -0
  187. data/spec/models/order_rebalance_request_spec.rb +123 -0
  188. data/spec/models/performance_calculator_request_spec.rb +233 -0
  189. data/spec/models/periods_spec.rb +47 -0
  190. data/spec/models/portfolio_optimization_score_request_spec.rb +127 -0
  191. data/spec/models/portfolio_what_if_request_spec.rb +123 -0
  192. data/spec/models/purchase_calculator_amount_request_spec.rb +93 -0
  193. data/spec/models/purchase_calculator_deposit_amount_request_spec.rb +99 -0
  194. data/spec/models/purchase_calculator_horizon_request_spec.rb +83 -0
  195. data/spec/models/ratio_targets1_spec.rb +71 -0
  196. data/spec/models/ratio_targets_spec.rb +71 -0
  197. data/spec/models/rebalancing_signal_request_spec.rb +71 -0
  198. data/spec/models/recommendation_config1_spec.rb +77 -0
  199. data/spec/models/recommendation_config_spec.rb +83 -0
  200. data/spec/models/recurring_transaction_analysis_request_spec.rb +129 -0
  201. data/spec/models/retirement_calculator_deposit_amount_request_spec.rb +113 -0
  202. data/spec/models/retirement_calculator_expenses_request_spec.rb +107 -0
  203. data/spec/models/retirement_calculator_percent_covered_request_spec.rb +107 -0
  204. data/spec/models/risk_allocation_request_spec.rb +85 -0
  205. data/spec/models/risk_score_request_spec.rb +71 -0
  206. data/spec/models/savings_calculator_request_spec.rb +99 -0
  207. data/spec/models/savings_deposit_schedule_spec.rb +63 -0
  208. data/spec/models/scenario_analysis_request_spec.rb +133 -0
  209. data/spec/models/sensitivity_analysis_request_spec.rb +133 -0
  210. data/spec/models/sensitivity_factor_spec.rb +59 -0
  211. data/spec/models/settings_spec.rb +79 -0
  212. data/spec/models/spending_analysis_request_spec.rb +187 -0
  213. data/spec/models/variable_annuity_request_spec.rb +209 -0
  214. data/spec/models/w_config1_spec.rb +65 -0
  215. data/spec/models/w_config_spec.rb +65 -0
  216. data/spec/spec_helper.rb +111 -0
  217. metadata +561 -0
@@ -0,0 +1,222 @@
1
+ =begin
2
+ #Hydrogen Proton API
3
+
4
+ #Financial engineering module of Hydrogen Atom
5
+
6
+ OpenAPI spec version: 1.9.1
7
+ Contact: info@hydrogenplatform.com
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.19
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module ProtonApi
16
+ class GoalConfig
17
+ attr_accessor :goal_amount
18
+
19
+ attr_accessor :goal_inflation
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'goal_amount' => :'goal_amount',
25
+ :'goal_inflation' => :'goal_inflation'
26
+ }
27
+ end
28
+
29
+ # Attribute type mapping.
30
+ def self.swagger_types
31
+ {
32
+ :'goal_amount' => :'Float',
33
+ :'goal_inflation' => :'Float'
34
+ }
35
+ end
36
+
37
+ # Initializes the object
38
+ # @param [Hash] attributes Model attributes in the form of hash
39
+ def initialize(attributes = {})
40
+ return unless attributes.is_a?(Hash)
41
+
42
+ # convert string to symbol for hash key
43
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
44
+
45
+ if attributes.has_key?(:'goal_amount')
46
+ self.goal_amount = attributes[:'goal_amount']
47
+ end
48
+
49
+ if attributes.has_key?(:'goal_inflation')
50
+ self.goal_inflation = attributes[:'goal_inflation']
51
+ else
52
+ self.goal_inflation = 0.0
53
+ end
54
+ end
55
+
56
+ # Show invalid properties with the reasons. Usually used together with valid?
57
+ # @return Array for valid properties with the reasons
58
+ def list_invalid_properties
59
+ invalid_properties = Array.new
60
+ if !@goal_amount.nil? && @goal_amount < 0
61
+ invalid_properties.push('invalid value for "goal_amount", must be greater than or equal to 0.')
62
+ end
63
+
64
+ if !@goal_inflation.nil? && @goal_inflation < -1
65
+ invalid_properties.push('invalid value for "goal_inflation", must be greater than or equal to -1.')
66
+ end
67
+
68
+ invalid_properties
69
+ end
70
+
71
+ # Check to see if the all the properties in the model are valid
72
+ # @return true if the model is valid
73
+ def valid?
74
+ return false if !@goal_amount.nil? && @goal_amount < 0
75
+ return false if !@goal_inflation.nil? && @goal_inflation < -1
76
+ true
77
+ end
78
+
79
+ # Custom attribute writer method with validation
80
+ # @param [Object] goal_amount Value to be assigned
81
+ def goal_amount=(goal_amount)
82
+ if !goal_amount.nil? && goal_amount < 0
83
+ fail ArgumentError, 'invalid value for "goal_amount", must be greater than or equal to 0.'
84
+ end
85
+
86
+ @goal_amount = goal_amount
87
+ end
88
+
89
+ # Custom attribute writer method with validation
90
+ # @param [Object] goal_inflation Value to be assigned
91
+ def goal_inflation=(goal_inflation)
92
+ if !goal_inflation.nil? && goal_inflation < -1
93
+ fail ArgumentError, 'invalid value for "goal_inflation", must be greater than or equal to -1.'
94
+ end
95
+
96
+ @goal_inflation = goal_inflation
97
+ end
98
+
99
+ # Checks equality by comparing each attribute.
100
+ # @param [Object] Object to be compared
101
+ def ==(o)
102
+ return true if self.equal?(o)
103
+ self.class == o.class &&
104
+ goal_amount == o.goal_amount &&
105
+ goal_inflation == o.goal_inflation
106
+ end
107
+
108
+ # @see the `==` method
109
+ # @param [Object] Object to be compared
110
+ def eql?(o)
111
+ self == o
112
+ end
113
+
114
+ # Calculates hash code according to all attributes.
115
+ # @return [Fixnum] Hash code
116
+ def hash
117
+ [goal_amount, goal_inflation].hash
118
+ end
119
+
120
+ # Builds the object from hash
121
+ # @param [Hash] attributes Model attributes in the form of hash
122
+ # @return [Object] Returns the model itself
123
+ def build_from_hash(attributes)
124
+ return nil unless attributes.is_a?(Hash)
125
+ self.class.swagger_types.each_pair do |key, type|
126
+ if type =~ /\AArray<(.*)>/i
127
+ # check to ensure the input is an array given that the attribute
128
+ # is documented as an array but the input is not
129
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
130
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
131
+ end
132
+ elsif !attributes[self.class.attribute_map[key]].nil?
133
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
134
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
135
+ end
136
+
137
+ self
138
+ end
139
+ # Deserializes the data based on type
140
+ # @param string type Data type
141
+ # @param string value Value to be deserialized
142
+ # @return [Object] Deserialized data
143
+ def _deserialize(type, value)
144
+ case type.to_sym
145
+ when :DateTime
146
+ value
147
+ when :Date
148
+ value
149
+ when :String
150
+ value.to_s
151
+ when :Integer
152
+ value.to_i
153
+ when :Float
154
+ value.to_f
155
+ when :BOOLEAN
156
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
157
+ true
158
+ else
159
+ false
160
+ end
161
+ when :Object
162
+ # generic object (usually a Hash), return directly
163
+ value
164
+ when /\AArray<(?<inner_type>.+)>\z/
165
+ inner_type = Regexp.last_match[:inner_type]
166
+ value.map { |v| _deserialize(inner_type, v) }
167
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
168
+ k_type = Regexp.last_match[:k_type]
169
+ v_type = Regexp.last_match[:v_type]
170
+ {}.tap do |hash|
171
+ value.each do |k, v|
172
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
173
+ end
174
+ end
175
+ else # model
176
+ temp_model = ProtonApi.const_get(type).new
177
+ temp_model.build_from_hash(value)
178
+ end
179
+ end
180
+ # Returns the string representation of the object
181
+ # @return [String] String presentation of the object
182
+ def to_s
183
+ to_hash.to_s
184
+ end
185
+
186
+ # to_body is an alias to to_hash (backward compatibility)
187
+ # @return [Hash] Returns the object in the form of hash
188
+ def to_body
189
+ to_hash
190
+ end
191
+
192
+ # Returns the object in the form of hash
193
+ # @return [Hash] Returns the object in the form of hash
194
+ def to_hash
195
+ hash = {}
196
+ self.class.attribute_map.each_pair do |attr, param|
197
+ value = self.send(attr)
198
+ next if value.nil?
199
+ hash[param] = _to_hash(value)
200
+ end
201
+ hash
202
+ end
203
+ # Outputs non-array value in the form of hash
204
+ # For object, use to_hash. Otherwise, just return the value
205
+ # @param [Object] value Any valid value
206
+ # @return [Hash] Returns the value in the form of hash
207
+ def _to_hash(value)
208
+ if value.is_a?(Array)
209
+ value.compact.map { |v| _to_hash(v) }
210
+ elsif value.is_a?(Hash)
211
+ {}.tap do |hash|
212
+ value.each { |k, v| hash[k] = _to_hash(v) }
213
+ end
214
+ elsif value.respond_to? :to_hash
215
+ value.to_hash
216
+ else
217
+ value
218
+ end
219
+ end
220
+
221
+ end
222
+ end
@@ -0,0 +1,764 @@
1
+ =begin
2
+ #Hydrogen Proton API
3
+
4
+ #Financial engineering module of Hydrogen Atom
5
+
6
+ OpenAPI spec version: 1.9.1
7
+ Contact: info@hydrogenplatform.com
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.19
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module ProtonApi
16
+ class GoalDecumulationAllocationRequest
17
+ attr_accessor :recommendation_config
18
+
19
+ attr_accessor :compounding_rate
20
+
21
+ attr_accessor :risk_score
22
+
23
+ attr_accessor :recommend_type
24
+
25
+ attr_accessor :create_log
26
+
27
+ attr_accessor :n
28
+
29
+ attr_accessor :a_horizon
30
+
31
+ attr_accessor :allocation_method
32
+
33
+ attr_accessor :allocation_priority
34
+
35
+ attr_accessor :remove_outliers
36
+
37
+ attr_accessor :adjust_for_compounding
38
+
39
+ attr_accessor :goal_id
40
+
41
+ attr_accessor :conf_tgt
42
+
43
+ attr_accessor :trading_days_per_year
44
+
45
+ attr_accessor :use_proxy_data
46
+
47
+ attr_accessor :thresh
48
+
49
+ attr_accessor :withdrawal_tax
50
+
51
+ attr_accessor :d_horizon
52
+
53
+ attr_accessor :client_id
54
+
55
+ attr_accessor :opt_config
56
+
57
+ attr_accessor :market_data_source
58
+
59
+ attr_accessor :thresh_type
60
+
61
+ attr_accessor :horizon_frequency
62
+
63
+ attr_accessor :withdrawal_config
64
+
65
+ attr_accessor :allocations
66
+
67
+ attr_accessor :curr_inv
68
+
69
+ attr_accessor :deposit_config
70
+
71
+ class EnumAttributeValidator
72
+ attr_reader :datatype
73
+ attr_reader :allowable_values
74
+
75
+ def initialize(datatype, allowable_values)
76
+ @allowable_values = allowable_values.map do |value|
77
+ case datatype.to_s
78
+ when /Integer/i
79
+ value.to_i
80
+ when /Float/i
81
+ value.to_f
82
+ else
83
+ value
84
+ end
85
+ end
86
+ end
87
+
88
+ def valid?(value)
89
+ !value || allowable_values.include?(value)
90
+ end
91
+ end
92
+
93
+ # Attribute mapping from ruby-style variable name to JSON key.
94
+ def self.attribute_map
95
+ {
96
+ :'recommendation_config' => :'recommendation_config',
97
+ :'compounding_rate' => :'compounding_rate',
98
+ :'risk_score' => :'risk_score',
99
+ :'recommend_type' => :'recommend_type',
100
+ :'create_log' => :'create_log',
101
+ :'n' => :'n',
102
+ :'a_horizon' => :'a_horizon',
103
+ :'allocation_method' => :'allocation_method',
104
+ :'allocation_priority' => :'allocation_priority',
105
+ :'remove_outliers' => :'remove_outliers',
106
+ :'adjust_for_compounding' => :'adjust_for_compounding',
107
+ :'goal_id' => :'goal_id',
108
+ :'conf_tgt' => :'conf_tgt',
109
+ :'trading_days_per_year' => :'trading_days_per_year',
110
+ :'use_proxy_data' => :'use_proxy_data',
111
+ :'thresh' => :'thresh',
112
+ :'withdrawal_tax' => :'withdrawal_tax',
113
+ :'d_horizon' => :'d_horizon',
114
+ :'client_id' => :'client_id',
115
+ :'opt_config' => :'opt_config',
116
+ :'market_data_source' => :'market_data_source',
117
+ :'thresh_type' => :'thresh_type',
118
+ :'horizon_frequency' => :'horizon_frequency',
119
+ :'withdrawal_config' => :'withdrawal_config',
120
+ :'allocations' => :'allocations',
121
+ :'curr_inv' => :'curr_inv',
122
+ :'deposit_config' => :'deposit_config'
123
+ }
124
+ end
125
+
126
+ # Attribute type mapping.
127
+ def self.swagger_types
128
+ {
129
+ :'recommendation_config' => :'RecommendationConfig',
130
+ :'compounding_rate' => :'Float',
131
+ :'risk_score' => :'Float',
132
+ :'recommend_type' => :'String',
133
+ :'create_log' => :'BOOLEAN',
134
+ :'n' => :'Integer',
135
+ :'a_horizon' => :'Integer',
136
+ :'allocation_method' => :'String',
137
+ :'allocation_priority' => :'String',
138
+ :'remove_outliers' => :'BOOLEAN',
139
+ :'adjust_for_compounding' => :'BOOLEAN',
140
+ :'goal_id' => :'String',
141
+ :'conf_tgt' => :'Float',
142
+ :'trading_days_per_year' => :'Integer',
143
+ :'use_proxy_data' => :'BOOLEAN',
144
+ :'thresh' => :'Float',
145
+ :'withdrawal_tax' => :'Float',
146
+ :'d_horizon' => :'Integer',
147
+ :'client_id' => :'String',
148
+ :'opt_config' => :'OptConfig',
149
+ :'market_data_source' => :'String',
150
+ :'thresh_type' => :'String',
151
+ :'horizon_frequency' => :'String',
152
+ :'withdrawal_config' => :'Array<GoalWithdrawalConfig>',
153
+ :'allocations' => :'Array<String>',
154
+ :'curr_inv' => :'Float',
155
+ :'deposit_config' => :'Array<DecumulationGoalDepositConfig>'
156
+ }
157
+ end
158
+
159
+ # Initializes the object
160
+ # @param [Hash] attributes Model attributes in the form of hash
161
+ def initialize(attributes = {})
162
+ return unless attributes.is_a?(Hash)
163
+
164
+ # convert string to symbol for hash key
165
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
166
+
167
+ if attributes.has_key?(:'recommendation_config')
168
+ self.recommendation_config = attributes[:'recommendation_config']
169
+ end
170
+
171
+ if attributes.has_key?(:'compounding_rate')
172
+ self.compounding_rate = attributes[:'compounding_rate']
173
+ else
174
+ self.compounding_rate = 0.0
175
+ end
176
+
177
+ if attributes.has_key?(:'risk_score')
178
+ self.risk_score = attributes[:'risk_score']
179
+ end
180
+
181
+ if attributes.has_key?(:'recommend_type')
182
+ self.recommend_type = attributes[:'recommend_type']
183
+ else
184
+ self.recommend_type = 'horizon'
185
+ end
186
+
187
+ if attributes.has_key?(:'create_log')
188
+ self.create_log = attributes[:'create_log']
189
+ else
190
+ self.create_log = false
191
+ end
192
+
193
+ if attributes.has_key?(:'n')
194
+ self.n = attributes[:'n']
195
+ else
196
+ self.n = 1000
197
+ end
198
+
199
+ if attributes.has_key?(:'a_horizon')
200
+ self.a_horizon = attributes[:'a_horizon']
201
+ end
202
+
203
+ if attributes.has_key?(:'allocation_method')
204
+ self.allocation_method = attributes[:'allocation_method']
205
+ end
206
+
207
+ if attributes.has_key?(:'allocation_priority')
208
+ self.allocation_priority = attributes[:'allocation_priority']
209
+ end
210
+
211
+ if attributes.has_key?(:'remove_outliers')
212
+ self.remove_outliers = attributes[:'remove_outliers']
213
+ else
214
+ self.remove_outliers = true
215
+ end
216
+
217
+ if attributes.has_key?(:'adjust_for_compounding')
218
+ self.adjust_for_compounding = attributes[:'adjust_for_compounding']
219
+ else
220
+ self.adjust_for_compounding = false
221
+ end
222
+
223
+ if attributes.has_key?(:'goal_id')
224
+ self.goal_id = attributes[:'goal_id']
225
+ end
226
+
227
+ if attributes.has_key?(:'conf_tgt')
228
+ self.conf_tgt = attributes[:'conf_tgt']
229
+ else
230
+ self.conf_tgt = 0.9
231
+ end
232
+
233
+ if attributes.has_key?(:'trading_days_per_year')
234
+ self.trading_days_per_year = attributes[:'trading_days_per_year']
235
+ else
236
+ self.trading_days_per_year = 252
237
+ end
238
+
239
+ if attributes.has_key?(:'use_proxy_data')
240
+ self.use_proxy_data = attributes[:'use_proxy_data']
241
+ else
242
+ self.use_proxy_data = false
243
+ end
244
+
245
+ if attributes.has_key?(:'thresh')
246
+ self.thresh = attributes[:'thresh']
247
+ end
248
+
249
+ if attributes.has_key?(:'withdrawal_tax')
250
+ self.withdrawal_tax = attributes[:'withdrawal_tax']
251
+ else
252
+ self.withdrawal_tax = 0.0
253
+ end
254
+
255
+ if attributes.has_key?(:'d_horizon')
256
+ self.d_horizon = attributes[:'d_horizon']
257
+ end
258
+
259
+ if attributes.has_key?(:'client_id')
260
+ self.client_id = attributes[:'client_id']
261
+ end
262
+
263
+ if attributes.has_key?(:'opt_config')
264
+ self.opt_config = attributes[:'opt_config']
265
+ end
266
+
267
+ if attributes.has_key?(:'market_data_source')
268
+ self.market_data_source = attributes[:'market_data_source']
269
+ else
270
+ self.market_data_source = 'nucleus'
271
+ end
272
+
273
+ if attributes.has_key?(:'thresh_type')
274
+ self.thresh_type = attributes[:'thresh_type']
275
+ else
276
+ self.thresh_type = 'perc'
277
+ end
278
+
279
+ if attributes.has_key?(:'horizon_frequency')
280
+ self.horizon_frequency = attributes[:'horizon_frequency']
281
+ else
282
+ self.horizon_frequency = 'year'
283
+ end
284
+
285
+ if attributes.has_key?(:'withdrawal_config')
286
+ if (value = attributes[:'withdrawal_config']).is_a?(Array)
287
+ self.withdrawal_config = value
288
+ end
289
+ end
290
+
291
+ if attributes.has_key?(:'allocations')
292
+ if (value = attributes[:'allocations']).is_a?(Array)
293
+ self.allocations = value
294
+ end
295
+ end
296
+
297
+ if attributes.has_key?(:'curr_inv')
298
+ self.curr_inv = attributes[:'curr_inv']
299
+ end
300
+
301
+ if attributes.has_key?(:'deposit_config')
302
+ if (value = attributes[:'deposit_config']).is_a?(Array)
303
+ self.deposit_config = value
304
+ end
305
+ end
306
+ end
307
+
308
+ # Show invalid properties with the reasons. Usually used together with valid?
309
+ # @return Array for valid properties with the reasons
310
+ def list_invalid_properties
311
+ invalid_properties = Array.new
312
+ if !@compounding_rate.nil? && @compounding_rate < -1
313
+ invalid_properties.push('invalid value for "compounding_rate", must be greater than or equal to -1.')
314
+ end
315
+
316
+ if !@risk_score.nil? && @risk_score > 100
317
+ invalid_properties.push('invalid value for "risk_score", must be smaller than or equal to 100.')
318
+ end
319
+
320
+ if !@risk_score.nil? && @risk_score < 0
321
+ invalid_properties.push('invalid value for "risk_score", must be greater than or equal to 0.')
322
+ end
323
+
324
+ if !@n.nil? && @n > 10000
325
+ invalid_properties.push('invalid value for "n", must be smaller than or equal to 10000.')
326
+ end
327
+
328
+ if !@n.nil? && @n < 1
329
+ invalid_properties.push('invalid value for "n", must be greater than or equal to 1.')
330
+ end
331
+
332
+ if !@a_horizon.nil? && @a_horizon > 350
333
+ invalid_properties.push('invalid value for "a_horizon", must be smaller than or equal to 350.')
334
+ end
335
+
336
+ if !@a_horizon.nil? && @a_horizon < 0
337
+ invalid_properties.push('invalid value for "a_horizon", must be greater than or equal to 0.')
338
+ end
339
+
340
+ if @allocation_method.nil?
341
+ invalid_properties.push('invalid value for "allocation_method", allocation_method cannot be nil.')
342
+ end
343
+
344
+ if @allocation_priority.nil?
345
+ invalid_properties.push('invalid value for "allocation_priority", allocation_priority cannot be nil.')
346
+ end
347
+
348
+ if !@conf_tgt.nil? && @conf_tgt > 1
349
+ invalid_properties.push('invalid value for "conf_tgt", must be smaller than or equal to 1.')
350
+ end
351
+
352
+ if !@conf_tgt.nil? && @conf_tgt < 0
353
+ invalid_properties.push('invalid value for "conf_tgt", must be greater than or equal to 0.')
354
+ end
355
+
356
+ if !@trading_days_per_year.nil? && @trading_days_per_year > 365
357
+ invalid_properties.push('invalid value for "trading_days_per_year", must be smaller than or equal to 365.')
358
+ end
359
+
360
+ if !@trading_days_per_year.nil? && @trading_days_per_year < 1
361
+ invalid_properties.push('invalid value for "trading_days_per_year", must be greater than or equal to 1.')
362
+ end
363
+
364
+ if !@thresh.nil? && @thresh < 0
365
+ invalid_properties.push('invalid value for "thresh", must be greater than or equal to 0.')
366
+ end
367
+
368
+ if !@withdrawal_tax.nil? && @withdrawal_tax > 1
369
+ invalid_properties.push('invalid value for "withdrawal_tax", must be smaller than or equal to 1.')
370
+ end
371
+
372
+ if !@withdrawal_tax.nil? && @withdrawal_tax < 0
373
+ invalid_properties.push('invalid value for "withdrawal_tax", must be greater than or equal to 0.')
374
+ end
375
+
376
+ if !@d_horizon.nil? && @d_horizon > 350
377
+ invalid_properties.push('invalid value for "d_horizon", must be smaller than or equal to 350.')
378
+ end
379
+
380
+ if !@d_horizon.nil? && @d_horizon < 0
381
+ invalid_properties.push('invalid value for "d_horizon", must be greater than or equal to 0.')
382
+ end
383
+
384
+ if !@curr_inv.nil? && @curr_inv < 0
385
+ invalid_properties.push('invalid value for "curr_inv", must be greater than or equal to 0.')
386
+ end
387
+
388
+ invalid_properties
389
+ end
390
+
391
+ # Check to see if the all the properties in the model are valid
392
+ # @return true if the model is valid
393
+ def valid?
394
+ return false if !@compounding_rate.nil? && @compounding_rate < -1
395
+ return false if !@risk_score.nil? && @risk_score > 100
396
+ return false if !@risk_score.nil? && @risk_score < 0
397
+ recommend_type_validator = EnumAttributeValidator.new('String', ['recurring', 'one-time', 'combo', 'horizon'])
398
+ return false unless recommend_type_validator.valid?(@recommend_type)
399
+ return false if !@n.nil? && @n > 10000
400
+ return false if !@n.nil? && @n < 1
401
+ return false if !@a_horizon.nil? && @a_horizon > 350
402
+ return false if !@a_horizon.nil? && @a_horizon < 0
403
+ return false if @allocation_method.nil?
404
+ allocation_method_validator = EnumAttributeValidator.new('String', ['select', 'create'])
405
+ return false unless allocation_method_validator.valid?(@allocation_method)
406
+ return false if @allocation_priority.nil?
407
+ allocation_priority_validator = EnumAttributeValidator.new('String', ['goal', 'risk'])
408
+ return false unless allocation_priority_validator.valid?(@allocation_priority)
409
+ return false if !@conf_tgt.nil? && @conf_tgt > 1
410
+ return false if !@conf_tgt.nil? && @conf_tgt < 0
411
+ return false if !@trading_days_per_year.nil? && @trading_days_per_year > 365
412
+ return false if !@trading_days_per_year.nil? && @trading_days_per_year < 1
413
+ return false if !@thresh.nil? && @thresh < 0
414
+ return false if !@withdrawal_tax.nil? && @withdrawal_tax > 1
415
+ return false if !@withdrawal_tax.nil? && @withdrawal_tax < 0
416
+ return false if !@d_horizon.nil? && @d_horizon > 350
417
+ return false if !@d_horizon.nil? && @d_horizon < 0
418
+ market_data_source_validator = EnumAttributeValidator.new('String', ['nucleus', 'integration'])
419
+ return false unless market_data_source_validator.valid?(@market_data_source)
420
+ thresh_type_validator = EnumAttributeValidator.new('String', ['amnt', 'perc'])
421
+ return false unless thresh_type_validator.valid?(@thresh_type)
422
+ horizon_frequency_validator = EnumAttributeValidator.new('String', ['year', 'six_months', 'quarter', 'month', 'two_weeks', 'week', 'day'])
423
+ return false unless horizon_frequency_validator.valid?(@horizon_frequency)
424
+ return false if !@curr_inv.nil? && @curr_inv < 0
425
+ true
426
+ end
427
+
428
+ # Custom attribute writer method with validation
429
+ # @param [Object] compounding_rate Value to be assigned
430
+ def compounding_rate=(compounding_rate)
431
+ if !compounding_rate.nil? && compounding_rate < -1
432
+ fail ArgumentError, 'invalid value for "compounding_rate", must be greater than or equal to -1.'
433
+ end
434
+
435
+ @compounding_rate = compounding_rate
436
+ end
437
+
438
+ # Custom attribute writer method with validation
439
+ # @param [Object] risk_score Value to be assigned
440
+ def risk_score=(risk_score)
441
+ if !risk_score.nil? && risk_score > 100
442
+ fail ArgumentError, 'invalid value for "risk_score", must be smaller than or equal to 100.'
443
+ end
444
+
445
+ if !risk_score.nil? && risk_score < 0
446
+ fail ArgumentError, 'invalid value for "risk_score", must be greater than or equal to 0.'
447
+ end
448
+
449
+ @risk_score = risk_score
450
+ end
451
+
452
+ # Custom attribute writer method checking allowed values (enum).
453
+ # @param [Object] recommend_type Object to be assigned
454
+ def recommend_type=(recommend_type)
455
+ validator = EnumAttributeValidator.new('String', ['recurring', 'one-time', 'combo', 'horizon'])
456
+ unless validator.valid?(recommend_type)
457
+ fail ArgumentError, 'invalid value for "recommend_type", must be one of #{validator.allowable_values}.'
458
+ end
459
+ @recommend_type = recommend_type
460
+ end
461
+
462
+ # Custom attribute writer method with validation
463
+ # @param [Object] n Value to be assigned
464
+ def n=(n)
465
+ if !n.nil? && n > 10000
466
+ fail ArgumentError, 'invalid value for "n", must be smaller than or equal to 10000.'
467
+ end
468
+
469
+ if !n.nil? && n < 1
470
+ fail ArgumentError, 'invalid value for "n", must be greater than or equal to 1.'
471
+ end
472
+
473
+ @n = n
474
+ end
475
+
476
+ # Custom attribute writer method with validation
477
+ # @param [Object] a_horizon Value to be assigned
478
+ def a_horizon=(a_horizon)
479
+ if !a_horizon.nil? && a_horizon > 350
480
+ fail ArgumentError, 'invalid value for "a_horizon", must be smaller than or equal to 350.'
481
+ end
482
+
483
+ if !a_horizon.nil? && a_horizon < 0
484
+ fail ArgumentError, 'invalid value for "a_horizon", must be greater than or equal to 0.'
485
+ end
486
+
487
+ @a_horizon = a_horizon
488
+ end
489
+
490
+ # Custom attribute writer method checking allowed values (enum).
491
+ # @param [Object] allocation_method Object to be assigned
492
+ def allocation_method=(allocation_method)
493
+ validator = EnumAttributeValidator.new('String', ['select', 'create'])
494
+ unless validator.valid?(allocation_method)
495
+ fail ArgumentError, 'invalid value for "allocation_method", must be one of #{validator.allowable_values}.'
496
+ end
497
+ @allocation_method = allocation_method
498
+ end
499
+
500
+ # Custom attribute writer method checking allowed values (enum).
501
+ # @param [Object] allocation_priority Object to be assigned
502
+ def allocation_priority=(allocation_priority)
503
+ validator = EnumAttributeValidator.new('String', ['goal', 'risk'])
504
+ unless validator.valid?(allocation_priority)
505
+ fail ArgumentError, 'invalid value for "allocation_priority", must be one of #{validator.allowable_values}.'
506
+ end
507
+ @allocation_priority = allocation_priority
508
+ end
509
+
510
+ # Custom attribute writer method with validation
511
+ # @param [Object] conf_tgt Value to be assigned
512
+ def conf_tgt=(conf_tgt)
513
+ if !conf_tgt.nil? && conf_tgt > 1
514
+ fail ArgumentError, 'invalid value for "conf_tgt", must be smaller than or equal to 1.'
515
+ end
516
+
517
+ if !conf_tgt.nil? && conf_tgt < 0
518
+ fail ArgumentError, 'invalid value for "conf_tgt", must be greater than or equal to 0.'
519
+ end
520
+
521
+ @conf_tgt = conf_tgt
522
+ end
523
+
524
+ # Custom attribute writer method with validation
525
+ # @param [Object] trading_days_per_year Value to be assigned
526
+ def trading_days_per_year=(trading_days_per_year)
527
+ if !trading_days_per_year.nil? && trading_days_per_year > 365
528
+ fail ArgumentError, 'invalid value for "trading_days_per_year", must be smaller than or equal to 365.'
529
+ end
530
+
531
+ if !trading_days_per_year.nil? && trading_days_per_year < 1
532
+ fail ArgumentError, 'invalid value for "trading_days_per_year", must be greater than or equal to 1.'
533
+ end
534
+
535
+ @trading_days_per_year = trading_days_per_year
536
+ end
537
+
538
+ # Custom attribute writer method with validation
539
+ # @param [Object] thresh Value to be assigned
540
+ def thresh=(thresh)
541
+ if !thresh.nil? && thresh < 0
542
+ fail ArgumentError, 'invalid value for "thresh", must be greater than or equal to 0.'
543
+ end
544
+
545
+ @thresh = thresh
546
+ end
547
+
548
+ # Custom attribute writer method with validation
549
+ # @param [Object] withdrawal_tax Value to be assigned
550
+ def withdrawal_tax=(withdrawal_tax)
551
+ if !withdrawal_tax.nil? && withdrawal_tax > 1
552
+ fail ArgumentError, 'invalid value for "withdrawal_tax", must be smaller than or equal to 1.'
553
+ end
554
+
555
+ if !withdrawal_tax.nil? && withdrawal_tax < 0
556
+ fail ArgumentError, 'invalid value for "withdrawal_tax", must be greater than or equal to 0.'
557
+ end
558
+
559
+ @withdrawal_tax = withdrawal_tax
560
+ end
561
+
562
+ # Custom attribute writer method with validation
563
+ # @param [Object] d_horizon Value to be assigned
564
+ def d_horizon=(d_horizon)
565
+ if !d_horizon.nil? && d_horizon > 350
566
+ fail ArgumentError, 'invalid value for "d_horizon", must be smaller than or equal to 350.'
567
+ end
568
+
569
+ if !d_horizon.nil? && d_horizon < 0
570
+ fail ArgumentError, 'invalid value for "d_horizon", must be greater than or equal to 0.'
571
+ end
572
+
573
+ @d_horizon = d_horizon
574
+ end
575
+
576
+ # Custom attribute writer method checking allowed values (enum).
577
+ # @param [Object] market_data_source Object to be assigned
578
+ def market_data_source=(market_data_source)
579
+ validator = EnumAttributeValidator.new('String', ['nucleus', 'integration'])
580
+ unless validator.valid?(market_data_source)
581
+ fail ArgumentError, 'invalid value for "market_data_source", must be one of #{validator.allowable_values}.'
582
+ end
583
+ @market_data_source = market_data_source
584
+ end
585
+
586
+ # Custom attribute writer method checking allowed values (enum).
587
+ # @param [Object] thresh_type Object to be assigned
588
+ def thresh_type=(thresh_type)
589
+ validator = EnumAttributeValidator.new('String', ['amnt', 'perc'])
590
+ unless validator.valid?(thresh_type)
591
+ fail ArgumentError, 'invalid value for "thresh_type", must be one of #{validator.allowable_values}.'
592
+ end
593
+ @thresh_type = thresh_type
594
+ end
595
+
596
+ # Custom attribute writer method checking allowed values (enum).
597
+ # @param [Object] horizon_frequency Object to be assigned
598
+ def horizon_frequency=(horizon_frequency)
599
+ validator = EnumAttributeValidator.new('String', ['year', 'six_months', 'quarter', 'month', 'two_weeks', 'week', 'day'])
600
+ unless validator.valid?(horizon_frequency)
601
+ fail ArgumentError, 'invalid value for "horizon_frequency", must be one of #{validator.allowable_values}.'
602
+ end
603
+ @horizon_frequency = horizon_frequency
604
+ end
605
+
606
+ # Custom attribute writer method with validation
607
+ # @param [Object] curr_inv Value to be assigned
608
+ def curr_inv=(curr_inv)
609
+ if !curr_inv.nil? && curr_inv < 0
610
+ fail ArgumentError, 'invalid value for "curr_inv", must be greater than or equal to 0.'
611
+ end
612
+
613
+ @curr_inv = curr_inv
614
+ end
615
+
616
+ # Checks equality by comparing each attribute.
617
+ # @param [Object] Object to be compared
618
+ def ==(o)
619
+ return true if self.equal?(o)
620
+ self.class == o.class &&
621
+ recommendation_config == o.recommendation_config &&
622
+ compounding_rate == o.compounding_rate &&
623
+ risk_score == o.risk_score &&
624
+ recommend_type == o.recommend_type &&
625
+ create_log == o.create_log &&
626
+ n == o.n &&
627
+ a_horizon == o.a_horizon &&
628
+ allocation_method == o.allocation_method &&
629
+ allocation_priority == o.allocation_priority &&
630
+ remove_outliers == o.remove_outliers &&
631
+ adjust_for_compounding == o.adjust_for_compounding &&
632
+ goal_id == o.goal_id &&
633
+ conf_tgt == o.conf_tgt &&
634
+ trading_days_per_year == o.trading_days_per_year &&
635
+ use_proxy_data == o.use_proxy_data &&
636
+ thresh == o.thresh &&
637
+ withdrawal_tax == o.withdrawal_tax &&
638
+ d_horizon == o.d_horizon &&
639
+ client_id == o.client_id &&
640
+ opt_config == o.opt_config &&
641
+ market_data_source == o.market_data_source &&
642
+ thresh_type == o.thresh_type &&
643
+ horizon_frequency == o.horizon_frequency &&
644
+ withdrawal_config == o.withdrawal_config &&
645
+ allocations == o.allocations &&
646
+ curr_inv == o.curr_inv &&
647
+ deposit_config == o.deposit_config
648
+ end
649
+
650
+ # @see the `==` method
651
+ # @param [Object] Object to be compared
652
+ def eql?(o)
653
+ self == o
654
+ end
655
+
656
+ # Calculates hash code according to all attributes.
657
+ # @return [Fixnum] Hash code
658
+ def hash
659
+ [recommendation_config, compounding_rate, risk_score, recommend_type, create_log, n, a_horizon, allocation_method, allocation_priority, remove_outliers, adjust_for_compounding, goal_id, conf_tgt, trading_days_per_year, use_proxy_data, thresh, withdrawal_tax, d_horizon, client_id, opt_config, market_data_source, thresh_type, horizon_frequency, withdrawal_config, allocations, curr_inv, deposit_config].hash
660
+ end
661
+
662
+ # Builds the object from hash
663
+ # @param [Hash] attributes Model attributes in the form of hash
664
+ # @return [Object] Returns the model itself
665
+ def build_from_hash(attributes)
666
+ return nil unless attributes.is_a?(Hash)
667
+ self.class.swagger_types.each_pair do |key, type|
668
+ if type =~ /\AArray<(.*)>/i
669
+ # check to ensure the input is an array given that the attribute
670
+ # is documented as an array but the input is not
671
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
672
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
673
+ end
674
+ elsif !attributes[self.class.attribute_map[key]].nil?
675
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
676
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
677
+ end
678
+
679
+ self
680
+ end
681
+ # Deserializes the data based on type
682
+ # @param string type Data type
683
+ # @param string value Value to be deserialized
684
+ # @return [Object] Deserialized data
685
+ def _deserialize(type, value)
686
+ case type.to_sym
687
+ when :DateTime
688
+ value
689
+ when :Date
690
+ value
691
+ when :String
692
+ value.to_s
693
+ when :Integer
694
+ value.to_i
695
+ when :Float
696
+ value.to_f
697
+ when :BOOLEAN
698
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
699
+ true
700
+ else
701
+ false
702
+ end
703
+ when :Object
704
+ # generic object (usually a Hash), return directly
705
+ value
706
+ when /\AArray<(?<inner_type>.+)>\z/
707
+ inner_type = Regexp.last_match[:inner_type]
708
+ value.map { |v| _deserialize(inner_type, v) }
709
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
710
+ k_type = Regexp.last_match[:k_type]
711
+ v_type = Regexp.last_match[:v_type]
712
+ {}.tap do |hash|
713
+ value.each do |k, v|
714
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
715
+ end
716
+ end
717
+ else # model
718
+ temp_model = ProtonApi.const_get(type).new
719
+ temp_model.build_from_hash(value)
720
+ end
721
+ end
722
+ # Returns the string representation of the object
723
+ # @return [String] String presentation of the object
724
+ def to_s
725
+ to_hash.to_s
726
+ end
727
+
728
+ # to_body is an alias to to_hash (backward compatibility)
729
+ # @return [Hash] Returns the object in the form of hash
730
+ def to_body
731
+ to_hash
732
+ end
733
+
734
+ # Returns the object in the form of hash
735
+ # @return [Hash] Returns the object in the form of hash
736
+ def to_hash
737
+ hash = {}
738
+ self.class.attribute_map.each_pair do |attr, param|
739
+ value = self.send(attr)
740
+ next if value.nil?
741
+ hash[param] = _to_hash(value)
742
+ end
743
+ hash
744
+ end
745
+ # Outputs non-array value in the form of hash
746
+ # For object, use to_hash. Otherwise, just return the value
747
+ # @param [Object] value Any valid value
748
+ # @return [Hash] Returns the value in the form of hash
749
+ def _to_hash(value)
750
+ if value.is_a?(Array)
751
+ value.compact.map { |v| _to_hash(v) }
752
+ elsif value.is_a?(Hash)
753
+ {}.tap do |hash|
754
+ value.each { |k, v| hash[k] = _to_hash(v) }
755
+ end
756
+ elsif value.respond_to? :to_hash
757
+ value.to_hash
758
+ else
759
+ value
760
+ end
761
+ end
762
+
763
+ end
764
+ end