rbflagr 0.1.2
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.
- checksums.yaml +7 -0
- data/Gemfile +7 -0
- data/Makefile +9 -0
- data/README.md +143 -0
- data/Rakefile +8 -0
- data/docs/Constraint.md +11 -0
- data/docs/ConstraintApi.md +211 -0
- data/docs/CreateConstraintRequest.md +10 -0
- data/docs/CreateFlagRequest.md +8 -0
- data/docs/CreateSegmentRequest.md +9 -0
- data/docs/CreateVariantRequest.md +9 -0
- data/docs/Distribution.md +12 -0
- data/docs/DistributionApi.md +109 -0
- data/docs/Error.md +8 -0
- data/docs/EvalContext.md +12 -0
- data/docs/EvalDebugLog.md +9 -0
- data/docs/EvalResult.md +16 -0
- data/docs/EvaluationApi.md +98 -0
- data/docs/EvaluationBatchRequest.md +10 -0
- data/docs/EvaluationBatchResponse.md +8 -0
- data/docs/EvaluationEntity.md +10 -0
- data/docs/Flag.md +13 -0
- data/docs/FlagApi.md +337 -0
- data/docs/FlagSnapshot.md +11 -0
- data/docs/HealthApi.md +46 -0
- data/docs/PutDistributionsRequest.md +8 -0
- data/docs/PutFlagRequest.md +9 -0
- data/docs/PutSegmentReorderRequest.md +8 -0
- data/docs/PutSegmentRequest.md +9 -0
- data/docs/PutVariantRequest.md +9 -0
- data/docs/Segment.md +13 -0
- data/docs/SegmentApi.md +246 -0
- data/docs/SegmentDebugLog.md +9 -0
- data/docs/SetFlagEnabledRequest.md +8 -0
- data/docs/Variant.md +10 -0
- data/docs/VariantApi.md +199 -0
- data/git_push.sh +55 -0
- data/lib/rbflagr.rb +70 -0
- data/lib/rbflagr/api/constraint_api.rb +310 -0
- data/lib/rbflagr/api/distribution_api.rb +159 -0
- data/lib/rbflagr/api/evaluation_api.rb +123 -0
- data/lib/rbflagr/api/flag_api.rb +413 -0
- data/lib/rbflagr/api/health_api.rb +66 -0
- data/lib/rbflagr/api/segment_api.rb +329 -0
- data/lib/rbflagr/api/variant_api.rb +270 -0
- data/lib/rbflagr/api_client.rb +388 -0
- data/lib/rbflagr/api_error.rb +38 -0
- data/lib/rbflagr/configuration.rb +202 -0
- data/lib/rbflagr/models/constraint.rb +317 -0
- data/lib/rbflagr/models/create_constraint_request.rb +273 -0
- data/lib/rbflagr/models/create_flag_request.rb +207 -0
- data/lib/rbflagr/models/create_segment_request.rb +249 -0
- data/lib/rbflagr/models/create_variant_request.rb +216 -0
- data/lib/rbflagr/models/distribution.rb +330 -0
- data/lib/rbflagr/models/error.rb +207 -0
- data/lib/rbflagr/models/eval_context.rb +268 -0
- data/lib/rbflagr/models/eval_debug_log.rb +194 -0
- data/lib/rbflagr/models/eval_result.rb +385 -0
- data/lib/rbflagr/models/evaluation_batch_request.rb +215 -0
- data/lib/rbflagr/models/evaluation_batch_response.rb +190 -0
- data/lib/rbflagr/models/evaluation_entity.rb +225 -0
- data/lib/rbflagr/models/flag.rb +282 -0
- data/lib/rbflagr/models/flag_snapshot.rb +263 -0
- data/lib/rbflagr/models/put_distributions_request.rb +190 -0
- data/lib/rbflagr/models/put_flag_request.rb +217 -0
- data/lib/rbflagr/models/put_segment_reorder_request.rb +190 -0
- data/lib/rbflagr/models/put_segment_request.rb +249 -0
- data/lib/rbflagr/models/put_variant_request.rb +221 -0
- data/lib/rbflagr/models/segment.rb +328 -0
- data/lib/rbflagr/models/segment_debug_log.rb +207 -0
- data/lib/rbflagr/models/set_flag_enabled_request.rb +188 -0
- data/lib/rbflagr/models/variant.rb +240 -0
- data/lib/rbflagr/version.rb +15 -0
- data/rbflagr.gemspec +45 -0
- data/spec/api/constraint_api_spec.rb +91 -0
- data/spec/api/distribution_api_spec.rb +62 -0
- data/spec/api/evaluation_api_spec.rb +47 -0
- data/spec/api/flag_api_spec.rb +108 -0
- data/spec/api/health_api_spec.rb +44 -0
- data/spec/api/segment_api_spec.rb +87 -0
- data/spec/api/variant_api_spec.rb +87 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/constraint_spec.rb +64 -0
- data/spec/models/create_constraint_request_spec.rb +54 -0
- data/spec/models/create_flag_request_spec.rb +42 -0
- data/spec/models/create_segment_request_spec.rb +48 -0
- data/spec/models/create_variant_request_spec.rb +48 -0
- data/spec/models/distribution_spec.rb +66 -0
- data/spec/models/error_spec.rb +42 -0
- data/spec/models/eval_context_spec.rb +66 -0
- data/spec/models/eval_debug_log_spec.rb +48 -0
- data/spec/models/eval_result_spec.rb +78 -0
- data/spec/models/evaluation_batch_request_spec.rb +54 -0
- data/spec/models/evaluation_batch_response_spec.rb +42 -0
- data/spec/models/evaluation_entity_spec.rb +54 -0
- data/spec/models/flag_snapshot_spec.rb +60 -0
- data/spec/models/flag_spec.rb +66 -0
- data/spec/models/put_distributions_request_spec.rb +42 -0
- data/spec/models/put_flag_request_spec.rb +42 -0
- data/spec/models/put_segment_reorder_request_spec.rb +42 -0
- data/spec/models/put_segment_request_spec.rb +48 -0
- data/spec/models/put_variant_request_spec.rb +48 -0
- data/spec/models/segment_debug_log_spec.rb +48 -0
- data/spec/models/segment_spec.rb +72 -0
- data/spec/models/set_flag_enabled_request_spec.rb +42 -0
- data/spec/models/variant_spec.rb +54 -0
- data/spec/spec_helper.rb +111 -0
- data/swagger.yaml +1135 -0
- data/swagger_ruby.json +6 -0
- data/tags +618 -0
- metadata +362 -0
data/git_push.sh
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
#
|
|
3
|
+
# Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
4
|
+
#
|
|
5
|
+
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
|
6
|
+
#
|
|
7
|
+
# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update"
|
|
8
|
+
|
|
9
|
+
git_user_id=$1
|
|
10
|
+
git_repo_id=$2
|
|
11
|
+
release_note=$3
|
|
12
|
+
|
|
13
|
+
if [ "$git_user_id" = "" ]; then
|
|
14
|
+
git_user_id="GIT_USER_ID"
|
|
15
|
+
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
|
16
|
+
fi
|
|
17
|
+
|
|
18
|
+
if [ "$git_repo_id" = "" ]; then
|
|
19
|
+
git_repo_id="GIT_REPO_ID"
|
|
20
|
+
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
|
21
|
+
fi
|
|
22
|
+
|
|
23
|
+
if [ "$release_note" = "" ]; then
|
|
24
|
+
release_note="Minor update"
|
|
25
|
+
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
|
|
26
|
+
fi
|
|
27
|
+
|
|
28
|
+
# Initialize the local directory as a Git repository
|
|
29
|
+
git init
|
|
30
|
+
|
|
31
|
+
# Adds the files in the local repository and stages them for commit.
|
|
32
|
+
git add .
|
|
33
|
+
|
|
34
|
+
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
|
35
|
+
git commit -m "$release_note"
|
|
36
|
+
|
|
37
|
+
# Sets the new remote
|
|
38
|
+
git_remote=`git remote`
|
|
39
|
+
if [ "$git_remote" = "" ]; then # git remote not defined
|
|
40
|
+
|
|
41
|
+
if [ "$GIT_TOKEN" = "" ]; then
|
|
42
|
+
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
|
43
|
+
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
|
|
44
|
+
else
|
|
45
|
+
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
|
|
46
|
+
fi
|
|
47
|
+
|
|
48
|
+
fi
|
|
49
|
+
|
|
50
|
+
git pull origin master
|
|
51
|
+
|
|
52
|
+
# Pushes (Forces) the changes in the local repository up to the remote repository
|
|
53
|
+
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
|
|
54
|
+
git push origin master 2>&1 | grep -v 'To https'
|
|
55
|
+
|
data/lib/rbflagr.rb
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
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
|
+
# Common files
|
|
14
|
+
require 'rbflagr/api_client'
|
|
15
|
+
require 'rbflagr/api_error'
|
|
16
|
+
require 'rbflagr/version'
|
|
17
|
+
require 'rbflagr/configuration'
|
|
18
|
+
|
|
19
|
+
# Models
|
|
20
|
+
require 'rbflagr/models/constraint'
|
|
21
|
+
require 'rbflagr/models/create_constraint_request'
|
|
22
|
+
require 'rbflagr/models/create_flag_request'
|
|
23
|
+
require 'rbflagr/models/create_segment_request'
|
|
24
|
+
require 'rbflagr/models/create_variant_request'
|
|
25
|
+
require 'rbflagr/models/distribution'
|
|
26
|
+
require 'rbflagr/models/error'
|
|
27
|
+
require 'rbflagr/models/eval_context'
|
|
28
|
+
require 'rbflagr/models/eval_debug_log'
|
|
29
|
+
require 'rbflagr/models/eval_result'
|
|
30
|
+
require 'rbflagr/models/evaluation_batch_request'
|
|
31
|
+
require 'rbflagr/models/evaluation_batch_response'
|
|
32
|
+
require 'rbflagr/models/evaluation_entity'
|
|
33
|
+
require 'rbflagr/models/flag'
|
|
34
|
+
require 'rbflagr/models/flag_snapshot'
|
|
35
|
+
require 'rbflagr/models/put_distributions_request'
|
|
36
|
+
require 'rbflagr/models/put_flag_request'
|
|
37
|
+
require 'rbflagr/models/put_segment_reorder_request'
|
|
38
|
+
require 'rbflagr/models/put_segment_request'
|
|
39
|
+
require 'rbflagr/models/put_variant_request'
|
|
40
|
+
require 'rbflagr/models/segment'
|
|
41
|
+
require 'rbflagr/models/segment_debug_log'
|
|
42
|
+
require 'rbflagr/models/set_flag_enabled_request'
|
|
43
|
+
require 'rbflagr/models/variant'
|
|
44
|
+
|
|
45
|
+
# APIs
|
|
46
|
+
require 'rbflagr/api/constraint_api'
|
|
47
|
+
require 'rbflagr/api/distribution_api'
|
|
48
|
+
require 'rbflagr/api/evaluation_api'
|
|
49
|
+
require 'rbflagr/api/flag_api'
|
|
50
|
+
require 'rbflagr/api/health_api'
|
|
51
|
+
require 'rbflagr/api/segment_api'
|
|
52
|
+
require 'rbflagr/api/variant_api'
|
|
53
|
+
|
|
54
|
+
module Flagr
|
|
55
|
+
class << self
|
|
56
|
+
# Customize default settings for the SDK using block.
|
|
57
|
+
# Flagr.configure do |config|
|
|
58
|
+
# config.username = "xxx"
|
|
59
|
+
# config.password = "xxx"
|
|
60
|
+
# end
|
|
61
|
+
# If no block given, return the default Configuration object.
|
|
62
|
+
def configure
|
|
63
|
+
if block_given?
|
|
64
|
+
yield(Configuration.default)
|
|
65
|
+
else
|
|
66
|
+
Configuration.default
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
@@ -0,0 +1,310 @@
|
|
|
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 ConstraintApi
|
|
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 segment_id numeric ID of the segment
|
|
24
|
+
# @param body create a constraint
|
|
25
|
+
# @param [Hash] opts the optional parameters
|
|
26
|
+
# @return [Constraint]
|
|
27
|
+
def create_constraint(flag_id, segment_id, body, opts = {})
|
|
28
|
+
data, _status_code, _headers = create_constraint_with_http_info(flag_id, segment_id, body, opts)
|
|
29
|
+
data
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# @param flag_id numeric ID of the flag
|
|
33
|
+
# @param segment_id numeric ID of the segment
|
|
34
|
+
# @param body create a constraint
|
|
35
|
+
# @param [Hash] opts the optional parameters
|
|
36
|
+
# @return [Array<(Constraint, Fixnum, Hash)>] Constraint data, response status code and response headers
|
|
37
|
+
def create_constraint_with_http_info(flag_id, segment_id, body, opts = {})
|
|
38
|
+
if @api_client.config.debugging
|
|
39
|
+
@api_client.config.logger.debug 'Calling API: ConstraintApi.create_constraint ...'
|
|
40
|
+
end
|
|
41
|
+
# verify the required parameter 'flag_id' is set
|
|
42
|
+
if @api_client.config.client_side_validation && flag_id.nil?
|
|
43
|
+
fail ArgumentError, "Missing the required parameter 'flag_id' when calling ConstraintApi.create_constraint"
|
|
44
|
+
end
|
|
45
|
+
if @api_client.config.client_side_validation && flag_id < 1
|
|
46
|
+
fail ArgumentError, 'invalid value for "flag_id" when calling ConstraintApi.create_constraint, must be greater than or equal to 1.'
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# verify the required parameter 'segment_id' is set
|
|
50
|
+
if @api_client.config.client_side_validation && segment_id.nil?
|
|
51
|
+
fail ArgumentError, "Missing the required parameter 'segment_id' when calling ConstraintApi.create_constraint"
|
|
52
|
+
end
|
|
53
|
+
if @api_client.config.client_side_validation && segment_id < 1
|
|
54
|
+
fail ArgumentError, 'invalid value for "segment_id" when calling ConstraintApi.create_constraint, must be greater than or equal to 1.'
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# verify the required parameter 'body' is set
|
|
58
|
+
if @api_client.config.client_side_validation && body.nil?
|
|
59
|
+
fail ArgumentError, "Missing the required parameter 'body' when calling ConstraintApi.create_constraint"
|
|
60
|
+
end
|
|
61
|
+
# resource path
|
|
62
|
+
local_var_path = '/flags/{flagID}/segments/{segmentID}/constraints'.sub('{' + 'flagID' + '}', flag_id.to_s).sub('{' + 'segmentID' + '}', segment_id.to_s)
|
|
63
|
+
|
|
64
|
+
# query parameters
|
|
65
|
+
query_params = {}
|
|
66
|
+
|
|
67
|
+
# header parameters
|
|
68
|
+
header_params = {}
|
|
69
|
+
# HTTP header 'Accept' (if needed)
|
|
70
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
71
|
+
# HTTP header 'Content-Type'
|
|
72
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
|
73
|
+
|
|
74
|
+
# form parameters
|
|
75
|
+
form_params = {}
|
|
76
|
+
|
|
77
|
+
# http body (model)
|
|
78
|
+
post_body = @api_client.object_to_http_body(body)
|
|
79
|
+
auth_names = []
|
|
80
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
|
81
|
+
:header_params => header_params,
|
|
82
|
+
:query_params => query_params,
|
|
83
|
+
:form_params => form_params,
|
|
84
|
+
:body => post_body,
|
|
85
|
+
:auth_names => auth_names,
|
|
86
|
+
:return_type => 'Constraint')
|
|
87
|
+
if @api_client.config.debugging
|
|
88
|
+
@api_client.config.logger.debug "API called: ConstraintApi#create_constraint\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
89
|
+
end
|
|
90
|
+
return data, status_code, headers
|
|
91
|
+
end
|
|
92
|
+
# @param flag_id numeric ID of the flag
|
|
93
|
+
# @param segment_id numeric ID of the segment
|
|
94
|
+
# @param constraint_id numeric ID of the constraint
|
|
95
|
+
# @param [Hash] opts the optional parameters
|
|
96
|
+
# @return [nil]
|
|
97
|
+
def delete_constraint(flag_id, segment_id, constraint_id, opts = {})
|
|
98
|
+
delete_constraint_with_http_info(flag_id, segment_id, constraint_id, opts)
|
|
99
|
+
nil
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# @param flag_id numeric ID of the flag
|
|
103
|
+
# @param segment_id numeric ID of the segment
|
|
104
|
+
# @param constraint_id numeric ID of the constraint
|
|
105
|
+
# @param [Hash] opts the optional parameters
|
|
106
|
+
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
|
107
|
+
def delete_constraint_with_http_info(flag_id, segment_id, constraint_id, opts = {})
|
|
108
|
+
if @api_client.config.debugging
|
|
109
|
+
@api_client.config.logger.debug 'Calling API: ConstraintApi.delete_constraint ...'
|
|
110
|
+
end
|
|
111
|
+
# verify the required parameter 'flag_id' is set
|
|
112
|
+
if @api_client.config.client_side_validation && flag_id.nil?
|
|
113
|
+
fail ArgumentError, "Missing the required parameter 'flag_id' when calling ConstraintApi.delete_constraint"
|
|
114
|
+
end
|
|
115
|
+
if @api_client.config.client_side_validation && flag_id < 1
|
|
116
|
+
fail ArgumentError, 'invalid value for "flag_id" when calling ConstraintApi.delete_constraint, must be greater than or equal to 1.'
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
# verify the required parameter 'segment_id' is set
|
|
120
|
+
if @api_client.config.client_side_validation && segment_id.nil?
|
|
121
|
+
fail ArgumentError, "Missing the required parameter 'segment_id' when calling ConstraintApi.delete_constraint"
|
|
122
|
+
end
|
|
123
|
+
if @api_client.config.client_side_validation && segment_id < 1
|
|
124
|
+
fail ArgumentError, 'invalid value for "segment_id" when calling ConstraintApi.delete_constraint, must be greater than or equal to 1.'
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
# verify the required parameter 'constraint_id' is set
|
|
128
|
+
if @api_client.config.client_side_validation && constraint_id.nil?
|
|
129
|
+
fail ArgumentError, "Missing the required parameter 'constraint_id' when calling ConstraintApi.delete_constraint"
|
|
130
|
+
end
|
|
131
|
+
if @api_client.config.client_side_validation && constraint_id < 1
|
|
132
|
+
fail ArgumentError, 'invalid value for "constraint_id" when calling ConstraintApi.delete_constraint, must be greater than or equal to 1.'
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
# resource path
|
|
136
|
+
local_var_path = '/flags/{flagID}/segments/{segmentID}/constraints/{constraintID}'.sub('{' + 'flagID' + '}', flag_id.to_s).sub('{' + 'segmentID' + '}', segment_id.to_s).sub('{' + 'constraintID' + '}', constraint_id.to_s)
|
|
137
|
+
|
|
138
|
+
# query parameters
|
|
139
|
+
query_params = {}
|
|
140
|
+
|
|
141
|
+
# header parameters
|
|
142
|
+
header_params = {}
|
|
143
|
+
# HTTP header 'Accept' (if needed)
|
|
144
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
145
|
+
# HTTP header 'Content-Type'
|
|
146
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
|
147
|
+
|
|
148
|
+
# form parameters
|
|
149
|
+
form_params = {}
|
|
150
|
+
|
|
151
|
+
# http body (model)
|
|
152
|
+
post_body = nil
|
|
153
|
+
auth_names = []
|
|
154
|
+
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
|
|
155
|
+
:header_params => header_params,
|
|
156
|
+
:query_params => query_params,
|
|
157
|
+
:form_params => form_params,
|
|
158
|
+
:body => post_body,
|
|
159
|
+
:auth_names => auth_names)
|
|
160
|
+
if @api_client.config.debugging
|
|
161
|
+
@api_client.config.logger.debug "API called: ConstraintApi#delete_constraint\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
162
|
+
end
|
|
163
|
+
return data, status_code, headers
|
|
164
|
+
end
|
|
165
|
+
# @param flag_id numeric ID of the flag
|
|
166
|
+
# @param segment_id numeric ID of the segment
|
|
167
|
+
# @param [Hash] opts the optional parameters
|
|
168
|
+
# @return [Array<Constraint>]
|
|
169
|
+
def find_constraints(flag_id, segment_id, opts = {})
|
|
170
|
+
data, _status_code, _headers = find_constraints_with_http_info(flag_id, segment_id, opts)
|
|
171
|
+
data
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
# @param flag_id numeric ID of the flag
|
|
175
|
+
# @param segment_id numeric ID of the segment
|
|
176
|
+
# @param [Hash] opts the optional parameters
|
|
177
|
+
# @return [Array<(Array<Constraint>, Fixnum, Hash)>] Array<Constraint> data, response status code and response headers
|
|
178
|
+
def find_constraints_with_http_info(flag_id, segment_id, opts = {})
|
|
179
|
+
if @api_client.config.debugging
|
|
180
|
+
@api_client.config.logger.debug 'Calling API: ConstraintApi.find_constraints ...'
|
|
181
|
+
end
|
|
182
|
+
# verify the required parameter 'flag_id' is set
|
|
183
|
+
if @api_client.config.client_side_validation && flag_id.nil?
|
|
184
|
+
fail ArgumentError, "Missing the required parameter 'flag_id' when calling ConstraintApi.find_constraints"
|
|
185
|
+
end
|
|
186
|
+
if @api_client.config.client_side_validation && flag_id < 1
|
|
187
|
+
fail ArgumentError, 'invalid value for "flag_id" when calling ConstraintApi.find_constraints, must be greater than or equal to 1.'
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
# verify the required parameter 'segment_id' is set
|
|
191
|
+
if @api_client.config.client_side_validation && segment_id.nil?
|
|
192
|
+
fail ArgumentError, "Missing the required parameter 'segment_id' when calling ConstraintApi.find_constraints"
|
|
193
|
+
end
|
|
194
|
+
if @api_client.config.client_side_validation && segment_id < 1
|
|
195
|
+
fail ArgumentError, 'invalid value for "segment_id" when calling ConstraintApi.find_constraints, must be greater than or equal to 1.'
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
# resource path
|
|
199
|
+
local_var_path = '/flags/{flagID}/segments/{segmentID}/constraints'.sub('{' + 'flagID' + '}', flag_id.to_s).sub('{' + 'segmentID' + '}', segment_id.to_s)
|
|
200
|
+
|
|
201
|
+
# query parameters
|
|
202
|
+
query_params = {}
|
|
203
|
+
|
|
204
|
+
# header parameters
|
|
205
|
+
header_params = {}
|
|
206
|
+
# HTTP header 'Accept' (if needed)
|
|
207
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
208
|
+
# HTTP header 'Content-Type'
|
|
209
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
|
210
|
+
|
|
211
|
+
# form parameters
|
|
212
|
+
form_params = {}
|
|
213
|
+
|
|
214
|
+
# http body (model)
|
|
215
|
+
post_body = nil
|
|
216
|
+
auth_names = []
|
|
217
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
|
218
|
+
:header_params => header_params,
|
|
219
|
+
:query_params => query_params,
|
|
220
|
+
:form_params => form_params,
|
|
221
|
+
:body => post_body,
|
|
222
|
+
:auth_names => auth_names,
|
|
223
|
+
:return_type => 'Array<Constraint>')
|
|
224
|
+
if @api_client.config.debugging
|
|
225
|
+
@api_client.config.logger.debug "API called: ConstraintApi#find_constraints\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
226
|
+
end
|
|
227
|
+
return data, status_code, headers
|
|
228
|
+
end
|
|
229
|
+
# @param flag_id numeric ID of the flag
|
|
230
|
+
# @param segment_id numeric ID of the segment
|
|
231
|
+
# @param constraint_id numeric ID of the constraint
|
|
232
|
+
# @param body create a constraint
|
|
233
|
+
# @param [Hash] opts the optional parameters
|
|
234
|
+
# @return [Constraint]
|
|
235
|
+
def put_constraint(flag_id, segment_id, constraint_id, body, opts = {})
|
|
236
|
+
data, _status_code, _headers = put_constraint_with_http_info(flag_id, segment_id, constraint_id, body, opts)
|
|
237
|
+
data
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
# @param flag_id numeric ID of the flag
|
|
241
|
+
# @param segment_id numeric ID of the segment
|
|
242
|
+
# @param constraint_id numeric ID of the constraint
|
|
243
|
+
# @param body create a constraint
|
|
244
|
+
# @param [Hash] opts the optional parameters
|
|
245
|
+
# @return [Array<(Constraint, Fixnum, Hash)>] Constraint data, response status code and response headers
|
|
246
|
+
def put_constraint_with_http_info(flag_id, segment_id, constraint_id, body, opts = {})
|
|
247
|
+
if @api_client.config.debugging
|
|
248
|
+
@api_client.config.logger.debug 'Calling API: ConstraintApi.put_constraint ...'
|
|
249
|
+
end
|
|
250
|
+
# verify the required parameter 'flag_id' is set
|
|
251
|
+
if @api_client.config.client_side_validation && flag_id.nil?
|
|
252
|
+
fail ArgumentError, "Missing the required parameter 'flag_id' when calling ConstraintApi.put_constraint"
|
|
253
|
+
end
|
|
254
|
+
if @api_client.config.client_side_validation && flag_id < 1
|
|
255
|
+
fail ArgumentError, 'invalid value for "flag_id" when calling ConstraintApi.put_constraint, must be greater than or equal to 1.'
|
|
256
|
+
end
|
|
257
|
+
|
|
258
|
+
# verify the required parameter 'segment_id' is set
|
|
259
|
+
if @api_client.config.client_side_validation && segment_id.nil?
|
|
260
|
+
fail ArgumentError, "Missing the required parameter 'segment_id' when calling ConstraintApi.put_constraint"
|
|
261
|
+
end
|
|
262
|
+
if @api_client.config.client_side_validation && segment_id < 1
|
|
263
|
+
fail ArgumentError, 'invalid value for "segment_id" when calling ConstraintApi.put_constraint, must be greater than or equal to 1.'
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
# verify the required parameter 'constraint_id' is set
|
|
267
|
+
if @api_client.config.client_side_validation && constraint_id.nil?
|
|
268
|
+
fail ArgumentError, "Missing the required parameter 'constraint_id' when calling ConstraintApi.put_constraint"
|
|
269
|
+
end
|
|
270
|
+
if @api_client.config.client_side_validation && constraint_id < 1
|
|
271
|
+
fail ArgumentError, 'invalid value for "constraint_id" when calling ConstraintApi.put_constraint, must be greater than or equal to 1.'
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
# verify the required parameter 'body' is set
|
|
275
|
+
if @api_client.config.client_side_validation && body.nil?
|
|
276
|
+
fail ArgumentError, "Missing the required parameter 'body' when calling ConstraintApi.put_constraint"
|
|
277
|
+
end
|
|
278
|
+
# resource path
|
|
279
|
+
local_var_path = '/flags/{flagID}/segments/{segmentID}/constraints/{constraintID}'.sub('{' + 'flagID' + '}', flag_id.to_s).sub('{' + 'segmentID' + '}', segment_id.to_s).sub('{' + 'constraintID' + '}', constraint_id.to_s)
|
|
280
|
+
|
|
281
|
+
# query parameters
|
|
282
|
+
query_params = {}
|
|
283
|
+
|
|
284
|
+
# header parameters
|
|
285
|
+
header_params = {}
|
|
286
|
+
# HTTP header 'Accept' (if needed)
|
|
287
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
288
|
+
# HTTP header 'Content-Type'
|
|
289
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
|
290
|
+
|
|
291
|
+
# form parameters
|
|
292
|
+
form_params = {}
|
|
293
|
+
|
|
294
|
+
# http body (model)
|
|
295
|
+
post_body = @api_client.object_to_http_body(body)
|
|
296
|
+
auth_names = []
|
|
297
|
+
data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
|
|
298
|
+
:header_params => header_params,
|
|
299
|
+
:query_params => query_params,
|
|
300
|
+
:form_params => form_params,
|
|
301
|
+
:body => post_body,
|
|
302
|
+
:auth_names => auth_names,
|
|
303
|
+
:return_type => 'Constraint')
|
|
304
|
+
if @api_client.config.debugging
|
|
305
|
+
@api_client.config.logger.debug "API called: ConstraintApi#put_constraint\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
306
|
+
end
|
|
307
|
+
return data, status_code, headers
|
|
308
|
+
end
|
|
309
|
+
end
|
|
310
|
+
end
|
|
@@ -0,0 +1,159 @@
|
|
|
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 DistributionApi
|
|
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 segment_id numeric ID of the segment
|
|
24
|
+
# @param [Hash] opts the optional parameters
|
|
25
|
+
# @return [Array<Distribution>]
|
|
26
|
+
def find_distributions(flag_id, segment_id, opts = {})
|
|
27
|
+
data, _status_code, _headers = find_distributions_with_http_info(flag_id, segment_id, opts)
|
|
28
|
+
data
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# @param flag_id numeric ID of the flag
|
|
32
|
+
# @param segment_id numeric ID of the segment
|
|
33
|
+
# @param [Hash] opts the optional parameters
|
|
34
|
+
# @return [Array<(Array<Distribution>, Fixnum, Hash)>] Array<Distribution> data, response status code and response headers
|
|
35
|
+
def find_distributions_with_http_info(flag_id, segment_id, opts = {})
|
|
36
|
+
if @api_client.config.debugging
|
|
37
|
+
@api_client.config.logger.debug 'Calling API: DistributionApi.find_distributions ...'
|
|
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 DistributionApi.find_distributions"
|
|
42
|
+
end
|
|
43
|
+
if @api_client.config.client_side_validation && flag_id < 1
|
|
44
|
+
fail ArgumentError, 'invalid value for "flag_id" when calling DistributionApi.find_distributions, must be greater than or equal to 1.'
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# verify the required parameter 'segment_id' is set
|
|
48
|
+
if @api_client.config.client_side_validation && segment_id.nil?
|
|
49
|
+
fail ArgumentError, "Missing the required parameter 'segment_id' when calling DistributionApi.find_distributions"
|
|
50
|
+
end
|
|
51
|
+
if @api_client.config.client_side_validation && segment_id < 1
|
|
52
|
+
fail ArgumentError, 'invalid value for "segment_id" when calling DistributionApi.find_distributions, must be greater than or equal to 1.'
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# resource path
|
|
56
|
+
local_var_path = '/flags/{flagID}/segments/{segmentID}/distributions'.sub('{' + 'flagID' + '}', flag_id.to_s).sub('{' + 'segmentID' + '}', segment_id.to_s)
|
|
57
|
+
|
|
58
|
+
# query parameters
|
|
59
|
+
query_params = {}
|
|
60
|
+
|
|
61
|
+
# header parameters
|
|
62
|
+
header_params = {}
|
|
63
|
+
# HTTP header 'Accept' (if needed)
|
|
64
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
65
|
+
# HTTP header 'Content-Type'
|
|
66
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
|
67
|
+
|
|
68
|
+
# form parameters
|
|
69
|
+
form_params = {}
|
|
70
|
+
|
|
71
|
+
# http body (model)
|
|
72
|
+
post_body = nil
|
|
73
|
+
auth_names = []
|
|
74
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
|
75
|
+
:header_params => header_params,
|
|
76
|
+
:query_params => query_params,
|
|
77
|
+
:form_params => form_params,
|
|
78
|
+
:body => post_body,
|
|
79
|
+
:auth_names => auth_names,
|
|
80
|
+
:return_type => 'Array<Distribution>')
|
|
81
|
+
if @api_client.config.debugging
|
|
82
|
+
@api_client.config.logger.debug "API called: DistributionApi#find_distributions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
83
|
+
end
|
|
84
|
+
return data, status_code, headers
|
|
85
|
+
end
|
|
86
|
+
# replace the distribution with the new setting
|
|
87
|
+
# @param flag_id numeric ID of the flag
|
|
88
|
+
# @param segment_id numeric ID of the segment
|
|
89
|
+
# @param body array of distributions
|
|
90
|
+
# @param [Hash] opts the optional parameters
|
|
91
|
+
# @return [Array<Distribution>]
|
|
92
|
+
def put_distributions(flag_id, segment_id, body, opts = {})
|
|
93
|
+
data, _status_code, _headers = put_distributions_with_http_info(flag_id, segment_id, body, opts)
|
|
94
|
+
data
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# replace the distribution with the new setting
|
|
98
|
+
# @param flag_id numeric ID of the flag
|
|
99
|
+
# @param segment_id numeric ID of the segment
|
|
100
|
+
# @param body array of distributions
|
|
101
|
+
# @param [Hash] opts the optional parameters
|
|
102
|
+
# @return [Array<(Array<Distribution>, Fixnum, Hash)>] Array<Distribution> data, response status code and response headers
|
|
103
|
+
def put_distributions_with_http_info(flag_id, segment_id, body, opts = {})
|
|
104
|
+
if @api_client.config.debugging
|
|
105
|
+
@api_client.config.logger.debug 'Calling API: DistributionApi.put_distributions ...'
|
|
106
|
+
end
|
|
107
|
+
# verify the required parameter 'flag_id' is set
|
|
108
|
+
if @api_client.config.client_side_validation && flag_id.nil?
|
|
109
|
+
fail ArgumentError, "Missing the required parameter 'flag_id' when calling DistributionApi.put_distributions"
|
|
110
|
+
end
|
|
111
|
+
if @api_client.config.client_side_validation && flag_id < 1
|
|
112
|
+
fail ArgumentError, 'invalid value for "flag_id" when calling DistributionApi.put_distributions, must be greater than or equal to 1.'
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
# verify the required parameter 'segment_id' is set
|
|
116
|
+
if @api_client.config.client_side_validation && segment_id.nil?
|
|
117
|
+
fail ArgumentError, "Missing the required parameter 'segment_id' when calling DistributionApi.put_distributions"
|
|
118
|
+
end
|
|
119
|
+
if @api_client.config.client_side_validation && segment_id < 1
|
|
120
|
+
fail ArgumentError, 'invalid value for "segment_id" when calling DistributionApi.put_distributions, must be greater than or equal to 1.'
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
# verify the required parameter 'body' is set
|
|
124
|
+
if @api_client.config.client_side_validation && body.nil?
|
|
125
|
+
fail ArgumentError, "Missing the required parameter 'body' when calling DistributionApi.put_distributions"
|
|
126
|
+
end
|
|
127
|
+
# resource path
|
|
128
|
+
local_var_path = '/flags/{flagID}/segments/{segmentID}/distributions'.sub('{' + 'flagID' + '}', flag_id.to_s).sub('{' + 'segmentID' + '}', segment_id.to_s)
|
|
129
|
+
|
|
130
|
+
# query parameters
|
|
131
|
+
query_params = {}
|
|
132
|
+
|
|
133
|
+
# header parameters
|
|
134
|
+
header_params = {}
|
|
135
|
+
# HTTP header 'Accept' (if needed)
|
|
136
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
137
|
+
# HTTP header 'Content-Type'
|
|
138
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
|
139
|
+
|
|
140
|
+
# form parameters
|
|
141
|
+
form_params = {}
|
|
142
|
+
|
|
143
|
+
# http body (model)
|
|
144
|
+
post_body = @api_client.object_to_http_body(body)
|
|
145
|
+
auth_names = []
|
|
146
|
+
data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
|
|
147
|
+
:header_params => header_params,
|
|
148
|
+
:query_params => query_params,
|
|
149
|
+
:form_params => form_params,
|
|
150
|
+
:body => post_body,
|
|
151
|
+
:auth_names => auth_names,
|
|
152
|
+
:return_type => 'Array<Distribution>')
|
|
153
|
+
if @api_client.config.debugging
|
|
154
|
+
@api_client.config.logger.debug "API called: DistributionApi#put_distributions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
155
|
+
end
|
|
156
|
+
return data, status_code, headers
|
|
157
|
+
end
|
|
158
|
+
end
|
|
159
|
+
end
|