rbflagr 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/Makefile +9 -0
  4. data/README.md +143 -0
  5. data/Rakefile +8 -0
  6. data/docs/Constraint.md +11 -0
  7. data/docs/ConstraintApi.md +211 -0
  8. data/docs/CreateConstraintRequest.md +10 -0
  9. data/docs/CreateFlagRequest.md +8 -0
  10. data/docs/CreateSegmentRequest.md +9 -0
  11. data/docs/CreateVariantRequest.md +9 -0
  12. data/docs/Distribution.md +12 -0
  13. data/docs/DistributionApi.md +109 -0
  14. data/docs/Error.md +8 -0
  15. data/docs/EvalContext.md +12 -0
  16. data/docs/EvalDebugLog.md +9 -0
  17. data/docs/EvalResult.md +16 -0
  18. data/docs/EvaluationApi.md +98 -0
  19. data/docs/EvaluationBatchRequest.md +10 -0
  20. data/docs/EvaluationBatchResponse.md +8 -0
  21. data/docs/EvaluationEntity.md +10 -0
  22. data/docs/Flag.md +13 -0
  23. data/docs/FlagApi.md +337 -0
  24. data/docs/FlagSnapshot.md +11 -0
  25. data/docs/HealthApi.md +46 -0
  26. data/docs/PutDistributionsRequest.md +8 -0
  27. data/docs/PutFlagRequest.md +9 -0
  28. data/docs/PutSegmentReorderRequest.md +8 -0
  29. data/docs/PutSegmentRequest.md +9 -0
  30. data/docs/PutVariantRequest.md +9 -0
  31. data/docs/Segment.md +13 -0
  32. data/docs/SegmentApi.md +246 -0
  33. data/docs/SegmentDebugLog.md +9 -0
  34. data/docs/SetFlagEnabledRequest.md +8 -0
  35. data/docs/Variant.md +10 -0
  36. data/docs/VariantApi.md +199 -0
  37. data/git_push.sh +55 -0
  38. data/lib/rbflagr.rb +70 -0
  39. data/lib/rbflagr/api/constraint_api.rb +310 -0
  40. data/lib/rbflagr/api/distribution_api.rb +159 -0
  41. data/lib/rbflagr/api/evaluation_api.rb +123 -0
  42. data/lib/rbflagr/api/flag_api.rb +413 -0
  43. data/lib/rbflagr/api/health_api.rb +66 -0
  44. data/lib/rbflagr/api/segment_api.rb +329 -0
  45. data/lib/rbflagr/api/variant_api.rb +270 -0
  46. data/lib/rbflagr/api_client.rb +388 -0
  47. data/lib/rbflagr/api_error.rb +38 -0
  48. data/lib/rbflagr/configuration.rb +202 -0
  49. data/lib/rbflagr/models/constraint.rb +317 -0
  50. data/lib/rbflagr/models/create_constraint_request.rb +273 -0
  51. data/lib/rbflagr/models/create_flag_request.rb +207 -0
  52. data/lib/rbflagr/models/create_segment_request.rb +249 -0
  53. data/lib/rbflagr/models/create_variant_request.rb +216 -0
  54. data/lib/rbflagr/models/distribution.rb +330 -0
  55. data/lib/rbflagr/models/error.rb +207 -0
  56. data/lib/rbflagr/models/eval_context.rb +268 -0
  57. data/lib/rbflagr/models/eval_debug_log.rb +194 -0
  58. data/lib/rbflagr/models/eval_result.rb +385 -0
  59. data/lib/rbflagr/models/evaluation_batch_request.rb +215 -0
  60. data/lib/rbflagr/models/evaluation_batch_response.rb +190 -0
  61. data/lib/rbflagr/models/evaluation_entity.rb +225 -0
  62. data/lib/rbflagr/models/flag.rb +282 -0
  63. data/lib/rbflagr/models/flag_snapshot.rb +263 -0
  64. data/lib/rbflagr/models/put_distributions_request.rb +190 -0
  65. data/lib/rbflagr/models/put_flag_request.rb +217 -0
  66. data/lib/rbflagr/models/put_segment_reorder_request.rb +190 -0
  67. data/lib/rbflagr/models/put_segment_request.rb +249 -0
  68. data/lib/rbflagr/models/put_variant_request.rb +221 -0
  69. data/lib/rbflagr/models/segment.rb +328 -0
  70. data/lib/rbflagr/models/segment_debug_log.rb +207 -0
  71. data/lib/rbflagr/models/set_flag_enabled_request.rb +188 -0
  72. data/lib/rbflagr/models/variant.rb +240 -0
  73. data/lib/rbflagr/version.rb +15 -0
  74. data/rbflagr.gemspec +45 -0
  75. data/spec/api/constraint_api_spec.rb +91 -0
  76. data/spec/api/distribution_api_spec.rb +62 -0
  77. data/spec/api/evaluation_api_spec.rb +47 -0
  78. data/spec/api/flag_api_spec.rb +108 -0
  79. data/spec/api/health_api_spec.rb +44 -0
  80. data/spec/api/segment_api_spec.rb +87 -0
  81. data/spec/api/variant_api_spec.rb +87 -0
  82. data/spec/api_client_spec.rb +226 -0
  83. data/spec/configuration_spec.rb +42 -0
  84. data/spec/models/constraint_spec.rb +64 -0
  85. data/spec/models/create_constraint_request_spec.rb +54 -0
  86. data/spec/models/create_flag_request_spec.rb +42 -0
  87. data/spec/models/create_segment_request_spec.rb +48 -0
  88. data/spec/models/create_variant_request_spec.rb +48 -0
  89. data/spec/models/distribution_spec.rb +66 -0
  90. data/spec/models/error_spec.rb +42 -0
  91. data/spec/models/eval_context_spec.rb +66 -0
  92. data/spec/models/eval_debug_log_spec.rb +48 -0
  93. data/spec/models/eval_result_spec.rb +78 -0
  94. data/spec/models/evaluation_batch_request_spec.rb +54 -0
  95. data/spec/models/evaluation_batch_response_spec.rb +42 -0
  96. data/spec/models/evaluation_entity_spec.rb +54 -0
  97. data/spec/models/flag_snapshot_spec.rb +60 -0
  98. data/spec/models/flag_spec.rb +66 -0
  99. data/spec/models/put_distributions_request_spec.rb +42 -0
  100. data/spec/models/put_flag_request_spec.rb +42 -0
  101. data/spec/models/put_segment_reorder_request_spec.rb +42 -0
  102. data/spec/models/put_segment_request_spec.rb +48 -0
  103. data/spec/models/put_variant_request_spec.rb +48 -0
  104. data/spec/models/segment_debug_log_spec.rb +48 -0
  105. data/spec/models/segment_spec.rb +72 -0
  106. data/spec/models/set_flag_enabled_request_spec.rb +42 -0
  107. data/spec/models/variant_spec.rb +54 -0
  108. data/spec/spec_helper.rb +111 -0
  109. data/swagger.yaml +1135 -0
  110. data/swagger_ruby.json +6 -0
  111. data/tags +618 -0
  112. metadata +362 -0
