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,207 @@
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 'date'
14
+
15
+ module Flagr
16
+ class CreateFlagRequest
17
+ attr_accessor :description
18
+
19
+ # Attribute mapping from ruby-style variable name to JSON key.
20
+ def self.attribute_map
21
+ {
22
+ :'description' => :'description'
23
+ }
24
+ end
25
+
26
+ # Attribute type mapping.
27
+ def self.swagger_types
28
+ {
29
+ :'description' => :'String'
30
+ }
31
+ end
32
+
33
+ # Initializes the object
34
+ # @param [Hash] attributes Model attributes in the form of hash
35
+ def initialize(attributes = {})
36
+ return unless attributes.is_a?(Hash)
37
+
38
+ # convert string to symbol for hash key
39
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
40
+
41
+ if attributes.has_key?(:'description')
42
+ self.description = attributes[:'description']
43
+ end
44
+ end
45
+
46
+ # Show invalid properties with the reasons. Usually used together with valid?
47
+ # @return Array for valid properties with the reasons
48
+ def list_invalid_properties
49
+ invalid_properties = Array.new
50
+ if @description.nil?
51
+ invalid_properties.push('invalid value for "description", description cannot be nil.')
52
+ end
53
+
54
+ if @description.to_s.length < 1
55
+ invalid_properties.push('invalid value for "description", the character length must be great than or equal to 1.')
56
+ end
57
+
58
+ invalid_properties
59
+ end
60
+
61
+ # Check to see if the all the properties in the model are valid
62
+ # @return true if the model is valid
63
+ def valid?
64
+ return false if @description.nil?
65
+ return false if @description.to_s.length < 1
66
+ true
67
+ end
68
+
69
+ # Custom attribute writer method with validation
70
+ # @param [Object] description Value to be assigned
71
+ def description=(description)
72
+ if description.nil?
73
+ fail ArgumentError, 'description cannot be nil'
74
+ end
75
+
76
+ if description.to_s.length < 1
77
+ fail ArgumentError, 'invalid value for "description", the character length must be great than or equal to 1.'
78
+ end
79
+
80
+ @description = description
81
+ end
82
+
83
+ # Checks equality by comparing each attribute.
84
+ # @param [Object] Object to be compared
85
+ def ==(o)
86
+ return true if self.equal?(o)
87
+ self.class == o.class &&
88
+ description == o.description
89
+ end
90
+
91
+ # @see the `==` method
92
+ # @param [Object] Object to be compared
93
+ def eql?(o)
94
+ self == o
95
+ end
96
+
97
+ # Calculates hash code according to all attributes.
98
+ # @return [Fixnum] Hash code
99
+ def hash
100
+ [description].hash
101
+ end
102
+
103
+ # Builds the object from hash
104
+ # @param [Hash] attributes Model attributes in the form of hash
105
+ # @return [Object] Returns the model itself
106
+ def build_from_hash(attributes)
107
+ return nil unless attributes.is_a?(Hash)
108
+ self.class.swagger_types.each_pair do |key, type|
109
+ if type =~ /\AArray<(.*)>/i
110
+ # check to ensure the input is an array given that the the attribute
111
+ # is documented as an array but the input is not
112
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
113
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
114
+ end
115
+ elsif !attributes[self.class.attribute_map[key]].nil?
116
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
117
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
118
+ end
119
+
120
+ self
121
+ end
122
+
123
+ # Deserializes the data based on type
124
+ # @param string type Data type
125
+ # @param string value Value to be deserialized
126
+ # @return [Object] Deserialized data
127
+ def _deserialize(type, value)
128
+ case type.to_sym
129
+ when :DateTime
130
+ DateTime.parse(value)
131
+ when :Date
132
+ Date.parse(value)
133
+ when :String
134
+ value.to_s
135
+ when :Integer
136
+ value.to_i
137
+ when :Float
138
+ value.to_f
139
+ when :BOOLEAN
140
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
141
+ true
142
+ else
143
+ false
144
+ end
145
+ when :Object
146
+ # generic object (usually a Hash), return directly
147
+ value
148
+ when /\AArray<(?<inner_type>.+)>\z/
149
+ inner_type = Regexp.last_match[:inner_type]
150
+ value.map { |v| _deserialize(inner_type, v) }
151
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
152
+ k_type = Regexp.last_match[:k_type]
153
+ v_type = Regexp.last_match[:v_type]
154
+ {}.tap do |hash|
155
+ value.each do |k, v|
156
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
157
+ end
158
+ end
159
+ else # model
160
+ temp_model = Flagr.const_get(type).new
161
+ temp_model.build_from_hash(value)
162
+ end
163
+ end
164
+
165
+ # Returns the string representation of the object
166
+ # @return [String] String presentation of the object
167
+ def to_s
168
+ to_hash.to_s
169
+ end
170
+
171
+ # to_body is an alias to to_hash (backward compatibility)
172
+ # @return [Hash] Returns the object in the form of hash
173
+ def to_body
174
+ to_hash
175
+ end
176
+
177
+ # Returns the object in the form of hash
178
+ # @return [Hash] Returns the object in the form of hash
179
+ def to_hash
180
+ hash = {}
181
+ self.class.attribute_map.each_pair do |attr, param|
182
+ value = self.send(attr)
183
+ next if value.nil?
184
+ hash[param] = _to_hash(value)
185
+ end
186
+ hash
187
+ end
188
+
189
+ # Outputs non-array value in the form of hash
190
+ # For object, use to_hash. Otherwise, just return the value
191
+ # @param [Object] value Any valid value
192
+ # @return [Hash] Returns the value in the form of hash
193
+ def _to_hash(value)
194
+ if value.is_a?(Array)
195
+ value.compact.map { |v| _to_hash(v) }
196
+ elsif value.is_a?(Hash)
197
+ {}.tap do |hash|
198
+ value.each { |k, v| hash[k] = _to_hash(v) }
199
+ end
200
+ elsif value.respond_to? :to_hash
201
+ value.to_hash
202
+ else
203
+ value
204
+ end
205
+ end
206
+ end
207
+ end
@@ -0,0 +1,249 @@
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 'date'
14
+
15
+ module Flagr
16
+ class CreateSegmentRequest
17
+ attr_accessor :description
18
+
19
+ attr_accessor :rollout_percent
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'description' => :'description',
25
+ :'rollout_percent' => :'rolloutPercent'
26
+ }
27
+ end
28
+
29
+ # Attribute type mapping.
30
+ def self.swagger_types
31
+ {
32
+ :'description' => :'String',
33
+ :'rollout_percent' => :'Integer'
34
+ }
35
+ end
36
+
37
+ # Initializes the object
38
+ # @param [Hash] attributes Model attributes in the form of hash
39
+ def initialize(attributes = {})
40
+ return unless attributes.is_a?(Hash)
41
+
42
+ # convert string to symbol for hash key
43
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
44
+
45
+ if attributes.has_key?(:'description')
46
+ self.description = attributes[:'description']
47
+ end
48
+
49
+ if attributes.has_key?(:'rolloutPercent')
50
+ self.rollout_percent = attributes[:'rolloutPercent']
51
+ end
52
+ end
53
+
54
+ # Show invalid properties with the reasons. Usually used together with valid?
55
+ # @return Array for valid properties with the reasons
56
+ def list_invalid_properties
57
+ invalid_properties = Array.new
58
+ if @description.nil?
59
+ invalid_properties.push('invalid value for "description", description cannot be nil.')
60
+ end
61
+
62
+ if @description.to_s.length < 1
63
+ invalid_properties.push('invalid value for "description", the character length must be great than or equal to 1.')
64
+ end
65
+
66
+ if @rollout_percent.nil?
67
+ invalid_properties.push('invalid value for "rollout_percent", rollout_percent cannot be nil.')
68
+ end
69
+
70
+ if @rollout_percent > 100
71
+ invalid_properties.push('invalid value for "rollout_percent", must be smaller than or equal to 100.')
72
+ end
73
+
74
+ if @rollout_percent < 0
75
+ invalid_properties.push('invalid value for "rollout_percent", must be greater than or equal to 0.')
76
+ end
77
+
78
+ invalid_properties
79
+ end
80
+
81
+ # Check to see if the all the properties in the model are valid
82
+ # @return true if the model is valid
83
+ def valid?
84
+ return false if @description.nil?
85
+ return false if @description.to_s.length < 1
86
+ return false if @rollout_percent.nil?
87
+ return false if @rollout_percent > 100
88
+ return false if @rollout_percent < 0
89
+ true
90
+ end
91
+
92
+ # Custom attribute writer method with validation
93
+ # @param [Object] description Value to be assigned
94
+ def description=(description)
95
+ if description.nil?
96
+ fail ArgumentError, 'description cannot be nil'
97
+ end
98
+
99
+ if description.to_s.length < 1
100
+ fail ArgumentError, 'invalid value for "description", the character length must be great than or equal to 1.'
101
+ end
102
+
103
+ @description = description
104
+ end
105
+
106
+ # Custom attribute writer method with validation
107
+ # @param [Object] rollout_percent Value to be assigned
108
+ def rollout_percent=(rollout_percent)
109
+ if rollout_percent.nil?
110
+ fail ArgumentError, 'rollout_percent cannot be nil'
111
+ end
112
+
113
+ if rollout_percent > 100
114
+ fail ArgumentError, 'invalid value for "rollout_percent", must be smaller than or equal to 100.'
115
+ end
116
+
117
+ if rollout_percent < 0
118
+ fail ArgumentError, 'invalid value for "rollout_percent", must be greater than or equal to 0.'
119
+ end
120
+
121
+ @rollout_percent = rollout_percent
122
+ end
123
+
124
+ # Checks equality by comparing each attribute.
125
+ # @param [Object] Object to be compared
126
+ def ==(o)
127
+ return true if self.equal?(o)
128
+ self.class == o.class &&
129
+ description == o.description &&
130
+ rollout_percent == o.rollout_percent
131
+ end
132
+
133
+ # @see the `==` method
134
+ # @param [Object] Object to be compared
135
+ def eql?(o)
136
+ self == o
137
+ end
138
+
139
+ # Calculates hash code according to all attributes.
140
+ # @return [Fixnum] Hash code
141
+ def hash
142
+ [description, rollout_percent].hash
143
+ end
144
+
145
+ # Builds the object from hash
146
+ # @param [Hash] attributes Model attributes in the form of hash
147
+ # @return [Object] Returns the model itself
148
+ def build_from_hash(attributes)
149
+ return nil unless attributes.is_a?(Hash)
150
+ self.class.swagger_types.each_pair do |key, type|
151
+ if type =~ /\AArray<(.*)>/i
152
+ # check to ensure the input is an array given that the the attribute
153
+ # is documented as an array but the input is not
154
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
155
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
156
+ end
157
+ elsif !attributes[self.class.attribute_map[key]].nil?
158
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
159
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
160
+ end
161
+
162
+ self
163
+ end
164
+
165
+ # Deserializes the data based on type
166
+ # @param string type Data type
167
+ # @param string value Value to be deserialized
168
+ # @return [Object] Deserialized data
169
+ def _deserialize(type, value)
170
+ case type.to_sym
171
+ when :DateTime
172
+ DateTime.parse(value)
173
+ when :Date
174
+ Date.parse(value)
175
+ when :String
176
+ value.to_s
177
+ when :Integer
178
+ value.to_i
179
+ when :Float
180
+ value.to_f
181
+ when :BOOLEAN
182
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
183
+ true
184
+ else
185
+ false
186
+ end
187
+ when :Object
188
+ # generic object (usually a Hash), return directly
189
+ value
190
+ when /\AArray<(?<inner_type>.+)>\z/
191
+ inner_type = Regexp.last_match[:inner_type]
192
+ value.map { |v| _deserialize(inner_type, v) }
193
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
194
+ k_type = Regexp.last_match[:k_type]
195
+ v_type = Regexp.last_match[:v_type]
196
+ {}.tap do |hash|
197
+ value.each do |k, v|
198
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
199
+ end
200
+ end
201
+ else # model
202
+ temp_model = Flagr.const_get(type).new
203
+ temp_model.build_from_hash(value)
204
+ end
205
+ end
206
+
207
+ # Returns the string representation of the object
208
+ # @return [String] String presentation of the object
209
+ def to_s
210
+ to_hash.to_s
211
+ end
212
+
213
+ # to_body is an alias to to_hash (backward compatibility)
214
+ # @return [Hash] Returns the object in the form of hash
215
+ def to_body
216
+ to_hash
217
+ end
218
+
219
+ # Returns the object in the form of hash
220
+ # @return [Hash] Returns the object in the form of hash
221
+ def to_hash
222
+ hash = {}
223
+ self.class.attribute_map.each_pair do |attr, param|
224
+ value = self.send(attr)
225
+ next if value.nil?
226
+ hash[param] = _to_hash(value)
227
+ end
228
+ hash
229
+ end
230
+
231
+ # Outputs non-array value in the form of hash
232
+ # For object, use to_hash. Otherwise, just return the value
233
+ # @param [Object] value Any valid value
234
+ # @return [Hash] Returns the value in the form of hash
235
+ def _to_hash(value)
236
+ if value.is_a?(Array)
237
+ value.compact.map { |v| _to_hash(v) }
238
+ elsif value.is_a?(Hash)
239
+ {}.tap do |hash|
240
+ value.each { |k, v| hash[k] = _to_hash(v) }
241
+ end
242
+ elsif value.respond_to? :to_hash
243
+ value.to_hash
244
+ else
245
+ value
246
+ end
247
+ end
248
+ end
249
+ end