shipeasy-sdk 2.1.0 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (171) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -0
  3. data/docs/skill/SKILL.md +6 -2
  4. data/lib/generators/shipeasy/install/USAGE +24 -0
  5. data/lib/generators/shipeasy/install/install_generator.rb +86 -0
  6. data/lib/generators/shipeasy/install/templates/initializer.rb.tt +41 -0
  7. data/lib/shipeasy/admin.rb +85 -0
  8. data/lib/shipeasy/sdk/version.rb +1 -1
  9. data/lib/shipeasy_admin/api/alert_rules_api.rb +292 -0
  10. data/lib/shipeasy_admin/api/attributes_api.rb +82 -0
  11. data/lib/shipeasy_admin/api/configs_api.rb +680 -0
  12. data/lib/shipeasy_admin/api/events_api.rb +438 -0
  13. data/lib/shipeasy_admin/api/experiments_api.rb +727 -0
  14. data/lib/shipeasy_admin/api/gates_api.rb +438 -0
  15. data/lib/shipeasy_admin/api/i18n_api.rb +507 -0
  16. data/lib/shipeasy_admin/api/killswitches_api.rb +526 -0
  17. data/lib/shipeasy_admin/api/metrics_api.rb +281 -0
  18. data/lib/shipeasy_admin/api/ops_api.rb +525 -0
  19. data/lib/shipeasy_admin/api/projects_api.rb +153 -0
  20. data/lib/shipeasy_admin/api/universes_api.rb +306 -0
  21. data/lib/shipeasy_admin/api_client.rb +441 -0
  22. data/lib/shipeasy_admin/api_error.rb +58 -0
  23. data/lib/shipeasy_admin/api_model_base.rb +88 -0
  24. data/lib/shipeasy_admin/configuration.rb +397 -0
  25. data/lib/shipeasy_admin/models/approve_event_request.rb +198 -0
  26. data/lib/shipeasy_admin/models/approve_event_response.rb +166 -0
  27. data/lib/shipeasy_admin/models/create_alert_rule_request.rb +408 -0
  28. data/lib/shipeasy_admin/models/create_alert_rule_response.rb +165 -0
  29. data/lib/shipeasy_admin/models/create_config_request.rb +280 -0
  30. data/lib/shipeasy_admin/models/create_config_response.rb +201 -0
  31. data/lib/shipeasy_admin/models/create_event_request.rb +253 -0
  32. data/lib/shipeasy_admin/models/create_event_response.rb +193 -0
  33. data/lib/shipeasy_admin/models/create_experiment_request.rb +869 -0
  34. data/lib/shipeasy_admin/models/create_experiment_request_goal_metric.rb +336 -0
  35. data/lib/shipeasy_admin/models/create_experiment_response.rb +212 -0
  36. data/lib/shipeasy_admin/models/create_gate_request.rb +529 -0
  37. data/lib/shipeasy_admin/models/create_gate_response.rb +212 -0
  38. data/lib/shipeasy_admin/models/create_i18n_profile_request.rb +188 -0
  39. data/lib/shipeasy_admin/models/create_i18n_profile_response.rb +193 -0
  40. data/lib/shipeasy_admin/models/create_killswitch_request.rb +263 -0
  41. data/lib/shipeasy_admin/models/create_killswitch_response.rb +201 -0
  42. data/lib/shipeasy_admin/models/create_metric_request.rb +415 -0
  43. data/lib/shipeasy_admin/models/create_metric_response.rb +193 -0
  44. data/lib/shipeasy_admin/models/create_ops_item_request.rb +287 -0
  45. data/lib/shipeasy_admin/models/create_ops_item_response.rb +177 -0
  46. data/lib/shipeasy_admin/models/create_universe_request.rb +289 -0
  47. data/lib/shipeasy_admin/models/create_universe_response.rb +212 -0
  48. data/lib/shipeasy_admin/models/delete_alert_rule_response.rb +188 -0
  49. data/lib/shipeasy_admin/models/delete_config_response.rb +188 -0
  50. data/lib/shipeasy_admin/models/delete_event_response.rb +189 -0
  51. data/lib/shipeasy_admin/models/delete_experiment_response.rb +188 -0
  52. data/lib/shipeasy_admin/models/delete_gate_response.rb +188 -0
  53. data/lib/shipeasy_admin/models/delete_killswitch_response.rb +188 -0
  54. data/lib/shipeasy_admin/models/delete_metric_response.rb +189 -0
  55. data/lib/shipeasy_admin/models/delete_universe_response.rb +188 -0
  56. data/lib/shipeasy_admin/models/disable_gate_response.rb +190 -0
  57. data/lib/shipeasy_admin/models/discard_config_draft_request.rb +190 -0
  58. data/lib/shipeasy_admin/models/discard_config_draft_response.rb +188 -0
  59. data/lib/shipeasy_admin/models/enable_gate_response.rb +190 -0
  60. data/lib/shipeasy_admin/models/error_response.rb +185 -0
  61. data/lib/shipeasy_admin/models/get_config_response.rb +351 -0
  62. data/lib/shipeasy_admin/models/get_current_project_response.rb +606 -0
  63. data/lib/shipeasy_admin/models/get_current_project_response_module_translations.rb +104 -0
  64. data/lib/shipeasy_admin/models/get_event_response.rb +344 -0
  65. data/lib/shipeasy_admin/models/get_experiment_response.rb +688 -0
  66. data/lib/shipeasy_admin/models/get_experiment_results_response.rb +243 -0
  67. data/lib/shipeasy_admin/models/get_experiment_results_response_experiment.rb +248 -0
  68. data/lib/shipeasy_admin/models/get_experiment_results_response_results_inner.rb +252 -0
  69. data/lib/shipeasy_admin/models/get_experiment_timeseries_response.rb +192 -0
  70. data/lib/shipeasy_admin/models/get_experiment_timeseries_response_experiment.rb +261 -0
  71. data/lib/shipeasy_admin/models/get_experiment_timeseries_response_series_inner.rb +278 -0
  72. data/lib/shipeasy_admin/models/get_killswitch_response.rb +270 -0
  73. data/lib/shipeasy_admin/models/get_metric_response.rb +378 -0
  74. data/lib/shipeasy_admin/models/get_ops_item_response.rb +349 -0
  75. data/lib/shipeasy_admin/models/link_pr_to_ops_item_request.rb +186 -0
  76. data/lib/shipeasy_admin/models/link_pr_to_ops_item_response.rb +166 -0
  77. data/lib/shipeasy_admin/models/list_alert_rules_response_inner.rb +478 -0
  78. data/lib/shipeasy_admin/models/list_alert_rules_response_inner_notify.rb +177 -0
  79. data/lib/shipeasy_admin/models/list_alert_rules_response_inner_notify_slack_channel.rb +211 -0
  80. data/lib/shipeasy_admin/models/list_attributes_response_inner.rb +176 -0
  81. data/lib/shipeasy_admin/models/list_config_activity_response_inner.rb +280 -0
  82. data/lib/shipeasy_admin/models/list_configs_response.rb +178 -0
  83. data/lib/shipeasy_admin/models/list_configs_response_data_inner.rb +351 -0
  84. data/lib/shipeasy_admin/models/list_configs_response_data_inner_drafts_value.rb +237 -0
  85. data/lib/shipeasy_admin/models/list_configs_response_data_inner_envs_value.rb +237 -0
  86. data/lib/shipeasy_admin/models/list_events_response_inner.rb +344 -0
  87. data/lib/shipeasy_admin/models/list_events_response_inner_properties_inner.rb +289 -0
  88. data/lib/shipeasy_admin/models/list_experiments_response.rb +178 -0
  89. data/lib/shipeasy_admin/models/list_experiments_response_data_inner.rb +688 -0
  90. data/lib/shipeasy_admin/models/list_experiments_response_data_inner_groups_inner.rb +258 -0
  91. data/lib/shipeasy_admin/models/list_gates_response.rb +178 -0
  92. data/lib/shipeasy_admin/models/list_gates_response_data_inner.rb +395 -0
  93. data/lib/shipeasy_admin/models/list_gates_response_data_inner_enabled.rb +104 -0
  94. data/lib/shipeasy_admin/models/list_gates_response_data_inner_rules_inner.rb +238 -0
  95. data/lib/shipeasy_admin/models/list_gates_response_data_inner_stack_inner.rb +105 -0
  96. data/lib/shipeasy_admin/models/list_gates_response_data_inner_stack_inner_one_of.rb +375 -0
  97. data/lib/shipeasy_admin/models/list_gates_response_data_inner_stack_inner_one_of1.rb +331 -0
  98. data/lib/shipeasy_admin/models/list_gates_response_data_inner_stack_inner_one_of_ramp.rb +319 -0
  99. data/lib/shipeasy_admin/models/list_i18n_drafts_response_inner.rb +272 -0
  100. data/lib/shipeasy_admin/models/list_i18n_keys_response.rb +195 -0
  101. data/lib/shipeasy_admin/models/list_i18n_keys_response_keys_inner.rb +284 -0
  102. data/lib/shipeasy_admin/models/list_i18n_profiles_response_inner.rb +224 -0
  103. data/lib/shipeasy_admin/models/list_killswitches_response.rb +178 -0
  104. data/lib/shipeasy_admin/models/list_killswitches_response_data_inner.rb +270 -0
  105. data/lib/shipeasy_admin/models/list_killswitches_response_data_inner_envs_value.rb +248 -0
  106. data/lib/shipeasy_admin/models/list_metrics_response_inner.rb +378 -0
  107. data/lib/shipeasy_admin/models/list_metrics_response_inner_query_ir.rb +295 -0
  108. data/lib/shipeasy_admin/models/list_metrics_response_inner_query_ir_agg.rb +113 -0
  109. data/lib/shipeasy_admin/models/list_metrics_response_inner_query_ir_agg_one_of.rb +188 -0
  110. data/lib/shipeasy_admin/models/list_metrics_response_inner_query_ir_agg_one_of1.rb +188 -0
  111. data/lib/shipeasy_admin/models/list_metrics_response_inner_query_ir_agg_one_of2.rb +188 -0
  112. data/lib/shipeasy_admin/models/list_metrics_response_inner_query_ir_agg_one_of3.rb +188 -0
  113. data/lib/shipeasy_admin/models/list_metrics_response_inner_query_ir_agg_one_of4.rb +188 -0
  114. data/lib/shipeasy_admin/models/list_metrics_response_inner_query_ir_agg_one_of5.rb +188 -0
  115. data/lib/shipeasy_admin/models/list_metrics_response_inner_query_ir_agg_one_of6.rb +188 -0
  116. data/lib/shipeasy_admin/models/list_metrics_response_inner_query_ir_agg_one_of7.rb +217 -0
  117. data/lib/shipeasy_admin/models/list_metrics_response_inner_query_ir_agg_one_of8.rb +233 -0
  118. data/lib/shipeasy_admin/models/list_metrics_response_inner_query_ir_agg_one_of9.rb +240 -0
  119. data/lib/shipeasy_admin/models/list_metrics_response_inner_query_ir_agg_one_of9_numerator.rb +266 -0
  120. data/lib/shipeasy_admin/models/list_metrics_response_inner_query_ir_agg_one_of9_numerator_filters_inner.rb +264 -0
  121. data/lib/shipeasy_admin/models/list_metrics_response_inner_query_ir_group_by.rb +228 -0
  122. data/lib/shipeasy_admin/models/list_ops_items_response_inner.rb +349 -0
  123. data/lib/shipeasy_admin/models/list_slack_channels_response.rb +195 -0
  124. data/lib/shipeasy_admin/models/list_slack_channels_response_channels_inner.rb +203 -0
  125. data/lib/shipeasy_admin/models/list_universes_response.rb +178 -0
  126. data/lib/shipeasy_admin/models/list_universes_response_data_inner.rb +305 -0
  127. data/lib/shipeasy_admin/models/notify_ops_request.rb +261 -0
  128. data/lib/shipeasy_admin/models/notify_ops_response.rb +193 -0
  129. data/lib/shipeasy_admin/models/publish_config_draft_request.rb +190 -0
  130. data/lib/shipeasy_admin/models/publish_config_draft_response.rb +260 -0
  131. data/lib/shipeasy_admin/models/publish_i18n_profile_request.rb +149 -0
  132. data/lib/shipeasy_admin/models/publish_i18n_profile_response.rb +404 -0
  133. data/lib/shipeasy_admin/models/push_i18n_keys_request.rb +205 -0
  134. data/lib/shipeasy_admin/models/push_i18n_keys_request_keys_inner.rb +192 -0
  135. data/lib/shipeasy_admin/models/push_i18n_keys_response.rb +261 -0
  136. data/lib/shipeasy_admin/models/reanalyze_experiment_response.rb +214 -0
  137. data/lib/shipeasy_admin/models/save_config_draft_request.rb +202 -0
  138. data/lib/shipeasy_admin/models/save_config_draft_response.rb +286 -0
  139. data/lib/shipeasy_admin/models/set_experiment_metrics_request.rb +168 -0
  140. data/lib/shipeasy_admin/models/set_experiment_metrics_request_metrics_inner.rb +216 -0
  141. data/lib/shipeasy_admin/models/set_experiment_metrics_response.rb +179 -0
  142. data/lib/shipeasy_admin/models/set_experiment_metrics_response_metrics_inner.rb +201 -0
  143. data/lib/shipeasy_admin/models/set_experiment_status_request.rb +190 -0
  144. data/lib/shipeasy_admin/models/set_experiment_status_response.rb +214 -0
  145. data/lib/shipeasy_admin/models/set_killswitch_switch_request.rb +264 -0
  146. data/lib/shipeasy_admin/models/set_killswitch_switch_response.rb +288 -0
  147. data/lib/shipeasy_admin/models/unset_killswitch_switch_request.rb +237 -0
  148. data/lib/shipeasy_admin/models/unset_killswitch_switch_response.rb +289 -0
  149. data/lib/shipeasy_admin/models/update_alert_rule_request.rb +306 -0
  150. data/lib/shipeasy_admin/models/update_alert_rule_response.rb +165 -0
  151. data/lib/shipeasy_admin/models/update_config_request.rb +198 -0
  152. data/lib/shipeasy_admin/models/update_config_response.rb +165 -0
  153. data/lib/shipeasy_admin/models/update_event_request.rb +198 -0
  154. data/lib/shipeasy_admin/models/update_event_response.rb +166 -0
  155. data/lib/shipeasy_admin/models/update_experiment_request.rb +746 -0
  156. data/lib/shipeasy_admin/models/update_experiment_response.rb +165 -0
  157. data/lib/shipeasy_admin/models/update_gate_request.rb +403 -0
  158. data/lib/shipeasy_admin/models/update_gate_response.rb +166 -0
  159. data/lib/shipeasy_admin/models/update_i18n_key_request.rb +176 -0
  160. data/lib/shipeasy_admin/models/update_i18n_key_response.rb +166 -0
  161. data/lib/shipeasy_admin/models/update_killswitch_request.rb +224 -0
  162. data/lib/shipeasy_admin/models/update_killswitch_response.rb +165 -0
  163. data/lib/shipeasy_admin/models/update_ops_item_request.rb +205 -0
  164. data/lib/shipeasy_admin/models/update_ops_item_response.rb +166 -0
  165. data/lib/shipeasy_admin/models/update_universe_request.rb +213 -0
  166. data/lib/shipeasy_admin/models/update_universe_response.rb +165 -0
  167. data/lib/shipeasy_admin/models/upsert_project_request.rb +222 -0
  168. data/lib/shipeasy_admin/models/upsert_project_response.rb +260 -0
  169. data/lib/shipeasy_admin/version.rb +15 -0
  170. data/lib/shipeasy_admin.rb +196 -0
  171. metadata +230 -2
