proton_api 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (292) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/README.md +246 -0
  4. data/Rakefile +8 -0
  5. data/docs/AccumulationGoalDepositConfig.md +14 -0
  6. data/docs/AnnuitiesApi.md +344 -0
  7. data/docs/AnnuityCalculatorAccumulationHorizonRequest.md +19 -0
  8. data/docs/AnnuityCalculatorAnnuityAmountRequest.md +19 -0
  9. data/docs/AnnuityCalculatorDecumulationHorizonRequest.md +19 -0
  10. data/docs/AnnuityCalculatorDepositAmountRequest.md +19 -0
  11. data/docs/AnnuityCalculatorInitialBalanceRequest.md +19 -0
  12. data/docs/AnnuityDepositSchedule.md +10 -0
  13. data/docs/BacktestRequest.md +17 -0
  14. data/docs/BeneficiaryBequestConfig.md +10 -0
  15. data/docs/BudgetAggregationAccount.md +8 -0
  16. data/docs/BudgetCalculatorRequest.md +16 -0
  17. data/docs/BudgetComponent.md +10 -0
  18. data/docs/BudgetDetails.md +17 -0
  19. data/docs/BusinessFinancialHealthCheckRequest.md +22 -0
  20. data/docs/BusinessFinancialManagementApi.md +288 -0
  21. data/docs/BusinessInvoiceAnalysisRequest.md +20 -0
  22. data/docs/CalculatorDepositSchedule.md +9 -0
  23. data/docs/CalculatorDepositSchedule1.md +10 -0
  24. data/docs/CardLimitCheckRequest.md +9 -0
  25. data/docs/CardTransactionAuthorizationRequest.md +19 -0
  26. data/docs/CardsApi.md +120 -0
  27. data/docs/CashAnalysisRequest.md +17 -0
  28. data/docs/CashFlowAnalysisRequest.md +20 -0
  29. data/docs/ChildrenEducationConfig.md +9 -0
  30. data/docs/CustomerAnalysisRequest.md +17 -0
  31. data/docs/DecumulationGoalDepositConfig.md +14 -0
  32. data/docs/DimensionalRiskScoreRequest.md +16 -0
  33. data/docs/DiversificationScoreRequest.md +19 -0
  34. data/docs/EducationCalculatorAnnualCostRequest.md +18 -0
  35. data/docs/EducationCalculatorDepositAmountRequest.md +19 -0
  36. data/docs/EducationCalculatorPercentCoveredRequest.md +18 -0
  37. data/docs/EducationConfig.md +10 -0
  38. data/docs/EmergencyFundCalculatorRequest.md +24 -0
  39. data/docs/EventStudyRequest.md +18 -0
  40. data/docs/FeeAnalysisRequest.md +13 -0
  41. data/docs/FinancialHealthApi.md +232 -0
  42. data/docs/FinancialHealthCheckRequest.md +17 -0
  43. data/docs/FinancialPictureRequest.md +16 -0
  44. data/docs/FinancialPlanningApi.md +680 -0
  45. data/docs/FinancialStatementAnalysisRequest.md +22 -0
  46. data/docs/GoalAccumulationAllocationRequest.md +33 -0
  47. data/docs/GoalAccumulationRecommendationRequest.md +28 -0
  48. data/docs/GoalAccumulationStatusRequest.md +28 -0
  49. data/docs/GoalConfig.md +9 -0
  50. data/docs/GoalDecumulationAllocationRequest.md +34 -0
  51. data/docs/GoalDecumulationRecommendationRequest.md +29 -0
  52. data/docs/GoalDecumulationStatusRequest.md +29 -0
  53. data/docs/GoalWithdrawalConfig.md +14 -0
  54. data/docs/GoalsApi.md +344 -0
  55. data/docs/GuaranteedRateBenefit.md +11 -0
  56. data/docs/IncomeConfig.md +10 -0
  57. data/docs/LifeInsuranceApi.md +64 -0
  58. data/docs/LifeInsuranceNeedsCalculatorRequest.md +22 -0
  59. data/docs/MonteCarloRequest.md +29 -0
  60. data/docs/MortgageCalculatorDownPaymentRequest.md +11 -0
  61. data/docs/MortgageCalculatorHomePriceRequest.md +11 -0
  62. data/docs/MortgageCalculatorPeriodicPaymentRequest.md +11 -0
  63. data/docs/MvoRequest.md +18 -0
  64. data/docs/OptConfig.md +14 -0
  65. data/docs/OptConfig1.md +12 -0
  66. data/docs/Periods.md +9 -0
  67. data/docs/PersonalFinancialManagementApi.md +288 -0
  68. data/docs/PortfolioConstructionApi.md +64 -0
  69. data/docs/PortfolioManagementApi.md +64 -0
  70. data/docs/PortfolioOptimizationScoreRequest.md +21 -0
  71. data/docs/PortfolioWhatIfRequest.md +21 -0
  72. data/docs/PurchaseCalculatorAmountRequest.md +16 -0
  73. data/docs/PurchaseCalculatorDepositAmountRequest.md +17 -0
  74. data/docs/PurchaseCalculatorHorizonRequest.md +15 -0
  75. data/docs/RatioTargets.md +13 -0
  76. data/docs/RatioTargets1.md +13 -0
  77. data/docs/RebalancingSignalRequest.md +13 -0
  78. data/docs/RecommendationConfig.md +15 -0
  79. data/docs/RecommendationConfig1.md +14 -0
  80. data/docs/RecurringTransactionAnalysisRequest.md +19 -0
  81. data/docs/RetirementCalculatorDepositAmountRequest.md +20 -0
  82. data/docs/RetirementCalculatorExpensesRequest.md +19 -0
  83. data/docs/RetirementCalculatorPercentCoveredRequest.md +19 -0
  84. data/docs/RiskAllocationRequest.md +14 -0
  85. data/docs/RiskScoreRequest.md +13 -0
  86. data/docs/RiskScoringApi.md +176 -0
  87. data/docs/SavingsCalculatorRequest.md +17 -0
  88. data/docs/SavingsDepositSchedule.md +11 -0
  89. data/docs/ScenarioAnalysisRequest.md +22 -0
  90. data/docs/SensitivityAnalysisRequest.md +22 -0
  91. data/docs/SensitivityFactor.md +11 -0
  92. data/docs/Settings.md +13 -0
  93. data/docs/SimulationsApi.md +400 -0
  94. data/docs/VariableAnnuityRequest.md +34 -0
  95. data/docs/WConfig.md +12 -0
  96. data/docs/WConfig1.md +12 -0
  97. data/git_push.sh +55 -0
  98. data/lib/proton_api.rb +132 -0
  99. data/lib/proton_api/api/annuities_api.rb +347 -0
  100. data/lib/proton_api/api/business_financial_management_api.rb +293 -0
  101. data/lib/proton_api/api/cards_api.rb +131 -0
  102. data/lib/proton_api/api/financial_health_api.rb +239 -0
  103. data/lib/proton_api/api/financial_planning_api.rb +671 -0
  104. data/lib/proton_api/api/goals_api.rb +347 -0
  105. data/lib/proton_api/api/life_insurance_api.rb +77 -0
  106. data/lib/proton_api/api/personal_financial_management_api.rb +293 -0
  107. data/lib/proton_api/api/portfolio_construction_api.rb +77 -0
  108. data/lib/proton_api/api/portfolio_management_api.rb +77 -0
  109. data/lib/proton_api/api/risk_scoring_api.rb +185 -0
  110. data/lib/proton_api/api/simulations_api.rb +401 -0
  111. data/lib/proton_api/api_client.rb +391 -0
  112. data/lib/proton_api/api_error.rb +38 -0
  113. data/lib/proton_api/auth_configuration.rb +177 -0
  114. data/lib/proton_api/configuration.rb +209 -0
  115. data/lib/proton_api/models/accumulation_goal_deposit_config.rb +338 -0
  116. data/lib/proton_api/models/annuity_calculator_accumulation_horizon_request.rb +462 -0
  117. data/lib/proton_api/models/annuity_calculator_annuity_amount_request.rb +464 -0
  118. data/lib/proton_api/models/annuity_calculator_decumulation_horizon_request.rb +462 -0
  119. data/lib/proton_api/models/annuity_calculator_deposit_amount_request.rb +471 -0
  120. data/lib/proton_api/models/annuity_calculator_initial_balance_request.rb +471 -0
  121. data/lib/proton_api/models/annuity_deposit_schedule.rb +257 -0
  122. data/lib/proton_api/models/backtest_request.rb +298 -0
  123. data/lib/proton_api/models/beneficiary_bequest_config.rb +260 -0
  124. data/lib/proton_api/models/budget_aggregation_account.rb +189 -0
  125. data/lib/proton_api/models/budget_calculator_request.rb +315 -0
  126. data/lib/proton_api/models/budget_component.rb +231 -0
  127. data/lib/proton_api/models/budget_details.rb +340 -0
  128. data/lib/proton_api/models/business_financial_health_check_request.rb +478 -0
  129. data/lib/proton_api/models/business_invoice_analysis_request.rb +355 -0
  130. data/lib/proton_api/models/calculator_deposit_schedule.rb +231 -0
  131. data/lib/proton_api/models/calculator_deposit_schedule1.rb +257 -0
  132. data/lib/proton_api/models/card_limit_check_request.rb +203 -0
  133. data/lib/proton_api/models/card_transaction_authorization_request.rb +359 -0
  134. data/lib/proton_api/models/cash_analysis_request.rb +321 -0
  135. data/lib/proton_api/models/cash_flow_analysis_request.rb +338 -0
  136. data/lib/proton_api/models/children_education_config.rb +224 -0
  137. data/lib/proton_api/models/customer_analysis_request.rb +286 -0
  138. data/lib/proton_api/models/decumulation_goal_deposit_config.rb +338 -0
  139. data/lib/proton_api/models/dimensional_risk_score_request.rb +285 -0
  140. data/lib/proton_api/models/diversification_score_request.rb +327 -0
  141. data/lib/proton_api/models/education_calculator_annual_cost_request.rb +453 -0
  142. data/lib/proton_api/models/education_calculator_deposit_amount_request.rb +486 -0
  143. data/lib/proton_api/models/education_calculator_percent_covered_request.rb +451 -0
  144. data/lib/proton_api/models/education_config.rb +274 -0
  145. data/lib/proton_api/models/emergency_fund_calculator_request.rb +564 -0
  146. data/lib/proton_api/models/event_study_request.rb +320 -0
  147. data/lib/proton_api/models/fee_analysis_request.rb +231 -0
  148. data/lib/proton_api/models/financial_health_check_request.rb +387 -0
  149. data/lib/proton_api/models/financial_picture_request.rb +269 -0
  150. data/lib/proton_api/models/financial_statement_analysis_request.rb +455 -0
  151. data/lib/proton_api/models/goal_accumulation_allocation_request.rb +732 -0
  152. data/lib/proton_api/models/goal_accumulation_recommendation_request.rb +625 -0
  153. data/lib/proton_api/models/goal_accumulation_status_request.rb +625 -0
  154. data/lib/proton_api/models/goal_config.rb +225 -0
  155. data/lib/proton_api/models/goal_decumulation_allocation_request.rb +767 -0
  156. data/lib/proton_api/models/goal_decumulation_recommendation_request.rb +660 -0
  157. data/lib/proton_api/models/goal_decumulation_status_request.rb +660 -0
  158. data/lib/proton_api/models/goal_withdrawal_config.rb +338 -0
  159. data/lib/proton_api/models/guaranteed_rate_benefit.rb +275 -0
  160. data/lib/proton_api/models/income_config.rb +269 -0
  161. data/lib/proton_api/models/life_insurance_needs_calculator_request.rb +518 -0
  162. data/lib/proton_api/models/monte_carlo_request.rb +507 -0
  163. data/lib/proton_api/models/mortgage_calculator_down_payment_request.rb +302 -0
  164. data/lib/proton_api/models/mortgage_calculator_home_price_request.rb +302 -0
  165. data/lib/proton_api/models/mortgage_calculator_periodic_payment_request.rb +302 -0
  166. data/lib/proton_api/models/mvo_request.rb +369 -0
  167. data/lib/proton_api/models/opt_config.rb +303 -0
  168. data/lib/proton_api/models/opt_config1.rb +263 -0
  169. data/lib/proton_api/models/periods.rb +223 -0
  170. data/lib/proton_api/models/portfolio_optimization_score_request.rb +359 -0
  171. data/lib/proton_api/models/portfolio_what_if_request.rb +354 -0
  172. data/lib/proton_api/models/purchase_calculator_amount_request.rb +404 -0
  173. data/lib/proton_api/models/purchase_calculator_deposit_amount_request.rb +437 -0
  174. data/lib/proton_api/models/purchase_calculator_horizon_request.rb +359 -0
  175. data/lib/proton_api/models/ratio_targets.rb +331 -0
  176. data/lib/proton_api/models/ratio_targets1.rb +331 -0
  177. data/lib/proton_api/models/rebalancing_signal_request.rb +241 -0
  178. data/lib/proton_api/models/recommendation_config.rb +360 -0
  179. data/lib/proton_api/models/recommendation_config1.rb +349 -0
  180. data/lib/proton_api/models/recurring_transaction_analysis_request.rb +370 -0
  181. data/lib/proton_api/models/retirement_calculator_deposit_amount_request.rb +512 -0
  182. data/lib/proton_api/models/retirement_calculator_expenses_request.rb +479 -0
  183. data/lib/proton_api/models/retirement_calculator_percent_covered_request.rb +477 -0
  184. data/lib/proton_api/models/risk_allocation_request.rb +319 -0
  185. data/lib/proton_api/models/risk_score_request.rb +242 -0
  186. data/lib/proton_api/models/savings_calculator_request.rb +398 -0
  187. data/lib/proton_api/models/savings_deposit_schedule.rb +279 -0
  188. data/lib/proton_api/models/scenario_analysis_request.rb +404 -0
  189. data/lib/proton_api/models/sensitivity_analysis_request.rb +402 -0
  190. data/lib/proton_api/models/sensitivity_factor.rb +281 -0
  191. data/lib/proton_api/models/settings.rb +290 -0
  192. data/lib/proton_api/models/variable_annuity_request.rb +703 -0
  193. data/lib/proton_api/models/w_config.rb +385 -0
  194. data/lib/proton_api/models/w_config1.rb +350 -0
  195. data/lib/proton_api/version.rb +15 -0
  196. data/proton_api.gemspec +46 -0
  197. data/spec/api/annuities_api_spec.rb +107 -0
  198. data/spec/api/business_financial_management_api_spec.rb +95 -0
  199. data/spec/api/cards_api_spec.rb +59 -0
  200. data/spec/api/financial_health_api_spec.rb +83 -0
  201. data/spec/api/financial_planning_api_spec.rb +179 -0
  202. data/spec/api/goals_api_spec.rb +107 -0
  203. data/spec/api/life_insurance_api_spec.rb +47 -0
  204. data/spec/api/personal_financial_management_api_spec.rb +95 -0
  205. data/spec/api/portfolio_construction_api_spec.rb +47 -0
  206. data/spec/api/portfolio_management_api_spec.rb +47 -0
  207. data/spec/api/risk_scoring_api_spec.rb +71 -0
  208. data/spec/api/simulations_api_spec.rb +119 -0
  209. data/spec/api_client_spec.rb +243 -0
  210. data/spec/configuration_spec.rb +42 -0
  211. data/spec/models/accumulation_goal_deposit_config_spec.rb +89 -0
  212. data/spec/models/annuity_calculator_accumulation_horizon_request_spec.rb +111 -0
  213. data/spec/models/annuity_calculator_annuity_amount_request_spec.rb +111 -0
  214. data/spec/models/annuity_calculator_decumulation_horizon_request_spec.rb +111 -0
  215. data/spec/models/annuity_calculator_deposit_amount_request_spec.rb +111 -0
  216. data/spec/models/annuity_calculator_initial_balance_request_spec.rb +111 -0
  217. data/spec/models/annuity_deposit_schedule_spec.rb +57 -0
  218. data/spec/models/backtest_request_spec.rb +95 -0
  219. data/spec/models/beneficiary_bequest_config_spec.rb +53 -0
  220. data/spec/models/budget_aggregation_account_spec.rb +41 -0
  221. data/spec/models/budget_calculator_request_spec.rb +93 -0
  222. data/spec/models/budget_component_spec.rb +53 -0
  223. data/spec/models/budget_details_spec.rb +99 -0
  224. data/spec/models/business_financial_health_check_request_spec.rb +137 -0
  225. data/spec/models/business_invoice_analysis_request_spec.rb +117 -0
  226. data/spec/models/calculator_deposit_schedule1_spec.rb +57 -0
  227. data/spec/models/calculator_deposit_schedule_spec.rb +51 -0
  228. data/spec/models/card_limit_check_request_spec.rb +47 -0
  229. data/spec/models/card_transaction_authorization_request_spec.rb +115 -0
  230. data/spec/models/cash_analysis_request_spec.rb +103 -0
  231. data/spec/models/cash_flow_analysis_request_spec.rb +117 -0
  232. data/spec/models/children_education_config_spec.rb +47 -0
  233. data/spec/models/customer_analysis_request_spec.rb +95 -0
  234. data/spec/models/decumulation_goal_deposit_config_spec.rb +89 -0
  235. data/spec/models/dimensional_risk_score_request_spec.rb +89 -0
  236. data/spec/models/diversification_score_request_spec.rb +111 -0
  237. data/spec/models/education_calculator_annual_cost_request_spec.rb +101 -0
  238. data/spec/models/education_calculator_deposit_amount_request_spec.rb +107 -0
  239. data/spec/models/education_calculator_percent_covered_request_spec.rb +101 -0
  240. data/spec/models/education_config_spec.rb +53 -0
  241. data/spec/models/emergency_fund_calculator_request_spec.rb +141 -0
  242. data/spec/models/event_study_request_spec.rb +109 -0
  243. data/spec/models/fee_analysis_request_spec.rb +71 -0
  244. data/spec/models/financial_health_check_request_spec.rb +95 -0
  245. data/spec/models/financial_picture_request_spec.rb +89 -0
  246. data/spec/models/financial_statement_analysis_request_spec.rb +149 -0
  247. data/spec/models/goal_accumulation_allocation_request_spec.rb +215 -0
  248. data/spec/models/goal_accumulation_recommendation_request_spec.rb +173 -0
  249. data/spec/models/goal_accumulation_status_request_spec.rb +173 -0
  250. data/spec/models/goal_config_spec.rb +47 -0
  251. data/spec/models/goal_decumulation_allocation_request_spec.rb +221 -0
  252. data/spec/models/goal_decumulation_recommendation_request_spec.rb +179 -0
  253. data/spec/models/goal_decumulation_status_request_spec.rb +179 -0
  254. data/spec/models/goal_withdrawal_config_spec.rb +89 -0
  255. data/spec/models/guaranteed_rate_benefit_spec.rb +59 -0
  256. data/spec/models/income_config_spec.rb +53 -0
  257. data/spec/models/life_insurance_needs_calculator_request_spec.rb +125 -0
  258. data/spec/models/monte_carlo_request_spec.rb +179 -0
  259. data/spec/models/mortgage_calculator_down_payment_request_spec.rb +59 -0
  260. data/spec/models/mortgage_calculator_home_price_request_spec.rb +59 -0
  261. data/spec/models/mortgage_calculator_periodic_payment_request_spec.rb +59 -0
  262. data/spec/models/mvo_request_spec.rb +113 -0
  263. data/spec/models/opt_config1_spec.rb +69 -0
  264. data/spec/models/opt_config_spec.rb +81 -0
  265. data/spec/models/periods_spec.rb +47 -0
  266. data/spec/models/portfolio_optimization_score_request_spec.rb +127 -0
  267. data/spec/models/portfolio_what_if_request_spec.rb +123 -0
  268. data/spec/models/purchase_calculator_amount_request_spec.rb +93 -0
  269. data/spec/models/purchase_calculator_deposit_amount_request_spec.rb +99 -0
  270. data/spec/models/purchase_calculator_horizon_request_spec.rb +83 -0
  271. data/spec/models/ratio_targets1_spec.rb +71 -0
  272. data/spec/models/ratio_targets_spec.rb +71 -0
  273. data/spec/models/rebalancing_signal_request_spec.rb +71 -0
  274. data/spec/models/recommendation_config1_spec.rb +77 -0
  275. data/spec/models/recommendation_config_spec.rb +83 -0
  276. data/spec/models/recurring_transaction_analysis_request_spec.rb +111 -0
  277. data/spec/models/retirement_calculator_deposit_amount_request_spec.rb +113 -0
  278. data/spec/models/retirement_calculator_expenses_request_spec.rb +107 -0
  279. data/spec/models/retirement_calculator_percent_covered_request_spec.rb +107 -0
  280. data/spec/models/risk_allocation_request_spec.rb +85 -0
  281. data/spec/models/risk_score_request_spec.rb +71 -0
  282. data/spec/models/savings_calculator_request_spec.rb +99 -0
  283. data/spec/models/savings_deposit_schedule_spec.rb +63 -0
  284. data/spec/models/scenario_analysis_request_spec.rb +133 -0
  285. data/spec/models/sensitivity_analysis_request_spec.rb +133 -0
  286. data/spec/models/sensitivity_factor_spec.rb +59 -0
  287. data/spec/models/settings_spec.rb +79 -0
  288. data/spec/models/variable_annuity_request_spec.rb +209 -0
  289. data/spec/models/w_config1_spec.rb +65 -0
  290. data/spec/models/w_config_spec.rb +65 -0
  291. data/spec/spec_helper.rb +111 -0
  292. metadata +628 -0
