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