@@ -0,0 +1,869 @@
1
+ =begin
2
+ #Shipeasy Admin API
3
+
4
+ #REST API for managing feature gates, experiments, configs, universes, and killswitches in a Shipeasy project. Authenticate with an admin SDK key (`Authorization: Bearer sdk_admin_…`) and scope every request to a project via the `X-Project-Id` header. Mint admin keys via `POST /api/admin/keys` with `type: \"admin\"`. Keys expire after 90 days; rotate with the `revoke` action.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.23.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Shipeasy::Admin::Generated
17
+ # Body for `POST /api/admin/experiments`. `name`, `universe`, and `groups` (≥2, weights sum to 10000) required.
18
+ class CreateExperimentRequest < ApiModelBase
19
+ # Stable experiment key. Single segment or `folder.name` (a-z, 0-9, `_`/`-`; max 128 chars). Used by SDKs as `Shipeasy.getExperiment(user, '<name>')`. Immutable after create.
20
+ attr_accessor :name
21
+
22
+ # Free-form description. Max 2000 chars, markdown rendered in the dashboard.
23
+ attr_accessor :description
24
+
25
+ # Hypothesis statement shown in the editor. Display-only.
26
+ attr_accessor :hypothesis
27
+
28
+ # Short tag chip rendered next to the name. Display-only.
29
+ attr_accessor :tag
30
+
31
+ # Owner email. Display-only.
32
+ attr_accessor :owner_email
33
+
34
+ # Audience label shown in the editor. Display-only.
35
+ attr_accessor :audience
36
+
37
+ # User-attribute name used as the bucketing key — e.g. `user_id` (default), `session_id`, `device_id`, or a custom attribute like `company_id` to keep a whole org on one variant. Defaults to `user_id` when omitted.
38
+ attr_accessor :bucket_by
39
+
40
+ # Optional folder name used to group items in the dashboard. Part of the SDK lookup key: an item in folder `checkout` named `new-cart` is referenced as `checkout/new-cart` from the SDK.
41
+ attr_accessor :folder
42
+
43
+ # Name of an existing universe in the project. Returns `422` if the universe doesn't exist.
44
+ attr_accessor :universe
45
+
46
+ # Optional gate name. Only callers that pass the gate are enrolled in the experiment.
47
+ attr_accessor :targeting_gate
48
+
49
+ # Share of the (gated) audience allocated to the experiment, in basis points (0–10000 = 0%–100%). `0` = unallocated. Use `allocation_percent` (0–100) below to think in percent. Immutable while the experiment is running.
50
+ attr_accessor :allocation_pct
51
+
52
+ # Allocation as a **percentage** (0–100, fractional ok). Friendlier alias for `allocation_pct`; converted to basis points server-side (e.g. `50` = 5000 bp). If both are set, `allocation_percent` wins.
53
+ attr_accessor :allocation_percent
54
+
55
+ # Hash salt for bucketing. Auto-generated if omitted. Immutable while running.
56
+ attr_accessor :salt
57
+
58
+ # Map of param-name → scalar type. Defines the shape of `groups[].params`. Example: `{ headline: 'string', show_cta: 'bool' }`.
59
+ attr_accessor :params
60
+
61
+ # Two or more variants. Weights must sum to exactly 10000 (100%). Immutable while running.
62
+ attr_accessor :groups
63
+
64
+ # p-value cutoff used by the analysis pass. Defaults to `0.05`. Values other than 0.05 require Pro plan or higher.
65
+ attr_accessor :significance_threshold
66
+
67
+ # Minimum days the experiment must run before results are considered conclusive.
68
+ attr_accessor :min_runtime_days
69
+
70
+ # Minimum exposures per group before results are considered conclusive.
71
+ attr_accessor :min_sample_size
72
+
73
+ # Enable sequential testing (always-valid p-values). Requires Premium plan or higher.
74
+ attr_accessor :sequential_testing
75
+
76
+ attr_accessor :goal_metric
77
+
78
+ # Up to 10 guardrail metrics defined inline. Each is upserted (event + metric) and attached with role=guardrail.
79
+ attr_accessor :guardrail_metrics
80
+
81
+ class EnumAttributeValidator
82
+ attr_reader :datatype
83
+ attr_reader :allowable_values
84
+
85
+ def initialize(datatype, allowable_values)
86
+ @allowable_values = allowable_values.map do |value|
87
+ case datatype.to_s
88
+ when /Integer/i
89
+ value.to_i
90
+ when /Float/i
91
+ value.to_f
92
+ else
93
+ value
94
+ end
95
+ end
96
+ end
97
+
98
+ def valid?(value)
99
+ !value || allowable_values.include?(value)
100
+ end
101
+ end
102
+
103
+ # Attribute mapping from ruby-style variable name to JSON key.
104
+ def self.attribute_map
105
+ {
106
+ :'name' => :'name',
107
+ :'description' => :'description',
108
+ :'hypothesis' => :'hypothesis',
109
+ :'tag' => :'tag',
110
+ :'owner_email' => :'owner_email',
111
+ :'audience' => :'audience',
112
+ :'bucket_by' => :'bucket_by',
113
+ :'folder' => :'folder',
114
+ :'universe' => :'universe',
115
+ :'targeting_gate' => :'targeting_gate',
116
+ :'allocation_pct' => :'allocation_pct',
117
+ :'allocation_percent' => :'allocation_percent',
118
+ :'salt' => :'salt',
119
+ :'params' => :'params',
120
+ :'groups' => :'groups',
121
+ :'significance_threshold' => :'significance_threshold',
122
+ :'min_runtime_days' => :'min_runtime_days',
123
+ :'min_sample_size' => :'min_sample_size',
124
+ :'sequential_testing' => :'sequential_testing',
125
+ :'goal_metric' => :'goal_metric',
126
+ :'guardrail_metrics' => :'guardrail_metrics'
127
+ }
128
+ end
129
+
130
+ # Returns attribute mapping this model knows about
131
+ def self.acceptable_attribute_map
132
+ attribute_map
133
+ end
134
+
135
+ # Returns all the JSON keys this model knows about
136
+ def self.acceptable_attributes
137
+ acceptable_attribute_map.values
138
+ end
139
+
140
+ # Attribute type mapping.
141
+ def self.openapi_types
142
+ {
143
+ :'name' => :'String',
144
+ :'description' => :'String',
145
+ :'hypothesis' => :'String',
146
+ :'tag' => :'String',
147
+ :'owner_email' => :'String',
148
+ :'audience' => :'String',
149
+ :'bucket_by' => :'String',
150
+ :'folder' => :'String',
151
+ :'universe' => :'String',
152
+ :'targeting_gate' => :'String',
153
+ :'allocation_pct' => :'Integer',
154
+ :'allocation_percent' => :'Float',
155
+ :'salt' => :'String',
156
+ :'params' => :'Hash<String, String>',
157
+ :'groups' => :'Array<ListExperimentsResponseDataInnerGroupsInner>',
158
+ :'significance_threshold' => :'Float',
159
+ :'min_runtime_days' => :'Integer',
160
+ :'min_sample_size' => :'Integer',
161
+ :'sequential_testing' => :'Boolean',
162
+ :'goal_metric' => :'CreateExperimentRequestGoalMetric',
163
+ :'guardrail_metrics' => :'Array<CreateExperimentRequestGoalMetric>'
164
+ }
165
+ end
166
+
167
+ # List of attributes with nullable: true
168
+ def self.openapi_nullable
169
+ Set.new([
170
+ :'description',
171
+ :'hypothesis',
172
+ :'tag',
173
+ :'owner_email',
174
+ :'audience',
175
+ :'bucket_by',
176
+ :'folder',
177
+ :'targeting_gate',
178
+ ])
179
+ end
180
+
181
+ # Initializes the object
182
+ # @param [Hash] attributes Model attributes in the form of hash
183
+ def initialize(attributes = {})
184
+ if (!attributes.is_a?(Hash))
185
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Shipeasy::Admin::Generated::CreateExperimentRequest` initialize method"
186
+ end
187
+
188
+ # check to see if the attribute exists and convert string to symbol for hash key
189
+ acceptable_attribute_map = self.class.acceptable_attribute_map
190
+ attributes = attributes.each_with_object({}) { |(k, v), h|
191
+ if (!acceptable_attribute_map.key?(k.to_sym))
192
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Shipeasy::Admin::Generated::CreateExperimentRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
193
+ end
194
+ h[k.to_sym] = v
195
+ }
196
+
197
+ if attributes.key?(:'name')
198
+ self.name = attributes[:'name']
199
+ else
200
+ self.name = nil
201
+ end
202
+
203
+ if attributes.key?(:'description')
204
+ self.description = attributes[:'description']
205
+ else
206
+ self.description = nil
207
+ end
208
+
209
+ if attributes.key?(:'hypothesis')
210
+ self.hypothesis = attributes[:'hypothesis']
211
+ else
212
+ self.hypothesis = nil
213
+ end
214
+
215
+ if attributes.key?(:'tag')
216
+ self.tag = attributes[:'tag']
217
+ else
218
+ self.tag = nil
219
+ end
220
+
221
+ if attributes.key?(:'owner_email')
222
+ self.owner_email = attributes[:'owner_email']
223
+ else
224
+ self.owner_email = nil
225
+ end
226
+
227
+ if attributes.key?(:'audience')
228
+ self.audience = attributes[:'audience']
229
+ else
230
+ self.audience = nil
231
+ end
232
+
233
+ if attributes.key?(:'bucket_by')
234
+ self.bucket_by = attributes[:'bucket_by']
235
+ else
236
+ self.bucket_by = nil
237
+ end
238
+
239
+ if attributes.key?(:'folder')
240
+ self.folder = attributes[:'folder']
241
+ end
242
+
243
+ if attributes.key?(:'universe')
244
+ self.universe = attributes[:'universe']
245
+ else
246
+ self.universe = nil
247
+ end
248
+
249
+ if attributes.key?(:'targeting_gate')
250
+ self.targeting_gate = attributes[:'targeting_gate']
251
+ else
252
+ self.targeting_gate = nil
253
+ end
254
+
255
+ if attributes.key?(:'allocation_pct')
256
+ self.allocation_pct = attributes[:'allocation_pct']
257
+ else
258
+ self.allocation_pct = 0
259
+ end
260
+
261
+ if attributes.key?(:'allocation_percent')
262
+ self.allocation_percent = attributes[:'allocation_percent']
263
+ end
264
+
265
+ if attributes.key?(:'salt')
266
+ self.salt = attributes[:'salt']
267
+ end
268
+
269
+ if attributes.key?(:'params')
270
+ if (value = attributes[:'params']).is_a?(Hash)
271
+ self.params = value
272
+ end
273
+ else
274
+ self.params = nil
275
+ end
276
+
277
+ if attributes.key?(:'groups')
278
+ if (value = attributes[:'groups']).is_a?(Array)
279
+ self.groups = value
280
+ end
281
+ else
282
+ self.groups = nil
283
+ end
284
+
285
+ if attributes.key?(:'significance_threshold')
286
+ self.significance_threshold = attributes[:'significance_threshold']
287
+ else
288
+ self.significance_threshold = 0.05
289
+ end
290
+
291
+ if attributes.key?(:'min_runtime_days')
292
+ self.min_runtime_days = attributes[:'min_runtime_days']
293
+ else
294
+ self.min_runtime_days = 0
295
+ end
296
+
297
+ if attributes.key?(:'min_sample_size')
298
+ self.min_sample_size = attributes[:'min_sample_size']
299
+ else
300
+ self.min_sample_size = 100
301
+ end
302
+
303
+ if attributes.key?(:'sequential_testing')
304
+ self.sequential_testing = attributes[:'sequential_testing']
305
+ else
306
+ self.sequential_testing = false
307
+ end
308
+
309
+ if attributes.key?(:'goal_metric')
310
+ self.goal_metric = attributes[:'goal_metric']
311
+ end
312
+
313
+ if attributes.key?(:'guardrail_metrics')
314
+ if (value = attributes[:'guardrail_metrics']).is_a?(Array)
315
+ self.guardrail_metrics = value
316
+ end
317
+ else
318
+ self.guardrail_metrics = nil
319
+ end
320
+ end
321
+
322
+ # Show invalid properties with the reasons. Usually used together with valid?
323
+ # @return Array for valid properties with the reasons
324
+ def list_invalid_properties
325
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
326
+ invalid_properties = Array.new
327
+ if @name.nil?
328
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
329
+ end
330
+
331
+ if @name.to_s.length > 128
332
+ invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 128.')
333
+ end
334
+
335
+ pattern = Regexp.new(/^[a-z0-9](?:[a-z0-9_-]*[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9_-]*[a-z0-9])?)?$/)
336
+ if @name !~ pattern
337
+ invalid_properties.push("invalid value for \"name\", must conform to the pattern #{pattern}.")
338
+ end
339
+
340
+ if @description.to_s.length > 2000
341
+ invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 2000.')
342
+ end
343
+
344
+ if @hypothesis.to_s.length > 4000
345
+ invalid_properties.push('invalid value for "hypothesis", the character length must be smaller than or equal to 4000.')
346
+ end
347
+
348
+ if @tag.to_s.length > 64
349
+ invalid_properties.push('invalid value for "tag", the character length must be smaller than or equal to 64.')
350
+ end
351
+
352
+ if @owner_email.to_s.length > 254
353
+ invalid_properties.push('invalid value for "owner_email", the character length must be smaller than or equal to 254.')
354
+ end
355
+
356
+ if @audience.to_s.length > 256
357
+ invalid_properties.push('invalid value for "audience", the character length must be smaller than or equal to 256.')
358
+ end
359
+
360
+ if @bucket_by.to_s.length > 128
361
+ invalid_properties.push('invalid value for "bucket_by", the character length must be smaller than or equal to 128.')
362
+ end
363
+
364
+ if @bucket_by.to_s.length < 1
365
+ invalid_properties.push('invalid value for "bucket_by", the character length must be greater than or equal to 1.')
366
+ end
367
+
368
+ pattern = Regexp.new(/^[a-zA-Z_][a-zA-Z0-9_]*$/)
369
+ if @bucket_by !~ pattern
370
+ invalid_properties.push("invalid value for \"bucket_by\", must conform to the pattern #{pattern}.")
371
+ end
372
+
373
+ if !@folder.nil? && @folder.to_s.length > 256
374
+ invalid_properties.push('invalid value for "folder", the character length must be smaller than or equal to 256.')
375
+ end
376
+
377
+ pattern = Regexp.new(/^[a-zA-Z0-9_-]+$/)
378
+ if !@folder.nil? && @folder !~ pattern
379
+ invalid_properties.push("invalid value for \"folder\", must conform to the pattern #{pattern}.")
380
+ end
381
+
382
+ if @universe.nil?
383
+ invalid_properties.push('invalid value for "universe", universe cannot be nil.')
384
+ end
385
+
386
+ if @universe.to_s.length < 1
387
+ invalid_properties.push('invalid value for "universe", the character length must be greater than or equal to 1.')
388
+ end
389
+
390
+ if @allocation_pct.nil?
391
+ invalid_properties.push('invalid value for "allocation_pct", allocation_pct cannot be nil.')
392
+ end
393
+
394
+ if @allocation_pct > 10000
395
+ invalid_properties.push('invalid value for "allocation_pct", must be smaller than or equal to 10000.')
396
+ end
397
+
398
+ if @allocation_pct < 0
399
+ invalid_properties.push('invalid value for "allocation_pct", must be greater than or equal to 0.')
400
+ end
401
+
402
+ if !@allocation_percent.nil? && @allocation_percent > 100
403
+ invalid_properties.push('invalid value for "allocation_percent", must be smaller than or equal to 100.')
404
+ end
405
+
406
+ if !@allocation_percent.nil? && @allocation_percent < 0
407
+ invalid_properties.push('invalid value for "allocation_percent", must be greater than or equal to 0.')
408
+ end
409
+
410
+ if !@salt.nil? && @salt.to_s.length > 64
411
+ invalid_properties.push('invalid value for "salt", the character length must be smaller than or equal to 64.')
412
+ end
413
+
414
+ if !@salt.nil? && @salt.to_s.length < 1
415
+ invalid_properties.push('invalid value for "salt", the character length must be greater than or equal to 1.')
416
+ end
417
+
418
+ if @params.nil?
419
+ invalid_properties.push('invalid value for "params", params cannot be nil.')
420
+ end
421
+
422
+ if @groups.nil?
423
+ invalid_properties.push('invalid value for "groups", groups cannot be nil.')
424
+ end
425
+
426
+ if @groups.length < 2
427
+ invalid_properties.push('invalid value for "groups", number of items must be greater than or equal to 2.')
428
+ end
429
+
430
+ if @significance_threshold.nil?
431
+ invalid_properties.push('invalid value for "significance_threshold", significance_threshold cannot be nil.')
432
+ end
433
+
434
+ if @significance_threshold > 0.5
435
+ invalid_properties.push('invalid value for "significance_threshold", must be smaller than or equal to 0.5.')
436
+ end
437
+
438
+ if @significance_threshold < 0.00010
439
+ invalid_properties.push('invalid value for "significance_threshold", must be greater than or equal to 0.00010.')
440
+ end
441
+
442
+ if @min_runtime_days.nil?
443
+ invalid_properties.push('invalid value for "min_runtime_days", min_runtime_days cannot be nil.')
444
+ end
445
+
446
+ if @min_runtime_days > 365
447
+ invalid_properties.push('invalid value for "min_runtime_days", must be smaller than or equal to 365.')
448
+ end
449
+
450
+ if @min_runtime_days < 0
451
+ invalid_properties.push('invalid value for "min_runtime_days", must be greater than or equal to 0.')
452
+ end
453
+
454
+ if @min_sample_size.nil?
455
+ invalid_properties.push('invalid value for "min_sample_size", min_sample_size cannot be nil.')
456
+ end
457
+
458
+ if @min_sample_size > 9007199254740991
459
+ invalid_properties.push('invalid value for "min_sample_size", must be smaller than or equal to 9007199254740991.')
460
+ end
461
+
462
+ if @min_sample_size < 1
463
+ invalid_properties.push('invalid value for "min_sample_size", must be greater than or equal to 1.')
464
+ end
465
+
466
+ if @sequential_testing.nil?
467
+ invalid_properties.push('invalid value for "sequential_testing", sequential_testing cannot be nil.')
468
+ end
469
+
470
+ if @guardrail_metrics.nil?
471
+ invalid_properties.push('invalid value for "guardrail_metrics", guardrail_metrics cannot be nil.')
472
+ end
473
+
474
+ if @guardrail_metrics.length > 10
475
+ invalid_properties.push('invalid value for "guardrail_metrics", number of items must be less than or equal to 10.')
476
+ end
477
+
478
+ invalid_properties
479
+ end
480
+
481
+ # Check to see if the all the properties in the model are valid
482
+ # @return true if the model is valid
483
+ def valid?
484
+ warn '[DEPRECATED] the `valid?` method is obsolete'
485
+ return false if @name.nil?
486
+ return false if @name.to_s.length > 128
487
+ return false if @name !~ Regexp.new(/^[a-z0-9](?:[a-z0-9_-]*[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9_-]*[a-z0-9])?)?$/)
488
+ return false if @description.to_s.length > 2000
489
+ return false if @hypothesis.to_s.length > 4000
490
+ return false if @tag.to_s.length > 64
491
+ return false if @owner_email.to_s.length > 254
492
+ return false if @audience.to_s.length > 256
493
+ return false if @bucket_by.to_s.length > 128
494
+ return false if @bucket_by.to_s.length < 1
495
+ return false if @bucket_by !~ Regexp.new(/^[a-zA-Z_][a-zA-Z0-9_]*$/)
496
+ return false if !@folder.nil? && @folder.to_s.length > 256
497
+ return false if !@folder.nil? && @folder !~ Regexp.new(/^[a-zA-Z0-9_-]+$/)
498
+ return false if @universe.nil?
499
+ return false if @universe.to_s.length < 1
500
+ return false if @allocation_pct.nil?
501
+ return false if @allocation_pct > 10000
502
+ return false if @allocation_pct < 0
503
+ return false if !@allocation_percent.nil? && @allocation_percent > 100
504
+ return false if !@allocation_percent.nil? && @allocation_percent < 0
505
+ return false if !@salt.nil? && @salt.to_s.length > 64
506
+ return false if !@salt.nil? && @salt.to_s.length < 1
507
+ return false if @params.nil?
508
+ return false if @groups.nil?
509
+ return false if @groups.length < 2
510
+ return false if @significance_threshold.nil?
511
+ return false if @significance_threshold > 0.5
512
+ return false if @significance_threshold < 0.00010
513
+ return false if @min_runtime_days.nil?
514
+ return false if @min_runtime_days > 365
515
+ return false if @min_runtime_days < 0
516
+ return false if @min_sample_size.nil?
517
+ return false if @min_sample_size > 9007199254740991
518
+ return false if @min_sample_size < 1
519
+ return false if @sequential_testing.nil?
520
+ return false if @guardrail_metrics.nil?
521
+ return false if @guardrail_metrics.length > 10
522
+ true
523
+ end
524
+
525
+ # Custom attribute writer method with validation
526
+ # @param [Object] name Value to be assigned
527
+ def name=(name)
528
+ if name.nil?
529
+ fail ArgumentError, 'name cannot be nil'
530
+ end
531
+
532
+ if name.to_s.length > 128
533
+ fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 128.'
534
+ end
535
+
536
+ pattern = Regexp.new(/^[a-z0-9](?:[a-z0-9_-]*[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9_-]*[a-z0-9])?)?$/)
537
+ if name !~ pattern
538
+ fail ArgumentError, "invalid value for \"name\", must conform to the pattern #{pattern}."
539
+ end
540
+
541
+ @name = name
542
+ end
543
+
544
+ # Custom attribute writer method with validation
545
+ # @param [Object] description Value to be assigned
546
+ def description=(description)
547
+ if !description.nil? && description.to_s.length > 2000
548
+ fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 2000.'
549
+ end
550
+
551
+ @description = description
552
+ end
553
+
554
+ # Custom attribute writer method with validation
555
+ # @param [Object] hypothesis Value to be assigned
556
+ def hypothesis=(hypothesis)
557
+ if !hypothesis.nil? && hypothesis.to_s.length > 4000
558
+ fail ArgumentError, 'invalid value for "hypothesis", the character length must be smaller than or equal to 4000.'
559
+ end
560
+
561
+ @hypothesis = hypothesis
562
+ end
563
+
564
+ # Custom attribute writer method with validation
565
+ # @param [Object] tag Value to be assigned
566
+ def tag=(tag)
567
+ if !tag.nil? && tag.to_s.length > 64
568
+ fail ArgumentError, 'invalid value for "tag", the character length must be smaller than or equal to 64.'
569
+ end
570
+
571
+ @tag = tag
572
+ end
573
+
574
+ # Custom attribute writer method with validation
575
+ # @param [Object] owner_email Value to be assigned
576
+ def owner_email=(owner_email)
577
+ if !owner_email.nil? && owner_email.to_s.length > 254
578
+ fail ArgumentError, 'invalid value for "owner_email", the character length must be smaller than or equal to 254.'
579
+ end
580
+
581
+ @owner_email = owner_email
582
+ end
583
+
584
+ # Custom attribute writer method with validation
585
+ # @param [Object] audience Value to be assigned
586
+ def audience=(audience)
587
+ if !audience.nil? && audience.to_s.length > 256
588
+ fail ArgumentError, 'invalid value for "audience", the character length must be smaller than or equal to 256.'
589
+ end
590
+
591
+ @audience = audience
592
+ end
593
+
594
+ # Custom attribute writer method with validation
595
+ # @param [Object] bucket_by Value to be assigned
596
+ def bucket_by=(bucket_by)
597
+ if !bucket_by.nil? && bucket_by.to_s.length > 128
598
+ fail ArgumentError, 'invalid value for "bucket_by", the character length must be smaller than or equal to 128.'
599
+ end
600
+
601
+ if !bucket_by.nil? && bucket_by.to_s.length < 1
602
+ fail ArgumentError, 'invalid value for "bucket_by", the character length must be greater than or equal to 1.'
603
+ end
604
+
605
+ pattern = Regexp.new(/^[a-zA-Z_][a-zA-Z0-9_]*$/)
606
+ if !bucket_by.nil? && bucket_by !~ pattern
607
+ fail ArgumentError, "invalid value for \"bucket_by\", must conform to the pattern #{pattern}."
608
+ end
609
+
610
+ @bucket_by = bucket_by
611
+ end
612
+
613
+ # Custom attribute writer method with validation
614
+ # @param [Object] folder Value to be assigned
615
+ def folder=(folder)
616
+ if !folder.nil? && folder.to_s.length > 256
617
+ fail ArgumentError, 'invalid value for "folder", the character length must be smaller than or equal to 256.'
618
+ end
619
+
620
+ pattern = Regexp.new(/^[a-zA-Z0-9_-]+$/)
621
+ if !folder.nil? && folder !~ pattern
622
+ fail ArgumentError, "invalid value for \"folder\", must conform to the pattern #{pattern}."
623
+ end
624
+
625
+ @folder = folder
626
+ end
627
+
628
+ # Custom attribute writer method with validation
629
+ # @param [Object] universe Value to be assigned
630
+ def universe=(universe)
631
+ if universe.nil?
632
+ fail ArgumentError, 'universe cannot be nil'
633
+ end
634
+
635
+ if universe.to_s.length < 1
636
+ fail ArgumentError, 'invalid value for "universe", the character length must be greater than or equal to 1.'
637
+ end
638
+
639
+ @universe = universe
640
+ end
641
+
642
+ # Custom attribute writer method with validation
643
+ # @param [Object] allocation_pct Value to be assigned
644
+ def allocation_pct=(allocation_pct)
645
+ if allocation_pct.nil?
646
+ fail ArgumentError, 'allocation_pct cannot be nil'
647
+ end
648
+
649
+ if allocation_pct > 10000
650
+ fail ArgumentError, 'invalid value for "allocation_pct", must be smaller than or equal to 10000.'
651
+ end
652
+
653
+ if allocation_pct < 0
654
+ fail ArgumentError, 'invalid value for "allocation_pct", must be greater than or equal to 0.'
655
+ end
656
+
657
+ @allocation_pct = allocation_pct
658
+ end
659
+
660
+ # Custom attribute writer method with validation
661
+ # @param [Object] allocation_percent Value to be assigned
662
+ def allocation_percent=(allocation_percent)
663
+ if allocation_percent.nil?
664
+ fail ArgumentError, 'allocation_percent cannot be nil'
665
+ end
666
+
667
+ if allocation_percent > 100
668
+ fail ArgumentError, 'invalid value for "allocation_percent", must be smaller than or equal to 100.'
669
+ end
670
+
671
+ if allocation_percent < 0
672
+ fail ArgumentError, 'invalid value for "allocation_percent", must be greater than or equal to 0.'
673
+ end
674
+
675
+ @allocation_percent = allocation_percent
676
+ end
677
+
678
+ # Custom attribute writer method with validation
679
+ # @param [Object] salt Value to be assigned
680
+ def salt=(salt)
681
+ if salt.nil?
682
+ fail ArgumentError, 'salt cannot be nil'
683
+ end
684
+
685
+ if salt.to_s.length > 64
686
+ fail ArgumentError, 'invalid value for "salt", the character length must be smaller than or equal to 64.'
687
+ end
688
+
689
+ if salt.to_s.length < 1
690
+ fail ArgumentError, 'invalid value for "salt", the character length must be greater than or equal to 1.'
691
+ end
692
+
693
+ @salt = salt
694
+ end
695
+
696
+ # Custom attribute writer method with validation
697
+ # @param [Object] groups Value to be assigned
698
+ def groups=(groups)
699
+ if groups.nil?
700
+ fail ArgumentError, 'groups cannot be nil'
701
+ end
702
+
703
+ if groups.length < 2
704
+ fail ArgumentError, 'invalid value for "groups", number of items must be greater than or equal to 2.'
705
+ end
706
+
707
+ @groups = groups
708
+ end
709
+
710
+ # Custom attribute writer method with validation
711
+ # @param [Object] significance_threshold Value to be assigned
712
+ def significance_threshold=(significance_threshold)
713
+ if significance_threshold.nil?
714
+ fail ArgumentError, 'significance_threshold cannot be nil'
715
+ end
716
+
717
+ if significance_threshold > 0.5
718
+ fail ArgumentError, 'invalid value for "significance_threshold", must be smaller than or equal to 0.5.'
719
+ end
720
+
721
+ if significance_threshold < 0.00010
722
+ fail ArgumentError, 'invalid value for "significance_threshold", must be greater than or equal to 0.00010.'
723
+ end
724
+
725
+ @significance_threshold = significance_threshold
726
+ end
727
+
728
+ # Custom attribute writer method with validation
729
+ # @param [Object] min_runtime_days Value to be assigned
730
+ def min_runtime_days=(min_runtime_days)
731
+ if min_runtime_days.nil?
732
+ fail ArgumentError, 'min_runtime_days cannot be nil'
733
+ end
734
+
735
+ if min_runtime_days > 365
736
+ fail ArgumentError, 'invalid value for "min_runtime_days", must be smaller than or equal to 365.'
737
+ end
738
+
739
+ if min_runtime_days < 0
740
+ fail ArgumentError, 'invalid value for "min_runtime_days", must be greater than or equal to 0.'
741
+ end
742
+
743
+ @min_runtime_days = min_runtime_days
744
+ end
745
+
746
+ # Custom attribute writer method with validation
747
+ # @param [Object] min_sample_size Value to be assigned
748
+ def min_sample_size=(min_sample_size)
749
+ if min_sample_size.nil?
750
+ fail ArgumentError, 'min_sample_size cannot be nil'
751
+ end
752
+
753
+ if min_sample_size > 9007199254740991
754
+ fail ArgumentError, 'invalid value for "min_sample_size", must be smaller than or equal to 9007199254740991.'
755
+ end
756
+
757
+ if min_sample_size < 1
758
+ fail ArgumentError, 'invalid value for "min_sample_size", must be greater than or equal to 1.'
759
+ end
760
+
761
+ @min_sample_size = min_sample_size
762
+ end
763
+
764
+ # Custom attribute writer method with validation
765
+ # @param [Object] sequential_testing Value to be assigned
766
+ def sequential_testing=(sequential_testing)
767
+ if sequential_testing.nil?
768
+ fail ArgumentError, 'sequential_testing cannot be nil'
769
+ end
770
+
771
+ @sequential_testing = sequential_testing
772
+ end
773
+
774
+ # Custom attribute writer method with validation
775
+ # @param [Object] guardrail_metrics Value to be assigned
776
+ def guardrail_metrics=(guardrail_metrics)
777
+ if guardrail_metrics.nil?
778
+ fail ArgumentError, 'guardrail_metrics cannot be nil'
779
+ end
780
+
781
+ if guardrail_metrics.length > 10
782
+ fail ArgumentError, 'invalid value for "guardrail_metrics", number of items must be less than or equal to 10.'
783
+ end
784
+
785
+ @guardrail_metrics = guardrail_metrics
786
+ end
787
+
788
+ # Checks equality by comparing each attribute.
789
+ # @param [Object] Object to be compared
790
+ def ==(o)
791
+ return true if self.equal?(o)
792
+ self.class == o.class &&
793
+ name == o.name &&
794
+ description == o.description &&
795
+ hypothesis == o.hypothesis &&
796
+ tag == o.tag &&
797
+ owner_email == o.owner_email &&
798
+ audience == o.audience &&
799
+ bucket_by == o.bucket_by &&
800
+ folder == o.folder &&
801
+ universe == o.universe &&
802
+ targeting_gate == o.targeting_gate &&
803
+ allocation_pct == o.allocation_pct &&
804
+ allocation_percent == o.allocation_percent &&
805
+ salt == o.salt &&
806
+ params == o.params &&
807
+ groups == o.groups &&
808
+ significance_threshold == o.significance_threshold &&
809
+ min_runtime_days == o.min_runtime_days &&
810
+ min_sample_size == o.min_sample_size &&
811
+ sequential_testing == o.sequential_testing &&
812
+ goal_metric == o.goal_metric &&
813
+ guardrail_metrics == o.guardrail_metrics
814
+ end
815
+
816
+ # @see the `==` method
817
+ # @param [Object] Object to be compared
818
+ def eql?(o)
819
+ self == o
820
+ end
821
+
822
+ # Calculates hash code according to all attributes.
823
+ # @return [Integer] Hash code
824
+ def hash
825
+ [name, description, hypothesis, tag, owner_email, audience, bucket_by, folder, universe, targeting_gate, allocation_pct, allocation_percent, salt, params, groups, significance_threshold, min_runtime_days, min_sample_size, sequential_testing, goal_metric, guardrail_metrics].hash
826
+ end
827
+
828
+ # Builds the object from hash
829
+ # @param [Hash] attributes Model attributes in the form of hash
830
+ # @return [Object] Returns the model itself
831
+ def self.build_from_hash(attributes)
832
+ return nil unless attributes.is_a?(Hash)
833
+ attributes = attributes.transform_keys(&:to_sym)
834
+ transformed_hash = {}
835
+ openapi_types.each_pair do |key, type|
836
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
837
+ transformed_hash["#{key}"] = nil
838
+ elsif type =~ /\AArray<(.*)>/i
839
+ # check to ensure the input is an array given that the attribute
840
+ # is documented as an array but the input is not
841
+ if attributes[attribute_map[key]].is_a?(Array)
842
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
843
+ end
844
+ elsif !attributes[attribute_map[key]].nil?
845
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
846
+ end
847
+ end
848
+ new(transformed_hash)
849
+ end
850
+
851
+ # Returns the object in the form of hash
852
+ # @return [Hash] Returns the object in the form of hash
853
+ def to_hash
854
+ hash = {}
855
+ self.class.attribute_map.each_pair do |attr, param|
856
+ value = self.send(attr)
857
+ if value.nil?
858
+ is_nullable = self.class.openapi_nullable.include?(attr)
859
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
860
+ end
861
+
862
+ hash[param] = _to_hash(value)
863
+ end
864
+ hash
865
+ end
866
+
867
+ end
868
+
869
+ end