hydrogen-proton-api 1.9.1
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 +82 -0
- data/Rakefile +8 -0
- data/git_push.sh +55 -0
- data/lib/proton_api.rb +141 -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 +185 -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 +347 -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/util_api.rb +185 -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 +181 -0
- data/lib/proton_api/configuration.rb +209 -0
- data/lib/proton_api/environment.rb +36 -0
- data/lib/proton_api/models/accumulation_goal_deposit_config.rb +338 -0
- data/lib/proton_api/models/annuity_calculator_accumulation_horizon_request.rb +459 -0
- data/lib/proton_api/models/annuity_calculator_annuity_amount_request.rb +461 -0
- data/lib/proton_api/models/annuity_calculator_decumulation_horizon_request.rb +459 -0
- data/lib/proton_api/models/annuity_calculator_deposit_amount_request.rb +468 -0
- data/lib/proton_api/models/annuity_calculator_initial_balance_request.rb +468 -0
- data/lib/proton_api/models/annuity_deposit_schedule.rb +254 -0
- data/lib/proton_api/models/answer.rb +186 -0
- data/lib/proton_api/models/backtest_request.rb +295 -0
- data/lib/proton_api/models/beneficiary_bequest_config.rb +257 -0
- data/lib/proton_api/models/budget_aggregation_account.rb +186 -0
- data/lib/proton_api/models/budget_calculator_request.rb +334 -0
- data/lib/proton_api/models/budget_component.rb +228 -0
- data/lib/proton_api/models/budget_details.rb +337 -0
- data/lib/proton_api/models/business_financial_health_check_request.rb +484 -0
- data/lib/proton_api/models/business_invoice_analysis_request.rb +361 -0
- data/lib/proton_api/models/calculator_deposit_schedule.rb +228 -0
- data/lib/proton_api/models/calculator_deposit_schedule1.rb +254 -0
- data/lib/proton_api/models/card_analysis_request.rb +372 -0
- data/lib/proton_api/models/card_limit_check_request.rb +231 -0
- data/lib/proton_api/models/card_transaction_authorization_request.rb +422 -0
- data/lib/proton_api/models/cash_analysis_request.rb +340 -0
- data/lib/proton_api/models/cash_flow_analysis_request.rb +366 -0
- data/lib/proton_api/models/children_education_config.rb +221 -0
- data/lib/proton_api/models/customer_analysis_request.rb +292 -0
- data/lib/proton_api/models/decision_tree_result_request.rb +236 -0
- data/lib/proton_api/models/decumulation_goal_deposit_config.rb +335 -0
- data/lib/proton_api/models/dimensional_risk_score_request.rb +282 -0
- data/lib/proton_api/models/diversification_score_request.rb +324 -0
- data/lib/proton_api/models/education_calculator_annual_cost_request.rb +450 -0
- data/lib/proton_api/models/education_calculator_deposit_amount_request.rb +483 -0
- data/lib/proton_api/models/education_calculator_percent_covered_request.rb +448 -0
- data/lib/proton_api/models/education_config.rb +271 -0
- data/lib/proton_api/models/emergency_fund_calculator_request.rb +561 -0
- data/lib/proton_api/models/event_study_request.rb +317 -0
- data/lib/proton_api/models/fee_analysis_request.rb +239 -0
- data/lib/proton_api/models/financial_health_check_request.rb +384 -0
- data/lib/proton_api/models/financial_picture_request.rb +270 -0
- data/lib/proton_api/models/financial_statement_analysis_request.rb +461 -0
- data/lib/proton_api/models/goal_accumulation_allocation_request.rb +729 -0
- data/lib/proton_api/models/goal_accumulation_recommendation_request.rb +622 -0
- data/lib/proton_api/models/goal_accumulation_status_request.rb +622 -0
- data/lib/proton_api/models/goal_config.rb +222 -0
- data/lib/proton_api/models/goal_decumulation_allocation_request.rb +764 -0
- data/lib/proton_api/models/goal_decumulation_recommendation_request.rb +657 -0
- data/lib/proton_api/models/goal_decumulation_status_request.rb +657 -0
- data/lib/proton_api/models/goal_withdrawal_config.rb +335 -0
- data/lib/proton_api/models/guaranteed_rate_benefit.rb +272 -0
- data/lib/proton_api/models/income_config.rb +266 -0
- data/lib/proton_api/models/life_insurance_needs_calculator_request.rb +515 -0
- data/lib/proton_api/models/location.rb +183 -0
- data/lib/proton_api/models/monte_carlo_request.rb +504 -0
- data/lib/proton_api/models/mortgage_calculator_down_payment_request.rb +299 -0
- data/lib/proton_api/models/mortgage_calculator_home_price_request.rb +299 -0
- data/lib/proton_api/models/mortgage_calculator_periodic_payment_request.rb +299 -0
- data/lib/proton_api/models/mvo_request.rb +366 -0
- data/lib/proton_api/models/opt_config.rb +300 -0
- data/lib/proton_api/models/opt_config1.rb +260 -0
- data/lib/proton_api/models/order_rebalance_request.rb +398 -0
- data/lib/proton_api/models/performance_calculator_request.rb +687 -0
- data/lib/proton_api/models/periods.rb +220 -0
- data/lib/proton_api/models/portfolio_optimization_score_request.rb +356 -0
- data/lib/proton_api/models/portfolio_what_if_request.rb +351 -0
- data/lib/proton_api/models/purchase_calculator_amount_request.rb +401 -0
- data/lib/proton_api/models/purchase_calculator_deposit_amount_request.rb +434 -0
- data/lib/proton_api/models/purchase_calculator_horizon_request.rb +356 -0
- data/lib/proton_api/models/ratio_targets.rb +328 -0
- data/lib/proton_api/models/ratio_targets1.rb +328 -0
- data/lib/proton_api/models/rebalancing_signal_request.rb +238 -0
- data/lib/proton_api/models/recommendation_config.rb +357 -0
- data/lib/proton_api/models/recommendation_config1.rb +346 -0
- data/lib/proton_api/models/recurring_transaction_analysis_request.rb +400 -0
- data/lib/proton_api/models/retirement_calculator_deposit_amount_request.rb +509 -0
- data/lib/proton_api/models/retirement_calculator_expenses_request.rb +476 -0
- data/lib/proton_api/models/retirement_calculator_percent_covered_request.rb +474 -0
- data/lib/proton_api/models/risk_allocation_request.rb +316 -0
- data/lib/proton_api/models/risk_score_request.rb +239 -0
- data/lib/proton_api/models/savings_calculator_request.rb +395 -0
- data/lib/proton_api/models/savings_deposit_schedule.rb +276 -0
- data/lib/proton_api/models/scenario_analysis_request.rb +401 -0
- data/lib/proton_api/models/sensitivity_analysis_request.rb +399 -0
- data/lib/proton_api/models/sensitivity_factor.rb +278 -0
- data/lib/proton_api/models/settings.rb +287 -0
- data/lib/proton_api/models/spending_analysis_request.rb +505 -0
- data/lib/proton_api/models/variable_annuity_request.rb +700 -0
- data/lib/proton_api/models/w_config.rb +382 -0
- data/lib/proton_api/models/w_config1.rb +347 -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 +71 -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 +107 -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/util_api_spec.rb +71 -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/answer_spec.rb +41 -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 +105 -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 +143 -0
- data/spec/models/business_invoice_analysis_request_spec.rb +123 -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_analysis_request_spec.rb +129 -0
- data/spec/models/card_limit_check_request_spec.rb +65 -0
- data/spec/models/card_transaction_authorization_request_spec.rb +157 -0
- data/spec/models/cash_analysis_request_spec.rb +115 -0
- data/spec/models/cash_flow_analysis_request_spec.rb +135 -0
- data/spec/models/children_education_config_spec.rb +47 -0
- data/spec/models/customer_analysis_request_spec.rb +101 -0
- data/spec/models/decision_tree_result_request_spec.rb +51 -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 +77 -0
- data/spec/models/financial_health_check_request_spec.rb +95 -0
- data/spec/models/financial_picture_request_spec.rb +95 -0
- data/spec/models/financial_statement_analysis_request_spec.rb +155 -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/location_spec.rb +41 -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/order_rebalance_request_spec.rb +123 -0
- data/spec/models/performance_calculator_request_spec.rb +233 -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 +129 -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/spending_analysis_request_spec.rb +187 -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 +561 -0
@@ -0,0 +1,700 @@
|
|
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 VariableAnnuityRequest
|
17
|
+
attr_accessor :p
|
18
|
+
|
19
|
+
attr_accessor :allocation_id
|
20
|
+
|
21
|
+
attr_accessor :decumulation_horizon
|
22
|
+
|
23
|
+
attr_accessor :accumulation_horizon
|
24
|
+
|
25
|
+
attr_accessor :annuitization_rate
|
26
|
+
|
27
|
+
attr_accessor :guaranteed_rate_benefit
|
28
|
+
|
29
|
+
attr_accessor :model_id
|
30
|
+
|
31
|
+
attr_accessor :portfolio_tickers
|
32
|
+
|
33
|
+
attr_accessor :create_log
|
34
|
+
|
35
|
+
attr_accessor :inflation_rate
|
36
|
+
|
37
|
+
attr_accessor :aggregation_account_id
|
38
|
+
|
39
|
+
attr_accessor :n
|
40
|
+
|
41
|
+
attr_accessor :guaranteed_accumulation_benefit
|
42
|
+
|
43
|
+
attr_accessor :end_date
|
44
|
+
|
45
|
+
attr_accessor :tax_rate
|
46
|
+
|
47
|
+
attr_accessor :start_date
|
48
|
+
|
49
|
+
attr_accessor :remove_outliers
|
50
|
+
|
51
|
+
attr_accessor :portfolio_weights
|
52
|
+
|
53
|
+
attr_accessor :portfolio_id
|
54
|
+
|
55
|
+
attr_accessor :result_type
|
56
|
+
|
57
|
+
attr_accessor :account_id
|
58
|
+
|
59
|
+
attr_accessor :trading_days_per_year
|
60
|
+
|
61
|
+
attr_accessor :use_proxy_data
|
62
|
+
|
63
|
+
attr_accessor :initial_balance
|
64
|
+
|
65
|
+
attr_accessor :market_data_source
|
66
|
+
|
67
|
+
attr_accessor :frequency_interval
|
68
|
+
|
69
|
+
attr_accessor :deposit_schedule
|
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
|
+
:'p' => :'p',
|
97
|
+
:'allocation_id' => :'allocation_id',
|
98
|
+
:'decumulation_horizon' => :'decumulation_horizon',
|
99
|
+
:'accumulation_horizon' => :'accumulation_horizon',
|
100
|
+
:'annuitization_rate' => :'annuitization_rate',
|
101
|
+
:'guaranteed_rate_benefit' => :'guaranteed_rate_benefit',
|
102
|
+
:'model_id' => :'model_id',
|
103
|
+
:'portfolio_tickers' => :'portfolio_tickers',
|
104
|
+
:'create_log' => :'create_log',
|
105
|
+
:'inflation_rate' => :'inflation_rate',
|
106
|
+
:'aggregation_account_id' => :'aggregation_account_id',
|
107
|
+
:'n' => :'n',
|
108
|
+
:'guaranteed_accumulation_benefit' => :'guaranteed_accumulation_benefit',
|
109
|
+
:'end_date' => :'end_date',
|
110
|
+
:'tax_rate' => :'tax_rate',
|
111
|
+
:'start_date' => :'start_date',
|
112
|
+
:'remove_outliers' => :'remove_outliers',
|
113
|
+
:'portfolio_weights' => :'portfolio_weights',
|
114
|
+
:'portfolio_id' => :'portfolio_id',
|
115
|
+
:'result_type' => :'result_type',
|
116
|
+
:'account_id' => :'account_id',
|
117
|
+
:'trading_days_per_year' => :'trading_days_per_year',
|
118
|
+
:'use_proxy_data' => :'use_proxy_data',
|
119
|
+
:'initial_balance' => :'initial_balance',
|
120
|
+
:'market_data_source' => :'market_data_source',
|
121
|
+
:'frequency_interval' => :'frequency_interval',
|
122
|
+
:'deposit_schedule' => :'deposit_schedule'
|
123
|
+
}
|
124
|
+
end
|
125
|
+
|
126
|
+
# Attribute type mapping.
|
127
|
+
def self.swagger_types
|
128
|
+
{
|
129
|
+
:'p' => :'Float',
|
130
|
+
:'allocation_id' => :'String',
|
131
|
+
:'decumulation_horizon' => :'Integer',
|
132
|
+
:'accumulation_horizon' => :'Integer',
|
133
|
+
:'annuitization_rate' => :'Float',
|
134
|
+
:'guaranteed_rate_benefit' => :'Array<GuaranteedRateBenefit>',
|
135
|
+
:'model_id' => :'String',
|
136
|
+
:'portfolio_tickers' => :'Array<String>',
|
137
|
+
:'create_log' => :'BOOLEAN',
|
138
|
+
:'inflation_rate' => :'Float',
|
139
|
+
:'aggregation_account_id' => :'String',
|
140
|
+
:'n' => :'Integer',
|
141
|
+
:'guaranteed_accumulation_benefit' => :'Float',
|
142
|
+
:'end_date' => :'String',
|
143
|
+
:'tax_rate' => :'Float',
|
144
|
+
:'start_date' => :'String',
|
145
|
+
:'remove_outliers' => :'BOOLEAN',
|
146
|
+
:'portfolio_weights' => :'Array<Float>',
|
147
|
+
:'portfolio_id' => :'String',
|
148
|
+
:'result_type' => :'String',
|
149
|
+
:'account_id' => :'String',
|
150
|
+
:'trading_days_per_year' => :'Integer',
|
151
|
+
:'use_proxy_data' => :'BOOLEAN',
|
152
|
+
:'initial_balance' => :'Float',
|
153
|
+
:'market_data_source' => :'String',
|
154
|
+
:'frequency_interval' => :'String',
|
155
|
+
:'deposit_schedule' => :'AnnuityDepositSchedule'
|
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?(:'p')
|
168
|
+
self.p = attributes[:'p']
|
169
|
+
end
|
170
|
+
|
171
|
+
if attributes.has_key?(:'allocation_id')
|
172
|
+
self.allocation_id = attributes[:'allocation_id']
|
173
|
+
end
|
174
|
+
|
175
|
+
if attributes.has_key?(:'decumulation_horizon')
|
176
|
+
self.decumulation_horizon = attributes[:'decumulation_horizon']
|
177
|
+
end
|
178
|
+
|
179
|
+
if attributes.has_key?(:'accumulation_horizon')
|
180
|
+
self.accumulation_horizon = attributes[:'accumulation_horizon']
|
181
|
+
end
|
182
|
+
|
183
|
+
if attributes.has_key?(:'annuitization_rate')
|
184
|
+
self.annuitization_rate = attributes[:'annuitization_rate']
|
185
|
+
else
|
186
|
+
self.annuitization_rate = 0.0
|
187
|
+
end
|
188
|
+
|
189
|
+
if attributes.has_key?(:'guaranteed_rate_benefit')
|
190
|
+
if (value = attributes[:'guaranteed_rate_benefit']).is_a?(Array)
|
191
|
+
self.guaranteed_rate_benefit = value
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
if attributes.has_key?(:'model_id')
|
196
|
+
self.model_id = attributes[:'model_id']
|
197
|
+
end
|
198
|
+
|
199
|
+
if attributes.has_key?(:'portfolio_tickers')
|
200
|
+
if (value = attributes[:'portfolio_tickers']).is_a?(Array)
|
201
|
+
self.portfolio_tickers = value
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
if attributes.has_key?(:'create_log')
|
206
|
+
self.create_log = attributes[:'create_log']
|
207
|
+
else
|
208
|
+
self.create_log = false
|
209
|
+
end
|
210
|
+
|
211
|
+
if attributes.has_key?(:'inflation_rate')
|
212
|
+
self.inflation_rate = attributes[:'inflation_rate']
|
213
|
+
else
|
214
|
+
self.inflation_rate = 0.0
|
215
|
+
end
|
216
|
+
|
217
|
+
if attributes.has_key?(:'aggregation_account_id')
|
218
|
+
self.aggregation_account_id = attributes[:'aggregation_account_id']
|
219
|
+
end
|
220
|
+
|
221
|
+
if attributes.has_key?(:'n')
|
222
|
+
self.n = attributes[:'n']
|
223
|
+
else
|
224
|
+
self.n = 1000
|
225
|
+
end
|
226
|
+
|
227
|
+
if attributes.has_key?(:'guaranteed_accumulation_benefit')
|
228
|
+
self.guaranteed_accumulation_benefit = attributes[:'guaranteed_accumulation_benefit']
|
229
|
+
else
|
230
|
+
self.guaranteed_accumulation_benefit = 0.0
|
231
|
+
end
|
232
|
+
|
233
|
+
if attributes.has_key?(:'end_date')
|
234
|
+
self.end_date = attributes[:'end_date']
|
235
|
+
end
|
236
|
+
|
237
|
+
if attributes.has_key?(:'tax_rate')
|
238
|
+
self.tax_rate = attributes[:'tax_rate']
|
239
|
+
else
|
240
|
+
self.tax_rate = 0.0
|
241
|
+
end
|
242
|
+
|
243
|
+
if attributes.has_key?(:'start_date')
|
244
|
+
self.start_date = attributes[:'start_date']
|
245
|
+
end
|
246
|
+
|
247
|
+
if attributes.has_key?(:'remove_outliers')
|
248
|
+
self.remove_outliers = attributes[:'remove_outliers']
|
249
|
+
else
|
250
|
+
self.remove_outliers = false
|
251
|
+
end
|
252
|
+
|
253
|
+
if attributes.has_key?(:'portfolio_weights')
|
254
|
+
if (value = attributes[:'portfolio_weights']).is_a?(Array)
|
255
|
+
self.portfolio_weights = value
|
256
|
+
end
|
257
|
+
end
|
258
|
+
|
259
|
+
if attributes.has_key?(:'portfolio_id')
|
260
|
+
self.portfolio_id = attributes[:'portfolio_id']
|
261
|
+
end
|
262
|
+
|
263
|
+
if attributes.has_key?(:'result_type')
|
264
|
+
self.result_type = attributes[:'result_type']
|
265
|
+
else
|
266
|
+
self.result_type = 'median'
|
267
|
+
end
|
268
|
+
|
269
|
+
if attributes.has_key?(:'account_id')
|
270
|
+
self.account_id = attributes[:'account_id']
|
271
|
+
end
|
272
|
+
|
273
|
+
if attributes.has_key?(:'trading_days_per_year')
|
274
|
+
self.trading_days_per_year = attributes[:'trading_days_per_year']
|
275
|
+
else
|
276
|
+
self.trading_days_per_year = 252
|
277
|
+
end
|
278
|
+
|
279
|
+
if attributes.has_key?(:'use_proxy_data')
|
280
|
+
self.use_proxy_data = attributes[:'use_proxy_data']
|
281
|
+
else
|
282
|
+
self.use_proxy_data = false
|
283
|
+
end
|
284
|
+
|
285
|
+
if attributes.has_key?(:'initial_balance')
|
286
|
+
self.initial_balance = attributes[:'initial_balance']
|
287
|
+
else
|
288
|
+
self.initial_balance = 0.0
|
289
|
+
end
|
290
|
+
|
291
|
+
if attributes.has_key?(:'market_data_source')
|
292
|
+
self.market_data_source = attributes[:'market_data_source']
|
293
|
+
else
|
294
|
+
self.market_data_source = 'nucleus'
|
295
|
+
end
|
296
|
+
|
297
|
+
if attributes.has_key?(:'frequency_interval')
|
298
|
+
self.frequency_interval = attributes[:'frequency_interval']
|
299
|
+
else
|
300
|
+
self.frequency_interval = 'year'
|
301
|
+
end
|
302
|
+
|
303
|
+
if attributes.has_key?(:'deposit_schedule')
|
304
|
+
self.deposit_schedule = attributes[:'deposit_schedule']
|
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 !@p.nil? && @p > 100
|
313
|
+
invalid_properties.push('invalid value for "p", must be smaller than or equal to 100.')
|
314
|
+
end
|
315
|
+
|
316
|
+
if !@p.nil? && @p < 0
|
317
|
+
invalid_properties.push('invalid value for "p", must be greater than or equal to 0.')
|
318
|
+
end
|
319
|
+
|
320
|
+
if @decumulation_horizon.nil?
|
321
|
+
invalid_properties.push('invalid value for "decumulation_horizon", decumulation_horizon cannot be nil.')
|
322
|
+
end
|
323
|
+
|
324
|
+
if @decumulation_horizon < 1
|
325
|
+
invalid_properties.push('invalid value for "decumulation_horizon", must be greater than or equal to 1.')
|
326
|
+
end
|
327
|
+
|
328
|
+
if @accumulation_horizon.nil?
|
329
|
+
invalid_properties.push('invalid value for "accumulation_horizon", accumulation_horizon cannot be nil.')
|
330
|
+
end
|
331
|
+
|
332
|
+
if @accumulation_horizon < 0
|
333
|
+
invalid_properties.push('invalid value for "accumulation_horizon", must be greater than or equal to 0.')
|
334
|
+
end
|
335
|
+
|
336
|
+
if !@annuitization_rate.nil? && @annuitization_rate < -1
|
337
|
+
invalid_properties.push('invalid value for "annuitization_rate", must be greater than or equal to -1.')
|
338
|
+
end
|
339
|
+
|
340
|
+
if !@inflation_rate.nil? && @inflation_rate > 20
|
341
|
+
invalid_properties.push('invalid value for "inflation_rate", must be smaller than or equal to 20.')
|
342
|
+
end
|
343
|
+
|
344
|
+
if !@inflation_rate.nil? && @inflation_rate < -1
|
345
|
+
invalid_properties.push('invalid value for "inflation_rate", must be greater than or equal to -1.')
|
346
|
+
end
|
347
|
+
|
348
|
+
if !@n.nil? && @n < 1
|
349
|
+
invalid_properties.push('invalid value for "n", must be greater than or equal to 1.')
|
350
|
+
end
|
351
|
+
|
352
|
+
if !@guaranteed_accumulation_benefit.nil? && @guaranteed_accumulation_benefit < 0
|
353
|
+
invalid_properties.push('invalid value for "guaranteed_accumulation_benefit", must be greater than or equal to 0.')
|
354
|
+
end
|
355
|
+
|
356
|
+
if !@tax_rate.nil? && @tax_rate > 1
|
357
|
+
invalid_properties.push('invalid value for "tax_rate", must be smaller than or equal to 1.')
|
358
|
+
end
|
359
|
+
|
360
|
+
if !@tax_rate.nil? && @tax_rate < 0
|
361
|
+
invalid_properties.push('invalid value for "tax_rate", must be greater than or equal to 0.')
|
362
|
+
end
|
363
|
+
|
364
|
+
if !@trading_days_per_year.nil? && @trading_days_per_year < 1
|
365
|
+
invalid_properties.push('invalid value for "trading_days_per_year", must be greater than or equal to 1.')
|
366
|
+
end
|
367
|
+
|
368
|
+
if !@initial_balance.nil? && @initial_balance < 0
|
369
|
+
invalid_properties.push('invalid value for "initial_balance", must be greater than or equal to 0.')
|
370
|
+
end
|
371
|
+
|
372
|
+
invalid_properties
|
373
|
+
end
|
374
|
+
|
375
|
+
# Check to see if the all the properties in the model are valid
|
376
|
+
# @return true if the model is valid
|
377
|
+
def valid?
|
378
|
+
return false if !@p.nil? && @p > 100
|
379
|
+
return false if !@p.nil? && @p < 0
|
380
|
+
return false if @decumulation_horizon.nil?
|
381
|
+
return false if @decumulation_horizon < 1
|
382
|
+
return false if @accumulation_horizon.nil?
|
383
|
+
return false if @accumulation_horizon < 0
|
384
|
+
return false if !@annuitization_rate.nil? && @annuitization_rate < -1
|
385
|
+
return false if !@inflation_rate.nil? && @inflation_rate > 20
|
386
|
+
return false if !@inflation_rate.nil? && @inflation_rate < -1
|
387
|
+
return false if !@n.nil? && @n < 1
|
388
|
+
return false if !@guaranteed_accumulation_benefit.nil? && @guaranteed_accumulation_benefit < 0
|
389
|
+
return false if !@tax_rate.nil? && @tax_rate > 1
|
390
|
+
return false if !@tax_rate.nil? && @tax_rate < 0
|
391
|
+
result_type_validator = EnumAttributeValidator.new('String', ['mean', 'median', 'custom'])
|
392
|
+
return false unless result_type_validator.valid?(@result_type)
|
393
|
+
return false if !@trading_days_per_year.nil? && @trading_days_per_year < 1
|
394
|
+
return false if !@initial_balance.nil? && @initial_balance < 0
|
395
|
+
market_data_source_validator = EnumAttributeValidator.new('String', ['nucleus', 'integration'])
|
396
|
+
return false unless market_data_source_validator.valid?(@market_data_source)
|
397
|
+
frequency_interval_validator = EnumAttributeValidator.new('String', ['year', 'quarter', 'month', 'week', 'day'])
|
398
|
+
return false unless frequency_interval_validator.valid?(@frequency_interval)
|
399
|
+
true
|
400
|
+
end
|
401
|
+
|
402
|
+
# Custom attribute writer method with validation
|
403
|
+
# @param [Object] p Value to be assigned
|
404
|
+
def p=(p)
|
405
|
+
if !p.nil? && p > 100
|
406
|
+
fail ArgumentError, 'invalid value for "p", must be smaller than or equal to 100.'
|
407
|
+
end
|
408
|
+
|
409
|
+
if !p.nil? && p < 0
|
410
|
+
fail ArgumentError, 'invalid value for "p", must be greater than or equal to 0.'
|
411
|
+
end
|
412
|
+
|
413
|
+
@p = p
|
414
|
+
end
|
415
|
+
|
416
|
+
# Custom attribute writer method with validation
|
417
|
+
# @param [Object] decumulation_horizon Value to be assigned
|
418
|
+
def decumulation_horizon=(decumulation_horizon)
|
419
|
+
if decumulation_horizon.nil?
|
420
|
+
fail ArgumentError, 'decumulation_horizon cannot be nil'
|
421
|
+
end
|
422
|
+
|
423
|
+
if decumulation_horizon < 1
|
424
|
+
fail ArgumentError, 'invalid value for "decumulation_horizon", must be greater than or equal to 1.'
|
425
|
+
end
|
426
|
+
|
427
|
+
@decumulation_horizon = decumulation_horizon
|
428
|
+
end
|
429
|
+
|
430
|
+
# Custom attribute writer method with validation
|
431
|
+
# @param [Object] accumulation_horizon Value to be assigned
|
432
|
+
def accumulation_horizon=(accumulation_horizon)
|
433
|
+
if accumulation_horizon.nil?
|
434
|
+
fail ArgumentError, 'accumulation_horizon cannot be nil'
|
435
|
+
end
|
436
|
+
|
437
|
+
if accumulation_horizon < 0
|
438
|
+
fail ArgumentError, 'invalid value for "accumulation_horizon", must be greater than or equal to 0.'
|
439
|
+
end
|
440
|
+
|
441
|
+
@accumulation_horizon = accumulation_horizon
|
442
|
+
end
|
443
|
+
|
444
|
+
# Custom attribute writer method with validation
|
445
|
+
# @param [Object] annuitization_rate Value to be assigned
|
446
|
+
def annuitization_rate=(annuitization_rate)
|
447
|
+
if !annuitization_rate.nil? && annuitization_rate < -1
|
448
|
+
fail ArgumentError, 'invalid value for "annuitization_rate", must be greater than or equal to -1.'
|
449
|
+
end
|
450
|
+
|
451
|
+
@annuitization_rate = annuitization_rate
|
452
|
+
end
|
453
|
+
|
454
|
+
# Custom attribute writer method with validation
|
455
|
+
# @param [Object] inflation_rate Value to be assigned
|
456
|
+
def inflation_rate=(inflation_rate)
|
457
|
+
if !inflation_rate.nil? && inflation_rate > 20
|
458
|
+
fail ArgumentError, 'invalid value for "inflation_rate", must be smaller than or equal to 20.'
|
459
|
+
end
|
460
|
+
|
461
|
+
if !inflation_rate.nil? && inflation_rate < -1
|
462
|
+
fail ArgumentError, 'invalid value for "inflation_rate", must be greater than or equal to -1.'
|
463
|
+
end
|
464
|
+
|
465
|
+
@inflation_rate = inflation_rate
|
466
|
+
end
|
467
|
+
|
468
|
+
# Custom attribute writer method with validation
|
469
|
+
# @param [Object] n Value to be assigned
|
470
|
+
def n=(n)
|
471
|
+
if !n.nil? && n < 1
|
472
|
+
fail ArgumentError, 'invalid value for "n", must be greater than or equal to 1.'
|
473
|
+
end
|
474
|
+
|
475
|
+
@n = n
|
476
|
+
end
|
477
|
+
|
478
|
+
# Custom attribute writer method with validation
|
479
|
+
# @param [Object] guaranteed_accumulation_benefit Value to be assigned
|
480
|
+
def guaranteed_accumulation_benefit=(guaranteed_accumulation_benefit)
|
481
|
+
if !guaranteed_accumulation_benefit.nil? && guaranteed_accumulation_benefit < 0
|
482
|
+
fail ArgumentError, 'invalid value for "guaranteed_accumulation_benefit", must be greater than or equal to 0.'
|
483
|
+
end
|
484
|
+
|
485
|
+
@guaranteed_accumulation_benefit = guaranteed_accumulation_benefit
|
486
|
+
end
|
487
|
+
|
488
|
+
# Custom attribute writer method with validation
|
489
|
+
# @param [Object] tax_rate Value to be assigned
|
490
|
+
def tax_rate=(tax_rate)
|
491
|
+
if !tax_rate.nil? && tax_rate > 1
|
492
|
+
fail ArgumentError, 'invalid value for "tax_rate", must be smaller than or equal to 1.'
|
493
|
+
end
|
494
|
+
|
495
|
+
if !tax_rate.nil? && tax_rate < 0
|
496
|
+
fail ArgumentError, 'invalid value for "tax_rate", must be greater than or equal to 0.'
|
497
|
+
end
|
498
|
+
|
499
|
+
@tax_rate = tax_rate
|
500
|
+
end
|
501
|
+
|
502
|
+
# Custom attribute writer method checking allowed values (enum).
|
503
|
+
# @param [Object] result_type Object to be assigned
|
504
|
+
def result_type=(result_type)
|
505
|
+
validator = EnumAttributeValidator.new('String', ['mean', 'median', 'custom'])
|
506
|
+
unless validator.valid?(result_type)
|
507
|
+
fail ArgumentError, 'invalid value for "result_type", must be one of #{validator.allowable_values}.'
|
508
|
+
end
|
509
|
+
@result_type = result_type
|
510
|
+
end
|
511
|
+
|
512
|
+
# Custom attribute writer method with validation
|
513
|
+
# @param [Object] trading_days_per_year Value to be assigned
|
514
|
+
def trading_days_per_year=(trading_days_per_year)
|
515
|
+
if !trading_days_per_year.nil? && trading_days_per_year < 1
|
516
|
+
fail ArgumentError, 'invalid value for "trading_days_per_year", must be greater than or equal to 1.'
|
517
|
+
end
|
518
|
+
|
519
|
+
@trading_days_per_year = trading_days_per_year
|
520
|
+
end
|
521
|
+
|
522
|
+
# Custom attribute writer method with validation
|
523
|
+
# @param [Object] initial_balance Value to be assigned
|
524
|
+
def initial_balance=(initial_balance)
|
525
|
+
if !initial_balance.nil? && initial_balance < 0
|
526
|
+
fail ArgumentError, 'invalid value for "initial_balance", must be greater than or equal to 0.'
|
527
|
+
end
|
528
|
+
|
529
|
+
@initial_balance = initial_balance
|
530
|
+
end
|
531
|
+
|
532
|
+
# Custom attribute writer method checking allowed values (enum).
|
533
|
+
# @param [Object] market_data_source Object to be assigned
|
534
|
+
def market_data_source=(market_data_source)
|
535
|
+
validator = EnumAttributeValidator.new('String', ['nucleus', 'integration'])
|
536
|
+
unless validator.valid?(market_data_source)
|
537
|
+
fail ArgumentError, 'invalid value for "market_data_source", must be one of #{validator.allowable_values}.'
|
538
|
+
end
|
539
|
+
@market_data_source = market_data_source
|
540
|
+
end
|
541
|
+
|
542
|
+
# Custom attribute writer method checking allowed values (enum).
|
543
|
+
# @param [Object] frequency_interval Object to be assigned
|
544
|
+
def frequency_interval=(frequency_interval)
|
545
|
+
validator = EnumAttributeValidator.new('String', ['year', 'quarter', 'month', 'week', 'day'])
|
546
|
+
unless validator.valid?(frequency_interval)
|
547
|
+
fail ArgumentError, 'invalid value for "frequency_interval", must be one of #{validator.allowable_values}.'
|
548
|
+
end
|
549
|
+
@frequency_interval = frequency_interval
|
550
|
+
end
|
551
|
+
|
552
|
+
# Checks equality by comparing each attribute.
|
553
|
+
# @param [Object] Object to be compared
|
554
|
+
def ==(o)
|
555
|
+
return true if self.equal?(o)
|
556
|
+
self.class == o.class &&
|
557
|
+
p == o.p &&
|
558
|
+
allocation_id == o.allocation_id &&
|
559
|
+
decumulation_horizon == o.decumulation_horizon &&
|
560
|
+
accumulation_horizon == o.accumulation_horizon &&
|
561
|
+
annuitization_rate == o.annuitization_rate &&
|
562
|
+
guaranteed_rate_benefit == o.guaranteed_rate_benefit &&
|
563
|
+
model_id == o.model_id &&
|
564
|
+
portfolio_tickers == o.portfolio_tickers &&
|
565
|
+
create_log == o.create_log &&
|
566
|
+
inflation_rate == o.inflation_rate &&
|
567
|
+
aggregation_account_id == o.aggregation_account_id &&
|
568
|
+
n == o.n &&
|
569
|
+
guaranteed_accumulation_benefit == o.guaranteed_accumulation_benefit &&
|
570
|
+
end_date == o.end_date &&
|
571
|
+
tax_rate == o.tax_rate &&
|
572
|
+
start_date == o.start_date &&
|
573
|
+
remove_outliers == o.remove_outliers &&
|
574
|
+
portfolio_weights == o.portfolio_weights &&
|
575
|
+
portfolio_id == o.portfolio_id &&
|
576
|
+
result_type == o.result_type &&
|
577
|
+
account_id == o.account_id &&
|
578
|
+
trading_days_per_year == o.trading_days_per_year &&
|
579
|
+
use_proxy_data == o.use_proxy_data &&
|
580
|
+
initial_balance == o.initial_balance &&
|
581
|
+
market_data_source == o.market_data_source &&
|
582
|
+
frequency_interval == o.frequency_interval &&
|
583
|
+
deposit_schedule == o.deposit_schedule
|
584
|
+
end
|
585
|
+
|
586
|
+
# @see the `==` method
|
587
|
+
# @param [Object] Object to be compared
|
588
|
+
def eql?(o)
|
589
|
+
self == o
|
590
|
+
end
|
591
|
+
|
592
|
+
# Calculates hash code according to all attributes.
|
593
|
+
# @return [Fixnum] Hash code
|
594
|
+
def hash
|
595
|
+
[p, allocation_id, decumulation_horizon, accumulation_horizon, annuitization_rate, guaranteed_rate_benefit, model_id, portfolio_tickers, create_log, inflation_rate, aggregation_account_id, n, guaranteed_accumulation_benefit, end_date, tax_rate, start_date, remove_outliers, portfolio_weights, portfolio_id, result_type, account_id, trading_days_per_year, use_proxy_data, initial_balance, market_data_source, frequency_interval, deposit_schedule].hash
|
596
|
+
end
|
597
|
+
|
598
|
+
# Builds the object from hash
|
599
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
600
|
+
# @return [Object] Returns the model itself
|
601
|
+
def build_from_hash(attributes)
|
602
|
+
return nil unless attributes.is_a?(Hash)
|
603
|
+
self.class.swagger_types.each_pair do |key, type|
|
604
|
+
if type =~ /\AArray<(.*)>/i
|
605
|
+
# check to ensure the input is an array given that the attribute
|
606
|
+
# is documented as an array but the input is not
|
607
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
608
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
609
|
+
end
|
610
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
611
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
612
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
613
|
+
end
|
614
|
+
|
615
|
+
self
|
616
|
+
end
|
617
|
+
# Deserializes the data based on type
|
618
|
+
# @param string type Data type
|
619
|
+
# @param string value Value to be deserialized
|
620
|
+
# @return [Object] Deserialized data
|
621
|
+
def _deserialize(type, value)
|
622
|
+
case type.to_sym
|
623
|
+
when :DateTime
|
624
|
+
value
|
625
|
+
when :Date
|
626
|
+
value
|
627
|
+
when :String
|
628
|
+
value.to_s
|
629
|
+
when :Integer
|
630
|
+
value.to_i
|
631
|
+
when :Float
|
632
|
+
value.to_f
|
633
|
+
when :BOOLEAN
|
634
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
635
|
+
true
|
636
|
+
else
|
637
|
+
false
|
638
|
+
end
|
639
|
+
when :Object
|
640
|
+
# generic object (usually a Hash), return directly
|
641
|
+
value
|
642
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
643
|
+
inner_type = Regexp.last_match[:inner_type]
|
644
|
+
value.map { |v| _deserialize(inner_type, v) }
|
645
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
646
|
+
k_type = Regexp.last_match[:k_type]
|
647
|
+
v_type = Regexp.last_match[:v_type]
|
648
|
+
{}.tap do |hash|
|
649
|
+
value.each do |k, v|
|
650
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
651
|
+
end
|
652
|
+
end
|
653
|
+
else # model
|
654
|
+
temp_model = ProtonApi.const_get(type).new
|
655
|
+
temp_model.build_from_hash(value)
|
656
|
+
end
|
657
|
+
end
|
658
|
+
# Returns the string representation of the object
|
659
|
+
# @return [String] String presentation of the object
|
660
|
+
def to_s
|
661
|
+
to_hash.to_s
|
662
|
+
end
|
663
|
+
|
664
|
+
# to_body is an alias to to_hash (backward compatibility)
|
665
|
+
# @return [Hash] Returns the object in the form of hash
|
666
|
+
def to_body
|
667
|
+
to_hash
|
668
|
+
end
|
669
|
+
|
670
|
+
# Returns the object in the form of hash
|
671
|
+
# @return [Hash] Returns the object in the form of hash
|
672
|
+
def to_hash
|
673
|
+
hash = {}
|
674
|
+
self.class.attribute_map.each_pair do |attr, param|
|
675
|
+
value = self.send(attr)
|
676
|
+
next if value.nil?
|
677
|
+
hash[param] = _to_hash(value)
|
678
|
+
end
|
679
|
+
hash
|
680
|
+
end
|
681
|
+
# Outputs non-array value in the form of hash
|
682
|
+
# For object, use to_hash. Otherwise, just return the value
|
683
|
+
# @param [Object] value Any valid value
|
684
|
+
# @return [Hash] Returns the value in the form of hash
|
685
|
+
def _to_hash(value)
|
686
|
+
if value.is_a?(Array)
|
687
|
+
value.compact.map { |v| _to_hash(v) }
|
688
|
+
elsif value.is_a?(Hash)
|
689
|
+
{}.tap do |hash|
|
690
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
691
|
+
end
|
692
|
+
elsif value.respond_to? :to_hash
|
693
|
+
value.to_hash
|
694
|
+
else
|
695
|
+
value
|
696
|
+
end
|
697
|
+
end
|
698
|
+
|
699
|
+
end
|
700
|
+
end
|