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,165 @@
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
+ class UpdateExperimentResponse < ApiModelBase
18
+ # Experiment id that was updated.
19
+ attr_accessor :id
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'id' => :'id'
25
+ }
26
+ end
27
+
28
+ # Returns attribute mapping this model knows about
29
+ def self.acceptable_attribute_map
30
+ attribute_map
31
+ end
32
+
33
+ # Returns all the JSON keys this model knows about
34
+ def self.acceptable_attributes
35
+ acceptable_attribute_map.values
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.openapi_types
40
+ {
41
+ :'id' => :'String'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ ])
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ if (!attributes.is_a?(Hash))
55
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Shipeasy::Admin::Generated::UpdateExperimentResponse` initialize method"
56
+ end
57
+
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ acceptable_attribute_map = self.class.acceptable_attribute_map
60
+ attributes = attributes.each_with_object({}) { |(k, v), h|
61
+ if (!acceptable_attribute_map.key?(k.to_sym))
62
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Shipeasy::Admin::Generated::UpdateExperimentResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
63
+ end
64
+ h[k.to_sym] = v
65
+ }
66
+
67
+ if attributes.key?(:'id')
68
+ self.id = attributes[:'id']
69
+ else
70
+ self.id = nil
71
+ end
72
+ end
73
+
74
+ # Show invalid properties with the reasons. Usually used together with valid?
75
+ # @return Array for valid properties with the reasons
76
+ def list_invalid_properties
77
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
78
+ invalid_properties = Array.new
79
+ if @id.nil?
80
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
81
+ end
82
+
83
+ invalid_properties
84
+ end
85
+
86
+ # Check to see if the all the properties in the model are valid
87
+ # @return true if the model is valid
88
+ def valid?
89
+ warn '[DEPRECATED] the `valid?` method is obsolete'
90
+ return false if @id.nil?
91
+ true
92
+ end
93
+
94
+ # Custom attribute writer method with validation
95
+ # @param [Object] id Value to be assigned
96
+ def id=(id)
97
+ if id.nil?
98
+ fail ArgumentError, 'id cannot be nil'
99
+ end
100
+
101
+ @id = id
102
+ end
103
+
104
+ # Checks equality by comparing each attribute.
105
+ # @param [Object] Object to be compared
106
+ def ==(o)
107
+ return true if self.equal?(o)
108
+ self.class == o.class &&
109
+ id == o.id
110
+ end
111
+
112
+ # @see the `==` method
113
+ # @param [Object] Object to be compared
114
+ def eql?(o)
115
+ self == o
116
+ end
117
+
118
+ # Calculates hash code according to all attributes.
119
+ # @return [Integer] Hash code
120
+ def hash
121
+ [id].hash
122
+ end
123
+
124
+ # Builds the object from hash
125
+ # @param [Hash] attributes Model attributes in the form of hash
126
+ # @return [Object] Returns the model itself
127
+ def self.build_from_hash(attributes)
128
+ return nil unless attributes.is_a?(Hash)
129
+ attributes = attributes.transform_keys(&:to_sym)
130
+ transformed_hash = {}
131
+ openapi_types.each_pair do |key, type|
132
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
133
+ transformed_hash["#{key}"] = nil
134
+ elsif type =~ /\AArray<(.*)>/i
135
+ # check to ensure the input is an array given that the attribute
136
+ # is documented as an array but the input is not
137
+ if attributes[attribute_map[key]].is_a?(Array)
138
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
139
+ end
140
+ elsif !attributes[attribute_map[key]].nil?
141
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
142
+ end
143
+ end
144
+ new(transformed_hash)
145
+ end
146
+
147
+ # Returns the object in the form of hash
148
+ # @return [Hash] Returns the object in the form of hash
149
+ def to_hash
150
+ hash = {}
151
+ self.class.attribute_map.each_pair do |attr, param|
152
+ value = self.send(attr)
153
+ if value.nil?
154
+ is_nullable = self.class.openapi_nullable.include?(attr)
155
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
156
+ end
157
+
158
+ hash[param] = _to_hash(value)
159
+ end
160
+ hash
161
+ end
162
+
163
+ end
164
+
165
+ end
@@ -0,0 +1,403 @@
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 `PATCH /api/admin/gates/{id}`. Partial — only supplied fields change. Array fields (`rules`, `stack`) replace, not merge.
18
+ class UpdateGateRequest < ApiModelBase
19
+ # New rollout in **basis points** (0–10000 = 0%–100%) — `100` here means **1%**. Use `rollout_percent` (0–100) below for percent. Omit both to leave unchanged.
20
+ attr_accessor :rollout_pct
21
+
22
+ # New rollout as a **percentage** (0–100). Friendlier alias for `rollout_pct`; converted internally. Wins over `rollout_pct` if both are supplied. Omit both to leave unchanged.
23
+ attr_accessor :rollout_percent
24
+
25
+ # Replaces the rule list wholesale. To add a value to an `in` rule, send the full new `rules` array with the augmented `value` (e.g. previous `['US','CA']` → `['US','CA','GB']`).
26
+ attr_accessor :rules
27
+
28
+ # Master switch. `false` makes the gate evaluate to `false` for every caller regardless of `rollout_pct`, `rules`, or `stack` — use as kill switch.
29
+ attr_accessor :enabled
30
+
31
+ # Replaces the gatekeeper stack wholesale. Send `null` to revert to flat `rules` + `rollout_pct` evaluation.
32
+ attr_accessor :stack
33
+
34
+ # Human-readable title shown in the dashboard. Free-form, no key format constraint.
35
+ attr_accessor :title
36
+
37
+ # Long-form description / runbook. Markdown is rendered in the dashboard.
38
+ attr_accessor :description
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
+ # Group label for dashboard organisation (e.g. team or product area).
44
+ attr_accessor :group
45
+
46
+ # Owner contact. Displayed verbatim; not used for auth.
47
+ attr_accessor :owner_email
48
+
49
+ # Attribute mapping from ruby-style variable name to JSON key.
50
+ def self.attribute_map
51
+ {
52
+ :'rollout_pct' => :'rollout_pct',
53
+ :'rollout_percent' => :'rollout_percent',
54
+ :'rules' => :'rules',
55
+ :'enabled' => :'enabled',
56
+ :'stack' => :'stack',
57
+ :'title' => :'title',
58
+ :'description' => :'description',
59
+ :'folder' => :'folder',
60
+ :'group' => :'group',
61
+ :'owner_email' => :'owner_email'
62
+ }
63
+ end
64
+
65
+ # Returns attribute mapping this model knows about
66
+ def self.acceptable_attribute_map
67
+ attribute_map
68
+ end
69
+
70
+ # Returns all the JSON keys this model knows about
71
+ def self.acceptable_attributes
72
+ acceptable_attribute_map.values
73
+ end
74
+
75
+ # Attribute type mapping.
76
+ def self.openapi_types
77
+ {
78
+ :'rollout_pct' => :'Integer',
79
+ :'rollout_percent' => :'Float',
80
+ :'rules' => :'Array<ListGatesResponseDataInnerRulesInner>',
81
+ :'enabled' => :'Boolean',
82
+ :'stack' => :'Array<ListGatesResponseDataInnerStackInner>',
83
+ :'title' => :'String',
84
+ :'description' => :'String',
85
+ :'folder' => :'String',
86
+ :'group' => :'String',
87
+ :'owner_email' => :'String'
88
+ }
89
+ end
90
+
91
+ # List of attributes with nullable: true
92
+ def self.openapi_nullable
93
+ Set.new([
94
+ :'stack',
95
+ :'folder',
96
+ ])
97
+ end
98
+
99
+ # Initializes the object
100
+ # @param [Hash] attributes Model attributes in the form of hash
101
+ def initialize(attributes = {})
102
+ if (!attributes.is_a?(Hash))
103
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Shipeasy::Admin::Generated::UpdateGateRequest` initialize method"
104
+ end
105
+
106
+ # check to see if the attribute exists and convert string to symbol for hash key
107
+ acceptable_attribute_map = self.class.acceptable_attribute_map
108
+ attributes = attributes.each_with_object({}) { |(k, v), h|
109
+ if (!acceptable_attribute_map.key?(k.to_sym))
110
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Shipeasy::Admin::Generated::UpdateGateRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
111
+ end
112
+ h[k.to_sym] = v
113
+ }
114
+
115
+ if attributes.key?(:'rollout_pct')
116
+ self.rollout_pct = attributes[:'rollout_pct']
117
+ end
118
+
119
+ if attributes.key?(:'rollout_percent')
120
+ self.rollout_percent = attributes[:'rollout_percent']
121
+ end
122
+
123
+ if attributes.key?(:'rules')
124
+ if (value = attributes[:'rules']).is_a?(Array)
125
+ self.rules = value
126
+ end
127
+ end
128
+
129
+ if attributes.key?(:'enabled')
130
+ self.enabled = attributes[:'enabled']
131
+ end
132
+
133
+ if attributes.key?(:'stack')
134
+ if (value = attributes[:'stack']).is_a?(Array)
135
+ self.stack = value
136
+ end
137
+ end
138
+
139
+ if attributes.key?(:'title')
140
+ self.title = attributes[:'title']
141
+ end
142
+
143
+ if attributes.key?(:'description')
144
+ self.description = attributes[:'description']
145
+ end
146
+
147
+ if attributes.key?(:'folder')
148
+ self.folder = attributes[:'folder']
149
+ end
150
+
151
+ if attributes.key?(:'group')
152
+ self.group = attributes[:'group']
153
+ end
154
+
155
+ if attributes.key?(:'owner_email')
156
+ self.owner_email = attributes[:'owner_email']
157
+ end
158
+ end
159
+
160
+ # Show invalid properties with the reasons. Usually used together with valid?
161
+ # @return Array for valid properties with the reasons
162
+ def list_invalid_properties
163
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
164
+ invalid_properties = Array.new
165
+ if !@rollout_pct.nil? && @rollout_pct > 10000
166
+ invalid_properties.push('invalid value for "rollout_pct", must be smaller than or equal to 10000.')
167
+ end
168
+
169
+ if !@rollout_pct.nil? && @rollout_pct < 0
170
+ invalid_properties.push('invalid value for "rollout_pct", must be greater than or equal to 0.')
171
+ end
172
+
173
+ if !@rollout_percent.nil? && @rollout_percent > 100
174
+ invalid_properties.push('invalid value for "rollout_percent", must be smaller than or equal to 100.')
175
+ end
176
+
177
+ if !@rollout_percent.nil? && @rollout_percent < 0
178
+ invalid_properties.push('invalid value for "rollout_percent", must be greater than or equal to 0.')
179
+ end
180
+
181
+ if !@title.nil? && @title.to_s.length > 140
182
+ invalid_properties.push('invalid value for "title", the character length must be smaller than or equal to 140.')
183
+ end
184
+
185
+ if !@description.nil? && @description.to_s.length > 2000
186
+ invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 2000.')
187
+ end
188
+
189
+ if !@folder.nil? && @folder.to_s.length > 256
190
+ invalid_properties.push('invalid value for "folder", the character length must be smaller than or equal to 256.')
191
+ end
192
+
193
+ pattern = Regexp.new(/^[a-zA-Z0-9_-]+$/)
194
+ if !@folder.nil? && @folder !~ pattern
195
+ invalid_properties.push("invalid value for \"folder\", must conform to the pattern #{pattern}.")
196
+ end
197
+
198
+ if !@group.nil? && @group.to_s.length > 64
199
+ invalid_properties.push('invalid value for "group", the character length must be smaller than or equal to 64.')
200
+ end
201
+
202
+ if !@owner_email.nil? && @owner_email.to_s.length > 190
203
+ invalid_properties.push('invalid value for "owner_email", the character length must be smaller than or equal to 190.')
204
+ end
205
+
206
+ invalid_properties
207
+ end
208
+
209
+ # Check to see if the all the properties in the model are valid
210
+ # @return true if the model is valid
211
+ def valid?
212
+ warn '[DEPRECATED] the `valid?` method is obsolete'
213
+ return false if !@rollout_pct.nil? && @rollout_pct > 10000
214
+ return false if !@rollout_pct.nil? && @rollout_pct < 0
215
+ return false if !@rollout_percent.nil? && @rollout_percent > 100
216
+ return false if !@rollout_percent.nil? && @rollout_percent < 0
217
+ return false if !@title.nil? && @title.to_s.length > 140
218
+ return false if !@description.nil? && @description.to_s.length > 2000
219
+ return false if !@folder.nil? && @folder.to_s.length > 256
220
+ return false if !@folder.nil? && @folder !~ Regexp.new(/^[a-zA-Z0-9_-]+$/)
221
+ return false if !@group.nil? && @group.to_s.length > 64
222
+ return false if !@owner_email.nil? && @owner_email.to_s.length > 190
223
+ true
224
+ end
225
+
226
+ # Custom attribute writer method with validation
227
+ # @param [Object] rollout_pct Value to be assigned
228
+ def rollout_pct=(rollout_pct)
229
+ if rollout_pct.nil?
230
+ fail ArgumentError, 'rollout_pct cannot be nil'
231
+ end
232
+
233
+ if rollout_pct > 10000
234
+ fail ArgumentError, 'invalid value for "rollout_pct", must be smaller than or equal to 10000.'
235
+ end
236
+
237
+ if rollout_pct < 0
238
+ fail ArgumentError, 'invalid value for "rollout_pct", must be greater than or equal to 0.'
239
+ end
240
+
241
+ @rollout_pct = rollout_pct
242
+ end
243
+
244
+ # Custom attribute writer method with validation
245
+ # @param [Object] rollout_percent Value to be assigned
246
+ def rollout_percent=(rollout_percent)
247
+ if rollout_percent.nil?
248
+ fail ArgumentError, 'rollout_percent cannot be nil'
249
+ end
250
+
251
+ if rollout_percent > 100
252
+ fail ArgumentError, 'invalid value for "rollout_percent", must be smaller than or equal to 100.'
253
+ end
254
+
255
+ if rollout_percent < 0
256
+ fail ArgumentError, 'invalid value for "rollout_percent", must be greater than or equal to 0.'
257
+ end
258
+
259
+ @rollout_percent = rollout_percent
260
+ end
261
+
262
+ # Custom attribute writer method with validation
263
+ # @param [Object] title Value to be assigned
264
+ def title=(title)
265
+ if title.nil?
266
+ fail ArgumentError, 'title cannot be nil'
267
+ end
268
+
269
+ if title.to_s.length > 140
270
+ fail ArgumentError, 'invalid value for "title", the character length must be smaller than or equal to 140.'
271
+ end
272
+
273
+ @title = title
274
+ end
275
+
276
+ # Custom attribute writer method with validation
277
+ # @param [Object] description Value to be assigned
278
+ def description=(description)
279
+ if description.nil?
280
+ fail ArgumentError, 'description cannot be nil'
281
+ end
282
+
283
+ if description.to_s.length > 2000
284
+ fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 2000.'
285
+ end
286
+
287
+ @description = description
288
+ end
289
+
290
+ # Custom attribute writer method with validation
291
+ # @param [Object] folder Value to be assigned
292
+ def folder=(folder)
293
+ if !folder.nil? && folder.to_s.length > 256
294
+ fail ArgumentError, 'invalid value for "folder", the character length must be smaller than or equal to 256.'
295
+ end
296
+
297
+ pattern = Regexp.new(/^[a-zA-Z0-9_-]+$/)
298
+ if !folder.nil? && folder !~ pattern
299
+ fail ArgumentError, "invalid value for \"folder\", must conform to the pattern #{pattern}."
300
+ end
301
+
302
+ @folder = folder
303
+ end
304
+
305
+ # Custom attribute writer method with validation
306
+ # @param [Object] group Value to be assigned
307
+ def group=(group)
308
+ if group.nil?
309
+ fail ArgumentError, 'group cannot be nil'
310
+ end
311
+
312
+ if group.to_s.length > 64
313
+ fail ArgumentError, 'invalid value for "group", the character length must be smaller than or equal to 64.'
314
+ end
315
+
316
+ @group = group
317
+ end
318
+
319
+ # Custom attribute writer method with validation
320
+ # @param [Object] owner_email Value to be assigned
321
+ def owner_email=(owner_email)
322
+ if owner_email.nil?
323
+ fail ArgumentError, 'owner_email cannot be nil'
324
+ end
325
+
326
+ if owner_email.to_s.length > 190
327
+ fail ArgumentError, 'invalid value for "owner_email", the character length must be smaller than or equal to 190.'
328
+ end
329
+
330
+ @owner_email = owner_email
331
+ end
332
+
333
+ # Checks equality by comparing each attribute.
334
+ # @param [Object] Object to be compared
335
+ def ==(o)
336
+ return true if self.equal?(o)
337
+ self.class == o.class &&
338
+ rollout_pct == o.rollout_pct &&
339
+ rollout_percent == o.rollout_percent &&
340
+ rules == o.rules &&
341
+ enabled == o.enabled &&
342
+ stack == o.stack &&
343
+ title == o.title &&
344
+ description == o.description &&
345
+ folder == o.folder &&
346
+ group == o.group &&
347
+ owner_email == o.owner_email
348
+ end
349
+
350
+ # @see the `==` method
351
+ # @param [Object] Object to be compared
352
+ def eql?(o)
353
+ self == o
354
+ end
355
+
356
+ # Calculates hash code according to all attributes.
357
+ # @return [Integer] Hash code
358
+ def hash
359
+ [rollout_pct, rollout_percent, rules, enabled, stack, title, description, folder, group, owner_email].hash
360
+ end
361
+
362
+ # Builds the object from hash
363
+ # @param [Hash] attributes Model attributes in the form of hash
364
+ # @return [Object] Returns the model itself
365
+ def self.build_from_hash(attributes)
366
+ return nil unless attributes.is_a?(Hash)
367
+ attributes = attributes.transform_keys(&:to_sym)
368
+ transformed_hash = {}
369
+ openapi_types.each_pair do |key, type|
370
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
371
+ transformed_hash["#{key}"] = nil
372
+ elsif type =~ /\AArray<(.*)>/i
373
+ # check to ensure the input is an array given that the attribute
374
+ # is documented as an array but the input is not
375
+ if attributes[attribute_map[key]].is_a?(Array)
376
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
377
+ end
378
+ elsif !attributes[attribute_map[key]].nil?
379
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
380
+ end
381
+ end
382
+ new(transformed_hash)
383
+ end
384
+
385
+ # Returns the object in the form of hash
386
+ # @return [Hash] Returns the object in the form of hash
387
+ def to_hash
388
+ hash = {}
389
+ self.class.attribute_map.each_pair do |attr, param|
390
+ value = self.send(attr)
391
+ if value.nil?
392
+ is_nullable = self.class.openapi_nullable.include?(attr)
393
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
394
+ end
395
+
396
+ hash[param] = _to_hash(value)
397
+ end
398
+ hash
399
+ end
400
+
401
+ end
402
+
403
+ end