ff-ruby-server-sdk 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -1
  3. data/Gemfile +0 -3
  4. data/lib/ff/ruby/server/generated/lib/openapi_client/api/client_api.rb +545 -0
  5. data/lib/ff/ruby/server/generated/lib/openapi_client/api/metrics_api.rb +89 -0
  6. data/lib/ff/ruby/server/generated/lib/openapi_client/api_client.rb +390 -0
  7. data/lib/ff/ruby/server/generated/lib/openapi_client/api_error.rb +57 -0
  8. data/lib/ff/ruby/server/generated/lib/openapi_client/configuration.rb +282 -0
  9. data/lib/ff/ruby/server/generated/lib/openapi_client/models/authentication_request.rb +232 -0
  10. data/lib/ff/ruby/server/generated/lib/openapi_client/models/authentication_request_target.rb +250 -0
  11. data/lib/ff/ruby/server/generated/lib/openapi_client/models/authentication_response.rb +223 -0
  12. data/lib/ff/ruby/server/generated/lib/openapi_client/models/clause.rb +281 -0
  13. data/lib/ff/ruby/server/generated/lib/openapi_client/models/distribution.rb +239 -0
  14. data/lib/ff/ruby/server/generated/lib/openapi_client/models/error.rb +237 -0
  15. data/lib/ff/ruby/server/generated/lib/openapi_client/models/evaluation.rb +260 -0
  16. data/lib/ff/ruby/server/generated/lib/openapi_client/models/feature_config.rb +418 -0
  17. data/lib/ff/ruby/server/generated/lib/openapi_client/models/feature_state.rb +37 -0
  18. data/lib/ff/ruby/server/generated/lib/openapi_client/models/key_value.rb +237 -0
  19. data/lib/ff/ruby/server/generated/lib/openapi_client/models/metrics.rb +231 -0
  20. data/lib/ff/ruby/server/generated/lib/openapi_client/models/metrics_data.rb +303 -0
  21. data/lib/ff/ruby/server/generated/lib/openapi_client/models/pagination.rb +274 -0
  22. data/lib/ff/ruby/server/generated/lib/openapi_client/models/prerequisite.rb +239 -0
  23. data/lib/ff/ruby/server/generated/lib/openapi_client/models/segment.rb +320 -0
  24. data/lib/ff/ruby/server/generated/lib/openapi_client/models/serve.rb +227 -0
  25. data/lib/ff/ruby/server/generated/lib/openapi_client/models/serving_rule.rb +267 -0
  26. data/lib/ff/ruby/server/generated/lib/openapi_client/models/tag.rb +233 -0
  27. data/lib/ff/ruby/server/generated/lib/openapi_client/models/target.rb +331 -0
  28. data/lib/ff/ruby/server/generated/lib/openapi_client/models/target_data.rb +253 -0
  29. data/lib/ff/ruby/server/generated/lib/openapi_client/models/target_map.rb +232 -0
  30. data/lib/ff/ruby/server/generated/lib/openapi_client/models/variation.rb +255 -0
  31. data/lib/ff/ruby/server/generated/lib/openapi_client/models/variation_map.rb +245 -0
  32. data/lib/ff/ruby/server/generated/lib/openapi_client/models/weighted_variation.rb +237 -0
  33. data/lib/ff/ruby/server/generated/lib/openapi_client/version.rb +15 -0
  34. data/lib/ff/ruby/server/generated/lib/openapi_client.rb +65 -0
  35. data/lib/ff/ruby/server/sdk/api/cf_client.rb +1 -1
  36. data/lib/ff/ruby/server/sdk/version.rb +1 -1
  37. data/scripts/install.sh +8 -2
  38. data/scripts/openapi.sh +51 -10
  39. data/scripts/publish.sh +1 -1
  40. data/scripts/sdk_specs.sh +1 -1
  41. metadata +38 -11
  42. data/.run/build.sh.run.xml +0 -17
  43. data/.run/install.sh.run.xml +0 -17
  44. data/.run/openapi.sh.run.xml +0 -17
  45. data/.run/publish.sh.run.xml +0 -17
  46. data/.run/unpublish.sh.run.xml +0 -17