@@ -0,0 +1,437 @@
1
+ =begin
2
+ #Hydrogen Proton API
3
+
4
+ #Financial engineering module of Hydrogen Atom
5
+
6
+ OpenAPI spec version: 1.8.0
7
+ Contact: info@hydrogenplatform.com
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.17
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module ProtonApi
16
+ class PurchaseCalculatorDepositAmountRequest
17
+ attr_accessor :purchase_amount
18
+
19
+ attr_accessor :aggregation_account_ids
20
+
21
+ attr_accessor :current_savings
22
+
23
+ attr_accessor :account_ids
24
+
25
+ attr_accessor :investment_tax
26
+
27
+ attr_accessor :purchase_horizon
28
+
29
+ attr_accessor :inflation_rate
30
+
31
+ attr_accessor :horizon_frequency_interval
32
+
33
+ attr_accessor :portfolio_return
34
+
35
+ attr_accessor :deposit_schedule
36
+
37
+ class EnumAttributeValidator
38
+ attr_reader :datatype
39
+ attr_reader :allowable_values
40
+
41
+ def initialize(datatype, allowable_values)
42
+ @allowable_values = allowable_values.map do |value|
43
+ case datatype.to_s
44
+ when /Integer/i
45
+ value.to_i
46
+ when /Float/i
47
+ value.to_f
48
+ else
49
+ value
50
+ end
51
+ end
52
+ end
53
+
54
+ def valid?(value)
55
+ !value || allowable_values.include?(value)
56
+ end
57
+ end
58
+
59
+ # Attribute mapping from ruby-style variable name to JSON key.
60
+ def self.attribute_map
61
+ {
62
+ :'purchase_amount' => :'purchase_amount',
63
+ :'aggregation_account_ids' => :'aggregation_account_ids',
64
+ :'current_savings' => :'current_savings',
65
+ :'account_ids' => :'account_ids',
66
+ :'investment_tax' => :'investment_tax',
67
+ :'purchase_horizon' => :'purchase_horizon',
68
+ :'inflation_rate' => :'inflation_rate',
69
+ :'horizon_frequency_interval' => :'horizon_frequency_interval',
70
+ :'portfolio_return' => :'portfolio_return',
71
+ :'deposit_schedule' => :'deposit_schedule'
72
+ }
73
+ end
74
+
75
+ # Attribute type mapping.
76
+ def self.swagger_types
77
+ {
78
+ :'purchase_amount' => :'Float',
79
+ :'aggregation_account_ids' => :'Array<String>',
80
+ :'current_savings' => :'Float',
81
+ :'account_ids' => :'Array<String>',
82
+ :'investment_tax' => :'Float',
83
+ :'purchase_horizon' => :'Integer',
84
+ :'inflation_rate' => :'Float',
85
+ :'horizon_frequency_interval' => :'String',
86
+ :'portfolio_return' => :'Float',
87
+ :'deposit_schedule' => :'CalculatorDepositSchedule'
88
+ }
89
+ end
90
+
91
+ # Initializes the object
92
+ # @param [Hash] attributes Model attributes in the form of hash
93
+ def initialize(attributes = {})
94
+ return unless attributes.is_a?(Hash)
95
+
96
+ # convert string to symbol for hash key
97
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
98
+
99
+ if attributes.has_key?(:'purchase_amount')
100
+ self.purchase_amount = attributes[:'purchase_amount']
101
+ end
102
+
103
+ if attributes.has_key?(:'aggregation_account_ids')
104
+ if (value = attributes[:'aggregation_account_ids']).is_a?(Array)
105
+ self.aggregation_account_ids = value
106
+ end
107
+ end
108
+
109
+ if attributes.has_key?(:'current_savings')
110
+ self.current_savings = attributes[:'current_savings']
111
+ else
112
+ self.current_savings = 0.0
113
+ end
114
+
115
+ if attributes.has_key?(:'account_ids')
116
+ if (value = attributes[:'account_ids']).is_a?(Array)
117
+ self.account_ids = value
118
+ end
119
+ end
120
+
121
+ if attributes.has_key?(:'investment_tax')
122
+ self.investment_tax = attributes[:'investment_tax']
123
+ else
124
+ self.investment_tax = 0.0
125
+ end
126
+
127
+ if attributes.has_key?(:'purchase_horizon')
128
+ self.purchase_horizon = attributes[:'purchase_horizon']
129
+ end
130
+
131
+ if attributes.has_key?(:'inflation_rate')
132
+ self.inflation_rate = attributes[:'inflation_rate']
133
+ else
134
+ self.inflation_rate = 0.0
135
+ end
136
+
137
+ if attributes.has_key?(:'horizon_frequency_interval')
138
+ self.horizon_frequency_interval = attributes[:'horizon_frequency_interval']
139
+ else
140
+ self.horizon_frequency_interval = 'year'
141
+ end
142
+
143
+ if attributes.has_key?(:'portfolio_return')
144
+ self.portfolio_return = attributes[:'portfolio_return']
145
+ end
146
+
147
+ if attributes.has_key?(:'deposit_schedule')
148
+ self.deposit_schedule = attributes[:'deposit_schedule']
149
+ end
150
+ end
151
+
152
+ # Show invalid properties with the reasons. Usually used together with valid?
153
+ # @return Array for valid properties with the reasons
154
+ def list_invalid_properties
155
+ invalid_properties = Array.new
156
+ if @purchase_amount.nil?
157
+ invalid_properties.push('invalid value for "purchase_amount", purchase_amount cannot be nil.')
158
+ end
159
+
160
+ if @purchase_amount < 0
161
+ invalid_properties.push('invalid value for "purchase_amount", must be greater than or equal to 0.')
162
+ end
163
+
164
+ if !@current_savings.nil? && @current_savings < 0
165
+ invalid_properties.push('invalid value for "current_savings", must be greater than or equal to 0.')
166
+ end
167
+
168
+ if !@investment_tax.nil? && @investment_tax > 1
169
+ invalid_properties.push('invalid value for "investment_tax", must be smaller than or equal to 1.')
170
+ end
171
+
172
+ if !@investment_tax.nil? && @investment_tax < 0
173
+ invalid_properties.push('invalid value for "investment_tax", must be greater than or equal to 0.')
174
+ end
175
+
176
+ if @purchase_horizon.nil?
177
+ invalid_properties.push('invalid value for "purchase_horizon", purchase_horizon cannot be nil.')
178
+ end
179
+
180
+ if @purchase_horizon < 0
181
+ invalid_properties.push('invalid value for "purchase_horizon", must be greater than or equal to 0.')
182
+ end
183
+
184
+ if !@inflation_rate.nil? && @inflation_rate < -1
185
+ invalid_properties.push('invalid value for "inflation_rate", must be greater than or equal to -1.')
186
+ end
187
+
188
+ if @portfolio_return.nil?
189
+ invalid_properties.push('invalid value for "portfolio_return", portfolio_return cannot be nil.')
190
+ end
191
+
192
+ if @portfolio_return < -1
193
+ invalid_properties.push('invalid value for "portfolio_return", must be greater than or equal to -1.')
194
+ end
195
+
196
+ invalid_properties
197
+ end
198
+
199
+ # Check to see if the all the properties in the model are valid
200
+ # @return true if the model is valid
201
+ def valid?
202
+ return false if @purchase_amount.nil?
203
+ return false if @purchase_amount < 0
204
+ return false if !@current_savings.nil? && @current_savings < 0
205
+ return false if !@investment_tax.nil? && @investment_tax > 1
206
+ return false if !@investment_tax.nil? && @investment_tax < 0
207
+ return false if @purchase_horizon.nil?
208
+ return false if @purchase_horizon < 0
209
+ return false if !@inflation_rate.nil? && @inflation_rate < -1
210
+ horizon_frequency_interval_validator = EnumAttributeValidator.new('String', ['year', 'quarter', 'month', 'week'])
211
+ return false unless horizon_frequency_interval_validator.valid?(@horizon_frequency_interval)
212
+ return false if @portfolio_return.nil?
213
+ return false if @portfolio_return < -1
214
+ true
215
+ end
216
+
217
+ # Custom attribute writer method with validation
218
+ # @param [Object] purchase_amount Value to be assigned
219
+ def purchase_amount=(purchase_amount)
220
+ if purchase_amount.nil?
221
+ fail ArgumentError, 'purchase_amount cannot be nil'
222
+ end
223
+
224
+ if purchase_amount < 0
225
+ fail ArgumentError, 'invalid value for "purchase_amount", must be greater than or equal to 0.'
226
+ end
227
+
228
+ @purchase_amount = purchase_amount
229
+ end
230
+
231
+ # Custom attribute writer method with validation
232
+ # @param [Object] current_savings Value to be assigned
233
+ def current_savings=(current_savings)
234
+ if !current_savings.nil? && current_savings < 0
235
+ fail ArgumentError, 'invalid value for "current_savings", must be greater than or equal to 0.'
236
+ end
237
+
238
+ @current_savings = current_savings
239
+ end
240
+
241
+ # Custom attribute writer method with validation
242
+ # @param [Object] investment_tax Value to be assigned
243
+ def investment_tax=(investment_tax)
244
+ if !investment_tax.nil? && investment_tax > 1
245
+ fail ArgumentError, 'invalid value for "investment_tax", must be smaller than or equal to 1.'
246
+ end
247
+
248
+ if !investment_tax.nil? && investment_tax < 0
249
+ fail ArgumentError, 'invalid value for "investment_tax", must be greater than or equal to 0.'
250
+ end
251
+
252
+ @investment_tax = investment_tax
253
+ end
254
+
255
+ # Custom attribute writer method with validation
256
+ # @param [Object] purchase_horizon Value to be assigned
257
+ def purchase_horizon=(purchase_horizon)
258
+ if purchase_horizon.nil?
259
+ fail ArgumentError, 'purchase_horizon cannot be nil'
260
+ end
261
+
262
+ if purchase_horizon < 0
263
+ fail ArgumentError, 'invalid value for "purchase_horizon", must be greater than or equal to 0.'
264
+ end
265
+
266
+ @purchase_horizon = purchase_horizon
267
+ end
268
+
269
+ # Custom attribute writer method with validation
270
+ # @param [Object] inflation_rate Value to be assigned
271
+ def inflation_rate=(inflation_rate)
272
+ if !inflation_rate.nil? && inflation_rate < -1
273
+ fail ArgumentError, 'invalid value for "inflation_rate", must be greater than or equal to -1.'
274
+ end
275
+
276
+ @inflation_rate = inflation_rate
277
+ end
278
+
279
+ # Custom attribute writer method checking allowed values (enum).
280
+ # @param [Object] horizon_frequency_interval Object to be assigned
281
+ def horizon_frequency_interval=(horizon_frequency_interval)
282
+ validator = EnumAttributeValidator.new('String', ['year', 'quarter', 'month', 'week'])
283
+ unless validator.valid?(horizon_frequency_interval)
284
+ fail ArgumentError, 'invalid value for "horizon_frequency_interval", must be one of #{validator.allowable_values}.'
285
+ end
286
+ @horizon_frequency_interval = horizon_frequency_interval
287
+ end
288
+
289
+ # Custom attribute writer method with validation
290
+ # @param [Object] portfolio_return Value to be assigned
291
+ def portfolio_return=(portfolio_return)
292
+ if portfolio_return.nil?
293
+ fail ArgumentError, 'portfolio_return cannot be nil'
294
+ end
295
+
296
+ if portfolio_return < -1
297
+ fail ArgumentError, 'invalid value for "portfolio_return", must be greater than or equal to -1.'
298
+ end
299
+
300
+ @portfolio_return = portfolio_return
301
+ end
302
+
303
+ # Checks equality by comparing each attribute.
304
+ # @param [Object] Object to be compared
305
+ def ==(o)
306
+ return true if self.equal?(o)
307
+ self.class == o.class &&
308
+ purchase_amount == o.purchase_amount &&
309
+ aggregation_account_ids == o.aggregation_account_ids &&
310
+ current_savings == o.current_savings &&
311
+ account_ids == o.account_ids &&
312
+ investment_tax == o.investment_tax &&
313
+ purchase_horizon == o.purchase_horizon &&
314
+ inflation_rate == o.inflation_rate &&
315
+ horizon_frequency_interval == o.horizon_frequency_interval &&
316
+ portfolio_return == o.portfolio_return &&
317
+ deposit_schedule == o.deposit_schedule
318
+ end
319
+
320
+ # @see the `==` method
321
+ # @param [Object] Object to be compared
322
+ def eql?(o)
323
+ self == o
324
+ end
325
+
326
+ # Calculates hash code according to all attributes.
327
+ # @return [Fixnum] Hash code
328
+ def hash
329
+ [purchase_amount, aggregation_account_ids, current_savings, account_ids, investment_tax, purchase_horizon, inflation_rate, horizon_frequency_interval, portfolio_return, deposit_schedule].hash
330
+ end
331
+
332
+ # Builds the object from hash
333
+ # @param [Hash] attributes Model attributes in the form of hash
334
+ # @return [Object] Returns the model itself
335
+ def build_from_hash(attributes)
336
+ return nil unless attributes.is_a?(Hash)
337
+ self.class.swagger_types.each_pair do |key, type|
338
+ if type =~ /\AArray<(.*)>/i
339
+ # check to ensure the input is an array given that the attribute
340
+ # is documented as an array but the input is not
341
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
342
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
343
+ end
344
+ elsif !attributes[self.class.attribute_map[key]].nil?
345
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
346
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
347
+ end
348
+
349
+ self
350
+ end
351
+
352
+ # Deserializes the data based on type
353
+ # @param string type Data type
354
+ # @param string value Value to be deserialized
355
+ # @return [Object] Deserialized data
356
+ def _deserialize(type, value)
357
+ case type.to_sym
358
+ when :DateTime
359
+ DateTime.parse(value)
360
+ when :Date
361
+ Date.parse(value)
362
+ when :String
363
+ value.to_s
364
+ when :Integer
365
+ value.to_i
366
+ when :Float
367
+ value.to_f
368
+ when :BOOLEAN
369
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
370
+ true
371
+ else
372
+ false
373
+ end
374
+ when :Object
375
+ # generic object (usually a Hash), return directly
376
+ value
377
+ when /\AArray<(?<inner_type>.+)>\z/
378
+ inner_type = Regexp.last_match[:inner_type]
379
+ value.map { |v| _deserialize(inner_type, v) }
380
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
381
+ k_type = Regexp.last_match[:k_type]
382
+ v_type = Regexp.last_match[:v_type]
383
+ {}.tap do |hash|
384
+ value.each do |k, v|
385
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
386
+ end
387
+ end
388
+ else # model
389
+ temp_model = ProtonApi.const_get(type).new
390
+ temp_model.build_from_hash(value)
391
+ end
392
+ end
393
+
394
+ # Returns the string representation of the object
395
+ # @return [String] String presentation of the object
396
+ def to_s
397
+ to_hash.to_s
398
+ end
399
+
400
+ # to_body is an alias to to_hash (backward compatibility)
401
+ # @return [Hash] Returns the object in the form of hash
402
+ def to_body
403
+ to_hash
404
+ end
405
+
406
+ # Returns the object in the form of hash
407
+ # @return [Hash] Returns the object in the form of hash
408
+ def to_hash
409
+ hash = {}
410
+ self.class.attribute_map.each_pair do |attr, param|
411
+ value = self.send(attr)
412
+ next if value.nil?
413
+ hash[param] = _to_hash(value)
414
+ end
415
+ hash
416
+ end
417
+
418
+ # Outputs non-array value in the form of hash
419
+ # For object, use to_hash. Otherwise, just return the value
420
+ # @param [Object] value Any valid value
421
+ # @return [Hash] Returns the value in the form of hash
422
+ def _to_hash(value)
423
+ if value.is_a?(Array)
424
+ value.compact.map { |v| _to_hash(v) }
425
+ elsif value.is_a?(Hash)
426
+ {}.tap do |hash|
427
+ value.each { |k, v| hash[k] = _to_hash(v) }
428
+ end
429
+ elsif value.respond_to? :to_hash
430
+ value.to_hash
431
+ else
432
+ value
433
+ end
434
+ end
435
+
436
+ end
437
+ end
@@ -0,0 +1,359 @@
1
+ =begin
2
+ #Hydrogen Proton API
3
+
4
+ #Financial engineering module of Hydrogen Atom
5
+
6
+ OpenAPI spec version: 1.8.0
7
+ Contact: info@hydrogenplatform.com
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.17
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module ProtonApi
16
+ class PurchaseCalculatorHorizonRequest
17
+ attr_accessor :purchase_amount
18
+
19
+ attr_accessor :aggregation_account_ids
20
+
21
+ attr_accessor :current_savings
22
+
23
+ attr_accessor :account_ids
24
+
25
+ attr_accessor :investment_tax
26
+
27
+ attr_accessor :inflation_rate
28
+
29
+ attr_accessor :portfolio_return
30
+
31
+ attr_accessor :deposit_schedule
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'purchase_amount' => :'purchase_amount',
37
+ :'aggregation_account_ids' => :'aggregation_account_ids',
38
+ :'current_savings' => :'current_savings',
39
+ :'account_ids' => :'account_ids',
40
+ :'investment_tax' => :'investment_tax',
41
+ :'inflation_rate' => :'inflation_rate',
42
+ :'portfolio_return' => :'portfolio_return',
43
+ :'deposit_schedule' => :'deposit_schedule'
44
+ }
45
+ end
46
+
47
+ # Attribute type mapping.
48
+ def self.swagger_types
49
+ {
50
+ :'purchase_amount' => :'Float',
51
+ :'aggregation_account_ids' => :'Array<String>',
52
+ :'current_savings' => :'Float',
53
+ :'account_ids' => :'Array<String>',
54
+ :'investment_tax' => :'Float',
55
+ :'inflation_rate' => :'Float',
56
+ :'portfolio_return' => :'Float',
57
+ :'deposit_schedule' => :'CalculatorDepositSchedule1'
58
+ }
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ return unless attributes.is_a?(Hash)
65
+
66
+ # convert string to symbol for hash key
67
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
68
+
69
+ if attributes.has_key?(:'purchase_amount')
70
+ self.purchase_amount = attributes[:'purchase_amount']
71
+ end
72
+
73
+ if attributes.has_key?(:'aggregation_account_ids')
74
+ if (value = attributes[:'aggregation_account_ids']).is_a?(Array)
75
+ self.aggregation_account_ids = value
76
+ end
77
+ end
78
+
79
+ if attributes.has_key?(:'current_savings')
80
+ self.current_savings = attributes[:'current_savings']
81
+ else
82
+ self.current_savings = 0.0
83
+ end
84
+
85
+ if attributes.has_key?(:'account_ids')
86
+ if (value = attributes[:'account_ids']).is_a?(Array)
87
+ self.account_ids = value
88
+ end
89
+ end
90
+
91
+ if attributes.has_key?(:'investment_tax')
92
+ self.investment_tax = attributes[:'investment_tax']
93
+ else
94
+ self.investment_tax = 0.0
95
+ end
96
+
97
+ if attributes.has_key?(:'inflation_rate')
98
+ self.inflation_rate = attributes[:'inflation_rate']
99
+ else
100
+ self.inflation_rate = 0.0
101
+ end
102
+
103
+ if attributes.has_key?(:'portfolio_return')
104
+ self.portfolio_return = attributes[:'portfolio_return']
105
+ end
106
+
107
+ if attributes.has_key?(:'deposit_schedule')
108
+ self.deposit_schedule = attributes[:'deposit_schedule']
109
+ end
110
+ end
111
+
112
+ # Show invalid properties with the reasons. Usually used together with valid?
113
+ # @return Array for valid properties with the reasons
114
+ def list_invalid_properties
115
+ invalid_properties = Array.new
116
+ if @purchase_amount.nil?
117
+ invalid_properties.push('invalid value for "purchase_amount", purchase_amount cannot be nil.')
118
+ end
119
+
120
+ if @purchase_amount < 0
121
+ invalid_properties.push('invalid value for "purchase_amount", must be greater than or equal to 0.')
122
+ end
123
+
124
+ if !@current_savings.nil? && @current_savings < 0
125
+ invalid_properties.push('invalid value for "current_savings", must be greater than or equal to 0.')
126
+ end
127
+
128
+ if !@investment_tax.nil? && @investment_tax > 1
129
+ invalid_properties.push('invalid value for "investment_tax", must be smaller than or equal to 1.')
130
+ end
131
+
132
+ if !@investment_tax.nil? && @investment_tax < 0
133
+ invalid_properties.push('invalid value for "investment_tax", must be greater than or equal to 0.')
134
+ end
135
+
136
+ if !@inflation_rate.nil? && @inflation_rate < -1
137
+ invalid_properties.push('invalid value for "inflation_rate", must be greater than or equal to -1.')
138
+ end
139
+
140
+ if @portfolio_return.nil?
141
+ invalid_properties.push('invalid value for "portfolio_return", portfolio_return cannot be nil.')
142
+ end
143
+
144
+ if @portfolio_return < -1
145
+ invalid_properties.push('invalid value for "portfolio_return", must be greater than or equal to -1.')
146
+ end
147
+
148
+ invalid_properties
149
+ end
150
+
151
+ # Check to see if the all the properties in the model are valid
152
+ # @return true if the model is valid
153
+ def valid?
154
+ return false if @purchase_amount.nil?
155
+ return false if @purchase_amount < 0
156
+ return false if !@current_savings.nil? && @current_savings < 0
157
+ return false if !@investment_tax.nil? && @investment_tax > 1
158
+ return false if !@investment_tax.nil? && @investment_tax < 0
159
+ return false if !@inflation_rate.nil? && @inflation_rate < -1
160
+ return false if @portfolio_return.nil?
161
+ return false if @portfolio_return < -1
162
+ true
163
+ end
164
+
165
+ # Custom attribute writer method with validation
166
+ # @param [Object] purchase_amount Value to be assigned
167
+ def purchase_amount=(purchase_amount)
168
+ if purchase_amount.nil?
169
+ fail ArgumentError, 'purchase_amount cannot be nil'
170
+ end
171
+
172
+ if purchase_amount < 0
173
+ fail ArgumentError, 'invalid value for "purchase_amount", must be greater than or equal to 0.'
174
+ end
175
+
176
+ @purchase_amount = purchase_amount
177
+ end
178
+
179
+ # Custom attribute writer method with validation
180
+ # @param [Object] current_savings Value to be assigned
181
+ def current_savings=(current_savings)
182
+ if !current_savings.nil? && current_savings < 0
183
+ fail ArgumentError, 'invalid value for "current_savings", must be greater than or equal to 0.'
184
+ end
185
+
186
+ @current_savings = current_savings
187
+ end
188
+
189
+ # Custom attribute writer method with validation
190
+ # @param [Object] investment_tax Value to be assigned
191
+ def investment_tax=(investment_tax)
192
+ if !investment_tax.nil? && investment_tax > 1
193
+ fail ArgumentError, 'invalid value for "investment_tax", must be smaller than or equal to 1.'
194
+ end
195
+
196
+ if !investment_tax.nil? && investment_tax < 0
197
+ fail ArgumentError, 'invalid value for "investment_tax", must be greater than or equal to 0.'
198
+ end
199
+
200
+ @investment_tax = investment_tax
201
+ end
202
+
203
+ # Custom attribute writer method with validation
204
+ # @param [Object] inflation_rate Value to be assigned
205
+ def inflation_rate=(inflation_rate)
206
+ if !inflation_rate.nil? && inflation_rate < -1
207
+ fail ArgumentError, 'invalid value for "inflation_rate", must be greater than or equal to -1.'
208
+ end
209
+
210
+ @inflation_rate = inflation_rate
211
+ end
212
+
213
+ # Custom attribute writer method with validation
214
+ # @param [Object] portfolio_return Value to be assigned
215
+ def portfolio_return=(portfolio_return)
216
+ if portfolio_return.nil?
217
+ fail ArgumentError, 'portfolio_return cannot be nil'
218
+ end
219
+
220
+ if portfolio_return < -1
221
+ fail ArgumentError, 'invalid value for "portfolio_return", must be greater than or equal to -1.'
222
+ end
223
+
224
+ @portfolio_return = portfolio_return
225
+ end
226
+
227
+ # Checks equality by comparing each attribute.
228
+ # @param [Object] Object to be compared
229
+ def ==(o)
230
+ return true if self.equal?(o)
231
+ self.class == o.class &&
232
+ purchase_amount == o.purchase_amount &&
233
+ aggregation_account_ids == o.aggregation_account_ids &&
234
+ current_savings == o.current_savings &&
235
+ account_ids == o.account_ids &&
236
+ investment_tax == o.investment_tax &&
237
+ inflation_rate == o.inflation_rate &&
238
+ portfolio_return == o.portfolio_return &&
239
+ deposit_schedule == o.deposit_schedule
240
+ end
241
+
242
+ # @see the `==` method
243
+ # @param [Object] Object to be compared
244
+ def eql?(o)
245
+ self == o
246
+ end
247
+
248
+ # Calculates hash code according to all attributes.
249
+ # @return [Fixnum] Hash code
250
+ def hash
251
+ [purchase_amount, aggregation_account_ids, current_savings, account_ids, investment_tax, inflation_rate, portfolio_return, deposit_schedule].hash
252
+ end
253
+
254
+ # Builds the object from hash
255
+ # @param [Hash] attributes Model attributes in the form of hash
256
+ # @return [Object] Returns the model itself
257
+ def build_from_hash(attributes)
258
+ return nil unless attributes.is_a?(Hash)
259
+ self.class.swagger_types.each_pair do |key, type|
260
+ if type =~ /\AArray<(.*)>/i
261
+ # check to ensure the input is an array given that the attribute
262
+ # is documented as an array but the input is not
263
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
264
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
265
+ end
266
+ elsif !attributes[self.class.attribute_map[key]].nil?
267
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
268
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
269
+ end
270
+
271
+ self
272
+ end
273
+
274
+ # Deserializes the data based on type
275
+ # @param string type Data type
276
+ # @param string value Value to be deserialized
277
+ # @return [Object] Deserialized data
278
+ def _deserialize(type, value)
279
+ case type.to_sym
280
+ when :DateTime
281
+ DateTime.parse(value)
282
+ when :Date
283
+ Date.parse(value)
284
+ when :String
285
+ value.to_s
286
+ when :Integer
287
+ value.to_i
288
+ when :Float
289
+ value.to_f
290
+ when :BOOLEAN
291
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
292
+ true
293
+ else
294
+ false
295
+ end
296
+ when :Object
297
+ # generic object (usually a Hash), return directly
298
+ value
299
+ when /\AArray<(?<inner_type>.+)>\z/
300
+ inner_type = Regexp.last_match[:inner_type]
301
+ value.map { |v| _deserialize(inner_type, v) }
302
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
303
+ k_type = Regexp.last_match[:k_type]
304
+ v_type = Regexp.last_match[:v_type]
305
+ {}.tap do |hash|
306
+ value.each do |k, v|
307
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
308
+ end
309
+ end
310
+ else # model
311
+ temp_model = ProtonApi.const_get(type).new
312
+ temp_model.build_from_hash(value)
313
+ end
314
+ end
315
+
316
+ # Returns the string representation of the object
317
+ # @return [String] String presentation of the object
318
+ def to_s
319
+ to_hash.to_s
320
+ end
321
+
322
+ # to_body is an alias to to_hash (backward compatibility)
323
+ # @return [Hash] Returns the object in the form of hash
324
+ def to_body
325
+ to_hash
326
+ end
327
+
328
+ # Returns the object in the form of hash
329
+ # @return [Hash] Returns the object in the form of hash
330
+ def to_hash
331
+ hash = {}
332
+ self.class.attribute_map.each_pair do |attr, param|
333
+ value = self.send(attr)
334
+ next if value.nil?
335
+ hash[param] = _to_hash(value)
336
+ end
337
+ hash
338
+ end
339
+
340
+ # Outputs non-array value in the form of hash
341
+ # For object, use to_hash. Otherwise, just return the value
342
+ # @param [Object] value Any valid value
343
+ # @return [Hash] Returns the value in the form of hash
344
+ def _to_hash(value)
345
+ if value.is_a?(Array)
346
+ value.compact.map { |v| _to_hash(v) }
347
+ elsif value.is_a?(Hash)
348
+ {}.tap do |hash|
349
+ value.each { |k, v| hash[k] = _to_hash(v) }
350
+ end
351
+ elsif value.respond_to? :to_hash
352
+ value.to_hash
353
+ else
354
+ value
355
+ end
356
+ end
357
+
358
+ end
359
+ end