@@ -0,0 +1,66 @@
1
+ =begin
2
+ #Flagr
3
+
4
+ #Flagr is a feature flagging, A/B testing and dynamic configuration microservice
5
+
6
+ OpenAPI spec version: 1.0.8
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'uri'
14
+
15
+ module Flagr
16
+ class HealthApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # @param [Hash] opts the optional parameters
23
+ # @return [nil]
24
+ def health_get(opts = {})
25
+ health_get_with_http_info(opts)
26
+ nil
27
+ end
28
+
29
+ # @param [Hash] opts the optional parameters
30
+ # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
31
+ def health_get_with_http_info(opts = {})
32
+ if @api_client.config.debugging
33
+ @api_client.config.logger.debug 'Calling API: HealthApi.health_get ...'
34
+ end
35
+ # resource path
36
+ local_var_path = '/health'
37
+
38
+ # query parameters
39
+ query_params = {}
40
+
41
+ # header parameters
42
+ header_params = {}
43
+ # HTTP header 'Accept' (if needed)
44
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
45
+ # HTTP header 'Content-Type'
46
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
47
+
48
+ # form parameters
49
+ form_params = {}
50
+
51
+ # http body (model)
52
+ post_body = nil
53
+ auth_names = []
54
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
55
+ :header_params => header_params,
56
+ :query_params => query_params,
57
+ :form_params => form_params,
58
+ :body => post_body,
59
+ :auth_names => auth_names)
60
+ if @api_client.config.debugging
61
+ @api_client.config.logger.debug "API called: HealthApi#health_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
62
+ end
63
+ return data, status_code, headers
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,329 @@
1
+ =begin
2
+ #Flagr
3
+
4
+ #Flagr is a feature flagging, A/B testing and dynamic configuration microservice
5
+
6
+ OpenAPI spec version: 1.0.8
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'uri'
14
+
15
+ module Flagr
16
+ class SegmentApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # @param flag_id numeric ID of the flag to get
23
+ # @param body create a segment under a flag
24
+ # @param [Hash] opts the optional parameters
25
+ # @return [Segment]
26
+ def create_segment(flag_id, body, opts = {})
27
+ data, _status_code, _headers = create_segment_with_http_info(flag_id, body, opts)
28
+ data
29
+ end
30
+
31
+ # @param flag_id numeric ID of the flag to get
32
+ # @param body create a segment under a flag
33
+ # @param [Hash] opts the optional parameters
34
+ # @return [Array<(Segment, Fixnum, Hash)>] Segment data, response status code and response headers
35
+ def create_segment_with_http_info(flag_id, body, opts = {})
36
+ if @api_client.config.debugging
37
+ @api_client.config.logger.debug 'Calling API: SegmentApi.create_segment ...'
38
+ end
39
+ # verify the required parameter 'flag_id' is set
40
+ if @api_client.config.client_side_validation && flag_id.nil?
41
+ fail ArgumentError, "Missing the required parameter 'flag_id' when calling SegmentApi.create_segment"
42
+ end
43
+ if @api_client.config.client_side_validation && flag_id < 1
44
+ fail ArgumentError, 'invalid value for "flag_id" when calling SegmentApi.create_segment, must be greater than or equal to 1.'
45
+ end
46
+
47
+ # verify the required parameter 'body' is set
48
+ if @api_client.config.client_side_validation && body.nil?
49
+ fail ArgumentError, "Missing the required parameter 'body' when calling SegmentApi.create_segment"
50
+ end
51
+ # resource path
52
+ local_var_path = '/flags/{flagID}/segments'.sub('{' + 'flagID' + '}', flag_id.to_s)
53
+
54
+ # query parameters
55
+ query_params = {}
56
+
57
+ # header parameters
58
+ header_params = {}
59
+ # HTTP header 'Accept' (if needed)
60
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
61
+ # HTTP header 'Content-Type'
62
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
63
+
64
+ # form parameters
65
+ form_params = {}
66
+
67
+ # http body (model)
68
+ post_body = @api_client.object_to_http_body(body)
69
+ auth_names = []
70
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
71
+ :header_params => header_params,
72
+ :query_params => query_params,
73
+ :form_params => form_params,
74
+ :body => post_body,
75
+ :auth_names => auth_names,
76
+ :return_type => 'Segment')
77
+ if @api_client.config.debugging
78
+ @api_client.config.logger.debug "API called: SegmentApi#create_segment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
79
+ end
80
+ return data, status_code, headers
81
+ end
82
+ # @param flag_id numeric ID of the flag
83
+ # @param segment_id numeric ID of the segment
84
+ # @param [Hash] opts the optional parameters
85
+ # @return [nil]
86
+ def delete_segment(flag_id, segment_id, opts = {})
87
+ delete_segment_with_http_info(flag_id, segment_id, opts)
88
+ nil
89
+ end
90
+
91
+ # @param flag_id numeric ID of the flag
92
+ # @param segment_id numeric ID of the segment
93
+ # @param [Hash] opts the optional parameters
94
+ # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
95
+ def delete_segment_with_http_info(flag_id, segment_id, opts = {})
96
+ if @api_client.config.debugging
97
+ @api_client.config.logger.debug 'Calling API: SegmentApi.delete_segment ...'
98
+ end
99
+ # verify the required parameter 'flag_id' is set
100
+ if @api_client.config.client_side_validation && flag_id.nil?
101
+ fail ArgumentError, "Missing the required parameter 'flag_id' when calling SegmentApi.delete_segment"
102
+ end
103
+ if @api_client.config.client_side_validation && flag_id < 1
104
+ fail ArgumentError, 'invalid value for "flag_id" when calling SegmentApi.delete_segment, must be greater than or equal to 1.'
105
+ end
106
+
107
+ # verify the required parameter 'segment_id' is set
108
+ if @api_client.config.client_side_validation && segment_id.nil?
109
+ fail ArgumentError, "Missing the required parameter 'segment_id' when calling SegmentApi.delete_segment"
110
+ end
111
+ if @api_client.config.client_side_validation && segment_id < 1
112
+ fail ArgumentError, 'invalid value for "segment_id" when calling SegmentApi.delete_segment, must be greater than or equal to 1.'
113
+ end
114
+
115
+ # resource path
116
+ local_var_path = '/flags/{flagID}/segments/{segmentID}'.sub('{' + 'flagID' + '}', flag_id.to_s).sub('{' + 'segmentID' + '}', segment_id.to_s)
117
+
118
+ # query parameters
119
+ query_params = {}
120
+
121
+ # header parameters
122
+ header_params = {}
123
+ # HTTP header 'Accept' (if needed)
124
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
125
+ # HTTP header 'Content-Type'
126
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
127
+
128
+ # form parameters
129
+ form_params = {}
130
+
131
+ # http body (model)
132
+ post_body = nil
133
+ auth_names = []
134
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
135
+ :header_params => header_params,
136
+ :query_params => query_params,
137
+ :form_params => form_params,
138
+ :body => post_body,
139
+ :auth_names => auth_names)
140
+ if @api_client.config.debugging
141
+ @api_client.config.logger.debug "API called: SegmentApi#delete_segment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
142
+ end
143
+ return data, status_code, headers
144
+ end
145
+ # @param flag_id numeric ID of the flag to get
146
+ # @param [Hash] opts the optional parameters
147
+ # @return [Array<Segment>]
148
+ def find_segments(flag_id, opts = {})
149
+ data, _status_code, _headers = find_segments_with_http_info(flag_id, opts)
150
+ data
151
+ end
152
+
153
+ # @param flag_id numeric ID of the flag to get
154
+ # @param [Hash] opts the optional parameters
155
+ # @return [Array<(Array<Segment>, Fixnum, Hash)>] Array<Segment> data, response status code and response headers
156
+ def find_segments_with_http_info(flag_id, opts = {})
157
+ if @api_client.config.debugging
158
+ @api_client.config.logger.debug 'Calling API: SegmentApi.find_segments ...'
159
+ end
160
+ # verify the required parameter 'flag_id' is set
161
+ if @api_client.config.client_side_validation && flag_id.nil?
162
+ fail ArgumentError, "Missing the required parameter 'flag_id' when calling SegmentApi.find_segments"
163
+ end
164
+ if @api_client.config.client_side_validation && flag_id < 1
165
+ fail ArgumentError, 'invalid value for "flag_id" when calling SegmentApi.find_segments, must be greater than or equal to 1.'
166
+ end
167
+
168
+ # resource path
169
+ local_var_path = '/flags/{flagID}/segments'.sub('{' + 'flagID' + '}', flag_id.to_s)
170
+
171
+ # query parameters
172
+ query_params = {}
173
+
174
+ # header parameters
175
+ header_params = {}
176
+ # HTTP header 'Accept' (if needed)
177
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
178
+ # HTTP header 'Content-Type'
179
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
180
+
181
+ # form parameters
182
+ form_params = {}
183
+
184
+ # http body (model)
185
+ post_body = nil
186
+ auth_names = []
187
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
188
+ :header_params => header_params,
189
+ :query_params => query_params,
190
+ :form_params => form_params,
191
+ :body => post_body,
192
+ :auth_names => auth_names,
193
+ :return_type => 'Array<Segment>')
194
+ if @api_client.config.debugging
195
+ @api_client.config.logger.debug "API called: SegmentApi#find_segments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
196
+ end
197
+ return data, status_code, headers
198
+ end
199
+ # @param flag_id numeric ID of the flag
200
+ # @param segment_id numeric ID of the segment
201
+ # @param body update a segment
202
+ # @param [Hash] opts the optional parameters
203
+ # @return [Segment]
204
+ def put_segment(flag_id, segment_id, body, opts = {})
205
+ data, _status_code, _headers = put_segment_with_http_info(flag_id, segment_id, body, opts)
206
+ data
207
+ end
208
+
209
+ # @param flag_id numeric ID of the flag
210
+ # @param segment_id numeric ID of the segment
211
+ # @param body update a segment
212
+ # @param [Hash] opts the optional parameters
213
+ # @return [Array<(Segment, Fixnum, Hash)>] Segment data, response status code and response headers
214
+ def put_segment_with_http_info(flag_id, segment_id, body, opts = {})
215
+ if @api_client.config.debugging
216
+ @api_client.config.logger.debug 'Calling API: SegmentApi.put_segment ...'
217
+ end
218
+ # verify the required parameter 'flag_id' is set
219
+ if @api_client.config.client_side_validation && flag_id.nil?
220
+ fail ArgumentError, "Missing the required parameter 'flag_id' when calling SegmentApi.put_segment"
221
+ end
222
+ if @api_client.config.client_side_validation && flag_id < 1
223
+ fail ArgumentError, 'invalid value for "flag_id" when calling SegmentApi.put_segment, must be greater than or equal to 1.'
224
+ end
225
+
226
+ # verify the required parameter 'segment_id' is set
227
+ if @api_client.config.client_side_validation && segment_id.nil?
228
+ fail ArgumentError, "Missing the required parameter 'segment_id' when calling SegmentApi.put_segment"
229
+ end
230
+ if @api_client.config.client_side_validation && segment_id < 1
231
+ fail ArgumentError, 'invalid value for "segment_id" when calling SegmentApi.put_segment, must be greater than or equal to 1.'
232
+ end
233
+
234
+ # verify the required parameter 'body' is set
235
+ if @api_client.config.client_side_validation && body.nil?
236
+ fail ArgumentError, "Missing the required parameter 'body' when calling SegmentApi.put_segment"
237
+ end
238
+ # resource path
239
+ local_var_path = '/flags/{flagID}/segments/{segmentID}'.sub('{' + 'flagID' + '}', flag_id.to_s).sub('{' + 'segmentID' + '}', segment_id.to_s)
240
+
241
+ # query parameters
242
+ query_params = {}
243
+
244
+ # header parameters
245
+ header_params = {}
246
+ # HTTP header 'Accept' (if needed)
247
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
248
+ # HTTP header 'Content-Type'
249
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
250
+
251
+ # form parameters
252
+ form_params = {}
253
+
254
+ # http body (model)
255
+ post_body = @api_client.object_to_http_body(body)
256
+ auth_names = []
257
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
258
+ :header_params => header_params,
259
+ :query_params => query_params,
260
+ :form_params => form_params,
261
+ :body => post_body,
262
+ :auth_names => auth_names,
263
+ :return_type => 'Segment')
264
+ if @api_client.config.debugging
265
+ @api_client.config.logger.debug "API called: SegmentApi#put_segment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
266
+ end
267
+ return data, status_code, headers
268
+ end
269
+ # @param flag_id numeric ID of the flag
270
+ # @param body reorder segments
271
+ # @param [Hash] opts the optional parameters
272
+ # @return [nil]
273
+ def put_segments_reorder(flag_id, body, opts = {})
274
+ put_segments_reorder_with_http_info(flag_id, body, opts)
275
+ nil
276
+ end
277
+
278
+ # @param flag_id numeric ID of the flag
279
+ # @param body reorder segments
280
+ # @param [Hash] opts the optional parameters
281
+ # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
282
+ def put_segments_reorder_with_http_info(flag_id, body, opts = {})
283
+ if @api_client.config.debugging
284
+ @api_client.config.logger.debug 'Calling API: SegmentApi.put_segments_reorder ...'
285
+ end
286
+ # verify the required parameter 'flag_id' is set
287
+ if @api_client.config.client_side_validation && flag_id.nil?
288
+ fail ArgumentError, "Missing the required parameter 'flag_id' when calling SegmentApi.put_segments_reorder"
289
+ end
290
+ if @api_client.config.client_side_validation && flag_id < 1
291
+ fail ArgumentError, 'invalid value for "flag_id" when calling SegmentApi.put_segments_reorder, must be greater than or equal to 1.'
292
+ end
293
+
294
+ # verify the required parameter 'body' is set
295
+ if @api_client.config.client_side_validation && body.nil?
296
+ fail ArgumentError, "Missing the required parameter 'body' when calling SegmentApi.put_segments_reorder"
297
+ end
298
+ # resource path
299
+ local_var_path = '/flags/{flagID}/segments/reorder'.sub('{' + 'flagID' + '}', flag_id.to_s)
300
+
301
+ # query parameters
302
+ query_params = {}
303
+
304
+ # header parameters
305
+ header_params = {}
306
+ # HTTP header 'Accept' (if needed)
307
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
308
+ # HTTP header 'Content-Type'
309
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
310
+
311
+ # form parameters
312
+ form_params = {}
313
+
314
+ # http body (model)
315
+ post_body = @api_client.object_to_http_body(body)
316
+ auth_names = []
317
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
318
+ :header_params => header_params,
319
+ :query_params => query_params,
320
+ :form_params => form_params,
321
+ :body => post_body,
322
+ :auth_names => auth_names)
323
+ if @api_client.config.debugging
324
+ @api_client.config.logger.debug "API called: SegmentApi#put_segments_reorder\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
325
+ end
326
+ return data, status_code, headers
327
+ end
328
+ end
329
+ end
@@ -0,0 +1,270 @@
1
+ =begin
2
+ #Flagr
3
+
4
+ #Flagr is a feature flagging, A/B testing and dynamic configuration microservice
5
+
6
+ OpenAPI spec version: 1.0.8
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'uri'
14
+
15
+ module Flagr
16
+ class VariantApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # @param flag_id numeric ID of the flag
23
+ # @param body create a variant
24
+ # @param [Hash] opts the optional parameters
25
+ # @return [Variant]
26
+ def create_variant(flag_id, body, opts = {})
27
+ data, _status_code, _headers = create_variant_with_http_info(flag_id, body, opts)
28
+ data
29
+ end
30
+
31
+ # @param flag_id numeric ID of the flag
32
+ # @param body create a variant
33
+ # @param [Hash] opts the optional parameters
34
+ # @return [Array<(Variant, Fixnum, Hash)>] Variant data, response status code and response headers
35
+ def create_variant_with_http_info(flag_id, body, opts = {})
36
+ if @api_client.config.debugging
37
+ @api_client.config.logger.debug 'Calling API: VariantApi.create_variant ...'
38
+ end
39
+ # verify the required parameter 'flag_id' is set
40
+ if @api_client.config.client_side_validation && flag_id.nil?
41
+ fail ArgumentError, "Missing the required parameter 'flag_id' when calling VariantApi.create_variant"
42
+ end
43
+ if @api_client.config.client_side_validation && flag_id < 1
44
+ fail ArgumentError, 'invalid value for "flag_id" when calling VariantApi.create_variant, must be greater than or equal to 1.'
45
+ end
46
+
47
+ # verify the required parameter 'body' is set
48
+ if @api_client.config.client_side_validation && body.nil?
49
+ fail ArgumentError, "Missing the required parameter 'body' when calling VariantApi.create_variant"
50
+ end
51
+ # resource path
52
+ local_var_path = '/flags/{flagID}/variants'.sub('{' + 'flagID' + '}', flag_id.to_s)
53
+
54
+ # query parameters
55
+ query_params = {}
56
+
57
+ # header parameters
58
+ header_params = {}
59
+ # HTTP header 'Accept' (if needed)
60
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
61
+ # HTTP header 'Content-Type'
62
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
63
+
64
+ # form parameters
65
+ form_params = {}
66
+
67
+ # http body (model)
68
+ post_body = @api_client.object_to_http_body(body)
69
+ auth_names = []
70
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
71
+ :header_params => header_params,
72
+ :query_params => query_params,
73
+ :form_params => form_params,
74
+ :body => post_body,
75
+ :auth_names => auth_names,
76
+ :return_type => 'Variant')
77
+ if @api_client.config.debugging
78
+ @api_client.config.logger.debug "API called: VariantApi#create_variant\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
79
+ end
80
+ return data, status_code, headers
81
+ end
82
+ # @param flag_id numeric ID of the flag
83
+ # @param variant_id numeric ID of the variant
84
+ # @param [Hash] opts the optional parameters
85
+ # @return [nil]
86
+ def delete_variant(flag_id, variant_id, opts = {})
87
+ delete_variant_with_http_info(flag_id, variant_id, opts)
88
+ nil
89
+ end
90
+
91
+ # @param flag_id numeric ID of the flag
92
+ # @param variant_id numeric ID of the variant
93
+ # @param [Hash] opts the optional parameters
94
+ # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
95
+ def delete_variant_with_http_info(flag_id, variant_id, opts = {})
96
+ if @api_client.config.debugging
97
+ @api_client.config.logger.debug 'Calling API: VariantApi.delete_variant ...'
98
+ end
99
+ # verify the required parameter 'flag_id' is set
100
+ if @api_client.config.client_side_validation && flag_id.nil?
101
+ fail ArgumentError, "Missing the required parameter 'flag_id' when calling VariantApi.delete_variant"
102
+ end
103
+ if @api_client.config.client_side_validation && flag_id < 1
104
+ fail ArgumentError, 'invalid value for "flag_id" when calling VariantApi.delete_variant, must be greater than or equal to 1.'
105
+ end
106
+
107
+ # verify the required parameter 'variant_id' is set
108
+ if @api_client.config.client_side_validation && variant_id.nil?
109
+ fail ArgumentError, "Missing the required parameter 'variant_id' when calling VariantApi.delete_variant"
110
+ end
111
+ if @api_client.config.client_side_validation && variant_id < 1
112
+ fail ArgumentError, 'invalid value for "variant_id" when calling VariantApi.delete_variant, must be greater than or equal to 1.'
113
+ end
114
+
115
+ # resource path
116
+ local_var_path = '/flags/{flagID}/variants/{variantID}'.sub('{' + 'flagID' + '}', flag_id.to_s).sub('{' + 'variantID' + '}', variant_id.to_s)
117
+
118
+ # query parameters
119
+ query_params = {}
120
+
121
+ # header parameters
122
+ header_params = {}
123
+ # HTTP header 'Accept' (if needed)
124
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
125
+ # HTTP header 'Content-Type'
126
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
127
+
128
+ # form parameters
129
+ form_params = {}
130
+
131
+ # http body (model)
132
+ post_body = nil
133
+ auth_names = []
134
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
135
+ :header_params => header_params,
136
+ :query_params => query_params,
137
+ :form_params => form_params,
138
+ :body => post_body,
139
+ :auth_names => auth_names)
140
+ if @api_client.config.debugging
141
+ @api_client.config.logger.debug "API called: VariantApi#delete_variant\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
142
+ end
143
+ return data, status_code, headers
144
+ end
145
+ # @param flag_id numeric ID of the flag
146
+ # @param [Hash] opts the optional parameters
147
+ # @return [Array<Variant>]
148
+ def find_variants(flag_id, opts = {})
149
+ data, _status_code, _headers = find_variants_with_http_info(flag_id, opts)
150
+ data
151
+ end
152
+
153
+ # @param flag_id numeric ID of the flag
154
+ # @param [Hash] opts the optional parameters
155
+ # @return [Array<(Array<Variant>, Fixnum, Hash)>] Array<Variant> data, response status code and response headers
156
+ def find_variants_with_http_info(flag_id, opts = {})
157
+ if @api_client.config.debugging
158
+ @api_client.config.logger.debug 'Calling API: VariantApi.find_variants ...'
159
+ end
160
+ # verify the required parameter 'flag_id' is set
161
+ if @api_client.config.client_side_validation && flag_id.nil?
162
+ fail ArgumentError, "Missing the required parameter 'flag_id' when calling VariantApi.find_variants"
163
+ end
164
+ if @api_client.config.client_side_validation && flag_id < 1
165
+ fail ArgumentError, 'invalid value for "flag_id" when calling VariantApi.find_variants, must be greater than or equal to 1.'
166
+ end
167
+
168
+ # resource path
169
+ local_var_path = '/flags/{flagID}/variants'.sub('{' + 'flagID' + '}', flag_id.to_s)
170
+
171
+ # query parameters
172
+ query_params = {}
173
+
174
+ # header parameters
175
+ header_params = {}
176
+ # HTTP header 'Accept' (if needed)
177
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
178
+ # HTTP header 'Content-Type'
179
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
180
+
181
+ # form parameters
182
+ form_params = {}
183
+
184
+ # http body (model)
185
+ post_body = nil
186
+ auth_names = []
187
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
188
+ :header_params => header_params,
189
+ :query_params => query_params,
190
+ :form_params => form_params,
191
+ :body => post_body,
192
+ :auth_names => auth_names,
193
+ :return_type => 'Array<Variant>')
194
+ if @api_client.config.debugging
195
+ @api_client.config.logger.debug "API called: VariantApi#find_variants\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
196
+ end
197
+ return data, status_code, headers
198
+ end
199
+ # @param flag_id numeric ID of the flag
200
+ # @param variant_id numeric ID of the variant
201
+ # @param body update a variant
202
+ # @param [Hash] opts the optional parameters
203
+ # @return [Variant]
204
+ def put_variant(flag_id, variant_id, body, opts = {})
205
+ data, _status_code, _headers = put_variant_with_http_info(flag_id, variant_id, body, opts)
206
+ data
207
+ end
208
+
209
+ # @param flag_id numeric ID of the flag
210
+ # @param variant_id numeric ID of the variant
211
+ # @param body update a variant
212
+ # @param [Hash] opts the optional parameters
213
+ # @return [Array<(Variant, Fixnum, Hash)>] Variant data, response status code and response headers
214
+ def put_variant_with_http_info(flag_id, variant_id, body, opts = {})
215
+ if @api_client.config.debugging
216
+ @api_client.config.logger.debug 'Calling API: VariantApi.put_variant ...'
217
+ end
218
+ # verify the required parameter 'flag_id' is set
219
+ if @api_client.config.client_side_validation && flag_id.nil?
220
+ fail ArgumentError, "Missing the required parameter 'flag_id' when calling VariantApi.put_variant"
221
+ end
222
+ if @api_client.config.client_side_validation && flag_id < 1
223
+ fail ArgumentError, 'invalid value for "flag_id" when calling VariantApi.put_variant, must be greater than or equal to 1.'
224
+ end
225
+
226
+ # verify the required parameter 'variant_id' is set
227
+ if @api_client.config.client_side_validation && variant_id.nil?
228
+ fail ArgumentError, "Missing the required parameter 'variant_id' when calling VariantApi.put_variant"
229
+ end
230
+ if @api_client.config.client_side_validation && variant_id < 1
231
+ fail ArgumentError, 'invalid value for "variant_id" when calling VariantApi.put_variant, must be greater than or equal to 1.'
232
+ end
233
+
234
+ # verify the required parameter 'body' is set
235
+ if @api_client.config.client_side_validation && body.nil?
236
+ fail ArgumentError, "Missing the required parameter 'body' when calling VariantApi.put_variant"
237
+ end
238
+ # resource path
239
+ local_var_path = '/flags/{flagID}/variants/{variantID}'.sub('{' + 'flagID' + '}', flag_id.to_s).sub('{' + 'variantID' + '}', variant_id.to_s)
240
+
241
+ # query parameters
242
+ query_params = {}
243
+
244
+ # header parameters
245
+ header_params = {}
246
+ # HTTP header 'Accept' (if needed)
247
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
248
+ # HTTP header 'Content-Type'
249
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
250
+
251
+ # form parameters
252
+ form_params = {}
253
+
254
+ # http body (model)
255
+ post_body = @api_client.object_to_http_body(body)
256
+ auth_names = []
257
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
258
+ :header_params => header_params,
259
+ :query_params => query_params,
260
+ :form_params => form_params,
261
+ :body => post_body,
262
+ :auth_names => auth_names,
263
+ :return_type => 'Variant')
264
+ if @api_client.config.debugging
265
+ @api_client.config.logger.debug "API called: VariantApi#put_variant\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
266
+ end
267
+ return data, status_code, headers
268
+ end
269
+ end
270
+ end