@@ -0,0 +1,231 @@
1
+ =begin
2
+ #Harness feature flag service client apis
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: cf@harness.io
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.2.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module OpenapiClient
17
+ class Metrics
18
+ attr_accessor :target_data
19
+
20
+ attr_accessor :metrics_data
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'target_data' => :'targetData',
26
+ :'metrics_data' => :'metricsData'
27
+ }
28
+ end
29
+
30
+ # Returns all the JSON keys this model knows about
31
+ def self.acceptable_attributes
32
+ attribute_map.values
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.openapi_types
37
+ {
38
+ :'target_data' => :'Array<TargetData>',
39
+ :'metrics_data' => :'Array<MetricsData>'
40
+ }
41
+ end
42
+
43
+ # List of attributes with nullable: true
44
+ def self.openapi_nullable
45
+ Set.new([
46
+ ])
47
+ end
48
+
49
+ # Initializes the object
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ def initialize(attributes = {})
52
+ if (!attributes.is_a?(Hash))
53
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::Metrics` initialize method"
54
+ end
55
+
56
+ # check to see if the attribute exists and convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}) { |(k, v), h|
58
+ if (!self.class.attribute_map.key?(k.to_sym))
59
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::Metrics`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
60
+ end
61
+ h[k.to_sym] = v
62
+ }
63
+
64
+ if attributes.key?(:'target_data')
65
+ if (value = attributes[:'target_data']).is_a?(Array)
66
+ self.target_data = value
67
+ end
68
+ end
69
+
70
+ if attributes.key?(:'metrics_data')
71
+ if (value = attributes[:'metrics_data']).is_a?(Array)
72
+ self.metrics_data = value
73
+ end
74
+ end
75
+ end
76
+
77
+ # Show invalid properties with the reasons. Usually used together with valid?
78
+ # @return Array for valid properties with the reasons
79
+ def list_invalid_properties
80
+ invalid_properties = Array.new
81
+ invalid_properties
82
+ end
83
+
84
+ # Check to see if the all the properties in the model are valid
85
+ # @return true if the model is valid
86
+ def valid?
87
+ true
88
+ end
89
+
90
+ # Checks equality by comparing each attribute.
91
+ # @param [Object] Object to be compared
92
+ def ==(o)
93
+ return true if self.equal?(o)
94
+ self.class == o.class &&
95
+ target_data == o.target_data &&
96
+ metrics_data == o.metrics_data
97
+ end
98
+
99
+ # @see the `==` method
100
+ # @param [Object] Object to be compared
101
+ def eql?(o)
102
+ self == o
103
+ end
104
+
105
+ # Calculates hash code according to all attributes.
106
+ # @return [Integer] Hash code
107
+ def hash
108
+ [target_data, metrics_data].hash
109
+ end
110
+
111
+ # Builds the object from hash
112
+ # @param [Hash] attributes Model attributes in the form of hash
113
+ # @return [Object] Returns the model itself
114
+ def self.build_from_hash(attributes)
115
+ new.build_from_hash(attributes)
116
+ end
117
+
118
+ # Builds the object from hash
119
+ # @param [Hash] attributes Model attributes in the form of hash
120
+ # @return [Object] Returns the model itself
121
+ def build_from_hash(attributes)
122
+ return nil unless attributes.is_a?(Hash)
123
+ self.class.openapi_types.each_pair do |key, type|
124
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
125
+ self.send("#{key}=", nil)
126
+ elsif type =~ /\AArray<(.*)>/i
127
+ # check to ensure the input is an array given that the attribute
128
+ # is documented as an array but the input is not
129
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
130
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
131
+ end
132
+ elsif !attributes[self.class.attribute_map[key]].nil?
133
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
134
+ end
135
+ end
136
+
137
+ self
138
+ end
139
+
140
+ # Deserializes the data based on type
141
+ # @param string type Data type
142
+ # @param string value Value to be deserialized
143
+ # @return [Object] Deserialized data
144
+ def _deserialize(type, value)
145
+ case type.to_sym
146
+ when :Time
147
+ Time.parse(value)
148
+ when :Date
149
+ Date.parse(value)
150
+ when :String
151
+ value.to_s
152
+ when :Integer
153
+ value.to_i
154
+ when :Float
155
+ value.to_f
156
+ when :Boolean
157
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
158
+ true
159
+ else
160
+ false
161
+ end
162
+ when :Object
163
+ # generic object (usually a Hash), return directly
164
+ value
165
+ when /\AArray<(?<inner_type>.+)>\z/
166
+ inner_type = Regexp.last_match[:inner_type]
167
+ value.map { |v| _deserialize(inner_type, v) }
168
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
169
+ k_type = Regexp.last_match[:k_type]
170
+ v_type = Regexp.last_match[:v_type]
171
+ {}.tap do |hash|
172
+ value.each do |k, v|
173
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
174
+ end
175
+ end
176
+ else # model
177
+ # models (e.g. Pet) or oneOf
178
+ klass = OpenapiClient.const_get(type)
179
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
180
+ end
181
+ end
182
+
183
+ # Returns the string representation of the object
184
+ # @return [String] String presentation of the object
185
+ def to_s
186
+ to_hash.to_s
187
+ end
188
+
189
+ # to_body is an alias to to_hash (backward compatibility)
190
+ # @return [Hash] Returns the object in the form of hash
191
+ def to_body
192
+ to_hash
193
+ end
194
+
195
+ # Returns the object in the form of hash
196
+ # @return [Hash] Returns the object in the form of hash
197
+ def to_hash
198
+ hash = {}
199
+ self.class.attribute_map.each_pair do |attr, param|
200
+ value = self.send(attr)
201
+ if value.nil?
202
+ is_nullable = self.class.openapi_nullable.include?(attr)
203
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
204
+ end
205
+
206
+ hash[param] = _to_hash(value)
207
+ end
208
+ hash
209
+ end
210
+
211
+ # Outputs non-array value in the form of hash
212
+ # For object, use to_hash. Otherwise, just return the value
213
+ # @param [Object] value Any valid value
214
+ # @return [Hash] Returns the value in the form of hash
215
+ def _to_hash(value)
216
+ if value.is_a?(Array)
217
+ value.compact.map { |v| _to_hash(v) }
218
+ elsif value.is_a?(Hash)
219
+ {}.tap do |hash|
220
+ value.each { |k, v| hash[k] = _to_hash(v) }
221
+ end
222
+ elsif value.respond_to? :to_hash
223
+ value.to_hash
224
+ else
225
+ value
226
+ end
227
+ end
228
+
229
+ end
230
+
231
+ end
@@ -0,0 +1,303 @@
1
+ =begin
2
+ #Harness feature flag service client apis
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: cf@harness.io
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.2.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module OpenapiClient
17
+ class MetricsData
18
+ # time at when this data was recorded
19
+ attr_accessor :timestamp
20
+
21
+ attr_accessor :count
22
+
23
+ # This can be of type FeatureMetrics
24
+ attr_accessor :metrics_type
25
+
26
+ attr_accessor :attributes
27
+
28
+ class EnumAttributeValidator
29
+ attr_reader :datatype
30
+ attr_reader :allowable_values
31
+
32
+ def initialize(datatype, allowable_values)
33
+ @allowable_values = allowable_values.map do |value|
34
+ case datatype.to_s
35
+ when /Integer/i
36
+ value.to_i
37
+ when /Float/i
38
+ value.to_f
39
+ else
40
+ value
41
+ end
42
+ end
43
+ end
44
+
45
+ def valid?(value)
46
+ !value || allowable_values.include?(value)
47
+ end
48
+ end
49
+
50
+ # Attribute mapping from ruby-style variable name to JSON key.
51
+ def self.attribute_map
52
+ {
53
+ :'timestamp' => :'timestamp',
54
+ :'count' => :'count',
55
+ :'metrics_type' => :'metricsType',
56
+ :'attributes' => :'attributes'
57
+ }
58
+ end
59
+
60
+ # Returns all the JSON keys this model knows about
61
+ def self.acceptable_attributes
62
+ attribute_map.values
63
+ end
64
+
65
+ # Attribute type mapping.
66
+ def self.openapi_types
67
+ {
68
+ :'timestamp' => :'Integer',
69
+ :'count' => :'Integer',
70
+ :'metrics_type' => :'String',
71
+ :'attributes' => :'Array<KeyValue>'
72
+ }
73
+ end
74
+
75
+ # List of attributes with nullable: true
76
+ def self.openapi_nullable
77
+ Set.new([
78
+ ])
79
+ end
80
+
81
+ # Initializes the object
82
+ # @param [Hash] attributes Model attributes in the form of hash
83
+ def initialize(attributes = {})
84
+ if (!attributes.is_a?(Hash))
85
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::MetricsData` initialize method"
86
+ end
87
+
88
+ # check to see if the attribute exists and convert string to symbol for hash key
89
+ attributes = attributes.each_with_object({}) { |(k, v), h|
90
+ if (!self.class.attribute_map.key?(k.to_sym))
91
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::MetricsData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
92
+ end
93
+ h[k.to_sym] = v
94
+ }
95
+
96
+ if attributes.key?(:'timestamp')
97
+ self.timestamp = attributes[:'timestamp']
98
+ end
99
+
100
+ if attributes.key?(:'count')
101
+ self.count = attributes[:'count']
102
+ end
103
+
104
+ if attributes.key?(:'metrics_type')
105
+ self.metrics_type = attributes[:'metrics_type']
106
+ end
107
+
108
+ if attributes.key?(:'attributes')
109
+ if (value = attributes[:'attributes']).is_a?(Array)
110
+ self.attributes = value
111
+ end
112
+ end
113
+ end
114
+
115
+ # Show invalid properties with the reasons. Usually used together with valid?
116
+ # @return Array for valid properties with the reasons
117
+ def list_invalid_properties
118
+ invalid_properties = Array.new
119
+ if @timestamp.nil?
120
+ invalid_properties.push('invalid value for "timestamp", timestamp cannot be nil.')
121
+ end
122
+
123
+ if @count.nil?
124
+ invalid_properties.push('invalid value for "count", count cannot be nil.')
125
+ end
126
+
127
+ if @metrics_type.nil?
128
+ invalid_properties.push('invalid value for "metrics_type", metrics_type cannot be nil.')
129
+ end
130
+
131
+ if @attributes.nil?
132
+ invalid_properties.push('invalid value for "attributes", attributes cannot be nil.')
133
+ end
134
+
135
+ invalid_properties
136
+ end
137
+
138
+ # Check to see if the all the properties in the model are valid
139
+ # @return true if the model is valid
140
+ def valid?
141
+ return false if @timestamp.nil?
142
+ return false if @count.nil?
143
+ return false if @metrics_type.nil?
144
+ metrics_type_validator = EnumAttributeValidator.new('String', ["FFMETRICS"])
145
+ return false unless metrics_type_validator.valid?(@metrics_type)
146
+ return false if @attributes.nil?
147
+ true
148
+ end
149
+
150
+ # Custom attribute writer method checking allowed values (enum).
151
+ # @param [Object] metrics_type Object to be assigned
152
+ def metrics_type=(metrics_type)
153
+ validator = EnumAttributeValidator.new('String', ["FFMETRICS"])
154
+ unless validator.valid?(metrics_type)
155
+ fail ArgumentError, "invalid value for \"metrics_type\", must be one of #{validator.allowable_values}."
156
+ end
157
+ @metrics_type = metrics_type
158
+ end
159
+
160
+ # Checks equality by comparing each attribute.
161
+ # @param [Object] Object to be compared
162
+ def ==(o)
163
+ return true if self.equal?(o)
164
+ self.class == o.class &&
165
+ timestamp == o.timestamp &&
166
+ count == o.count &&
167
+ metrics_type == o.metrics_type &&
168
+ attributes == o.attributes
169
+ end
170
+
171
+ # @see the `==` method
172
+ # @param [Object] Object to be compared
173
+ def eql?(o)
174
+ self == o
175
+ end
176
+
177
+ # Calculates hash code according to all attributes.
178
+ # @return [Integer] Hash code
179
+ def hash
180
+ [timestamp, count, metrics_type, attributes].hash
181
+ end
182
+
183
+ # Builds the object from hash
184
+ # @param [Hash] attributes Model attributes in the form of hash
185
+ # @return [Object] Returns the model itself
186
+ def self.build_from_hash(attributes)
187
+ new.build_from_hash(attributes)
188
+ end
189
+
190
+ # Builds the object from hash
191
+ # @param [Hash] attributes Model attributes in the form of hash
192
+ # @return [Object] Returns the model itself
193
+ def build_from_hash(attributes)
194
+ return nil unless attributes.is_a?(Hash)
195
+ self.class.openapi_types.each_pair do |key, type|
196
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
197
+ self.send("#{key}=", nil)
198
+ elsif type =~ /\AArray<(.*)>/i
199
+ # check to ensure the input is an array given that the attribute
200
+ # is documented as an array but the input is not
201
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
202
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
203
+ end
204
+ elsif !attributes[self.class.attribute_map[key]].nil?
205
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
206
+ end
207
+ end
208
+
209
+ self
210
+ end
211
+
212
+ # Deserializes the data based on type
213
+ # @param string type Data type
214
+ # @param string value Value to be deserialized
215
+ # @return [Object] Deserialized data
216
+ def _deserialize(type, value)
217
+ case type.to_sym
218
+ when :Time
219
+ Time.parse(value)
220
+ when :Date
221
+ Date.parse(value)
222
+ when :String
223
+ value.to_s
224
+ when :Integer
225
+ value.to_i
226
+ when :Float
227
+ value.to_f
228
+ when :Boolean
229
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
230
+ true
231
+ else
232
+ false
233
+ end
234
+ when :Object
235
+ # generic object (usually a Hash), return directly
236
+ value
237
+ when /\AArray<(?<inner_type>.+)>\z/
238
+ inner_type = Regexp.last_match[:inner_type]
239
+ value.map { |v| _deserialize(inner_type, v) }
240
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
241
+ k_type = Regexp.last_match[:k_type]
242
+ v_type = Regexp.last_match[:v_type]
243
+ {}.tap do |hash|
244
+ value.each do |k, v|
245
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
246
+ end
247
+ end
248
+ else # model
249
+ # models (e.g. Pet) or oneOf
250
+ klass = OpenapiClient.const_get(type)
251
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
252
+ end
253
+ end
254
+
255
+ # Returns the string representation of the object
256
+ # @return [String] String presentation of the object
257
+ def to_s
258
+ to_hash.to_s
259
+ end
260
+
261
+ # to_body is an alias to to_hash (backward compatibility)
262
+ # @return [Hash] Returns the object in the form of hash
263
+ def to_body
264
+ to_hash
265
+ end
266
+
267
+ # Returns the object in the form of hash
268
+ # @return [Hash] Returns the object in the form of hash
269
+ def to_hash
270
+ hash = {}
271
+ self.class.attribute_map.each_pair do |attr, param|
272
+ value = self.send(attr)
273
+ if value.nil?
274
+ is_nullable = self.class.openapi_nullable.include?(attr)
275
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
276
+ end
277
+
278
+ hash[param] = _to_hash(value)
279
+ end
280
+ hash
281
+ end
282
+
283
+ # Outputs non-array value in the form of hash
284
+ # For object, use to_hash. Otherwise, just return the value
285
+ # @param [Object] value Any valid value
286
+ # @return [Hash] Returns the value in the form of hash
287
+ def _to_hash(value)
288
+ if value.is_a?(Array)
289
+ value.compact.map { |v| _to_hash(v) }
290
+ elsif value.is_a?(Hash)
291
+ {}.tap do |hash|
292
+ value.each { |k, v| hash[k] = _to_hash(v) }
293
+ end
294
+ elsif value.respond_to? :to_hash
295
+ value.to_hash
296
+ else
297
+ value
298
+ end
299
+ end
300
+
301
+ end
302
+
303
+ end