ff-ruby-server-sdk 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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,331 @@
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 Target
18
+ attr_accessor :identifier
19
+
20
+ attr_accessor :account
21
+
22
+ attr_accessor :org
23
+
24
+ attr_accessor :environment
25
+
26
+ attr_accessor :project
27
+
28
+ attr_accessor :name
29
+
30
+ attr_accessor :anonymous
31
+
32
+ attr_accessor :attributes
33
+
34
+ attr_accessor :created_at
35
+
36
+ attr_accessor :segments
37
+
38
+ # Attribute mapping from ruby-style variable name to JSON key.
39
+ def self.attribute_map
40
+ {
41
+ :'identifier' => :'identifier',
42
+ :'account' => :'account',
43
+ :'org' => :'org',
44
+ :'environment' => :'environment',
45
+ :'project' => :'project',
46
+ :'name' => :'name',
47
+ :'anonymous' => :'anonymous',
48
+ :'attributes' => :'attributes',
49
+ :'created_at' => :'createdAt',
50
+ :'segments' => :'segments'
51
+ }
52
+ end
53
+
54
+ # Returns all the JSON keys this model knows about
55
+ def self.acceptable_attributes
56
+ attribute_map.values
57
+ end
58
+
59
+ # Attribute type mapping.
60
+ def self.openapi_types
61
+ {
62
+ :'identifier' => :'String',
63
+ :'account' => :'String',
64
+ :'org' => :'String',
65
+ :'environment' => :'String',
66
+ :'project' => :'String',
67
+ :'name' => :'String',
68
+ :'anonymous' => :'Boolean',
69
+ :'attributes' => :'Object',
70
+ :'created_at' => :'Integer',
71
+ :'segments' => :'Array<Segment>'
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::Target` 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::Target`. 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?(:'identifier')
97
+ self.identifier = attributes[:'identifier']
98
+ end
99
+
100
+ if attributes.key?(:'account')
101
+ self.account = attributes[:'account']
102
+ end
103
+
104
+ if attributes.key?(:'org')
105
+ self.org = attributes[:'org']
106
+ end
107
+
108
+ if attributes.key?(:'environment')
109
+ self.environment = attributes[:'environment']
110
+ end
111
+
112
+ if attributes.key?(:'project')
113
+ self.project = attributes[:'project']
114
+ end
115
+
116
+ if attributes.key?(:'name')
117
+ self.name = attributes[:'name']
118
+ end
119
+
120
+ if attributes.key?(:'anonymous')
121
+ self.anonymous = attributes[:'anonymous']
122
+ end
123
+
124
+ if attributes.key?(:'attributes')
125
+ self.attributes = attributes[:'attributes']
126
+ end
127
+
128
+ if attributes.key?(:'created_at')
129
+ self.created_at = attributes[:'created_at']
130
+ end
131
+
132
+ if attributes.key?(:'segments')
133
+ if (value = attributes[:'segments']).is_a?(Array)
134
+ self.segments = value
135
+ end
136
+ end
137
+ end
138
+
139
+ # Show invalid properties with the reasons. Usually used together with valid?
140
+ # @return Array for valid properties with the reasons
141
+ def list_invalid_properties
142
+ invalid_properties = Array.new
143
+ if @identifier.nil?
144
+ invalid_properties.push('invalid value for "identifier", identifier cannot be nil.')
145
+ end
146
+
147
+ if @account.nil?
148
+ invalid_properties.push('invalid value for "account", account cannot be nil.')
149
+ end
150
+
151
+ if @org.nil?
152
+ invalid_properties.push('invalid value for "org", org cannot be nil.')
153
+ end
154
+
155
+ if @environment.nil?
156
+ invalid_properties.push('invalid value for "environment", environment cannot be nil.')
157
+ end
158
+
159
+ if @project.nil?
160
+ invalid_properties.push('invalid value for "project", project cannot be nil.')
161
+ end
162
+
163
+ if @name.nil?
164
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
165
+ end
166
+
167
+ invalid_properties
168
+ end
169
+
170
+ # Check to see if the all the properties in the model are valid
171
+ # @return true if the model is valid
172
+ def valid?
173
+ return false if @identifier.nil?
174
+ return false if @account.nil?
175
+ return false if @org.nil?
176
+ return false if @environment.nil?
177
+ return false if @project.nil?
178
+ return false if @name.nil?
179
+ true
180
+ end
181
+
182
+ # Checks equality by comparing each attribute.
183
+ # @param [Object] Object to be compared
184
+ def ==(o)
185
+ return true if self.equal?(o)
186
+ self.class == o.class &&
187
+ identifier == o.identifier &&
188
+ account == o.account &&
189
+ org == o.org &&
190
+ environment == o.environment &&
191
+ project == o.project &&
192
+ name == o.name &&
193
+ anonymous == o.anonymous &&
194
+ attributes == o.attributes &&
195
+ created_at == o.created_at &&
196
+ segments == o.segments
197
+ end
198
+
199
+ # @see the `==` method
200
+ # @param [Object] Object to be compared
201
+ def eql?(o)
202
+ self == o
203
+ end
204
+
205
+ # Calculates hash code according to all attributes.
206
+ # @return [Integer] Hash code
207
+ def hash
208
+ [identifier, account, org, environment, project, name, anonymous, attributes, created_at, segments].hash
209
+ end
210
+
211
+ # Builds the object from hash
212
+ # @param [Hash] attributes Model attributes in the form of hash
213
+ # @return [Object] Returns the model itself
214
+ def self.build_from_hash(attributes)
215
+ new.build_from_hash(attributes)
216
+ end
217
+
218
+ # Builds the object from hash
219
+ # @param [Hash] attributes Model attributes in the form of hash
220
+ # @return [Object] Returns the model itself
221
+ def build_from_hash(attributes)
222
+ return nil unless attributes.is_a?(Hash)
223
+ self.class.openapi_types.each_pair do |key, type|
224
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
225
+ self.send("#{key}=", nil)
226
+ elsif type =~ /\AArray<(.*)>/i
227
+ # check to ensure the input is an array given that the attribute
228
+ # is documented as an array but the input is not
229
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
230
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
231
+ end
232
+ elsif !attributes[self.class.attribute_map[key]].nil?
233
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
234
+ end
235
+ end
236
+
237
+ self
238
+ end
239
+
240
+ # Deserializes the data based on type
241
+ # @param string type Data type
242
+ # @param string value Value to be deserialized
243
+ # @return [Object] Deserialized data
244
+ def _deserialize(type, value)
245
+ case type.to_sym
246
+ when :Time
247
+ Time.parse(value)
248
+ when :Date
249
+ Date.parse(value)
250
+ when :String
251
+ value.to_s
252
+ when :Integer
253
+ value.to_i
254
+ when :Float
255
+ value.to_f
256
+ when :Boolean
257
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
258
+ true
259
+ else
260
+ false
261
+ end
262
+ when :Object
263
+ # generic object (usually a Hash), return directly
264
+ value
265
+ when /\AArray<(?<inner_type>.+)>\z/
266
+ inner_type = Regexp.last_match[:inner_type]
267
+ value.map { |v| _deserialize(inner_type, v) }
268
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
269
+ k_type = Regexp.last_match[:k_type]
270
+ v_type = Regexp.last_match[:v_type]
271
+ {}.tap do |hash|
272
+ value.each do |k, v|
273
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
274
+ end
275
+ end
276
+ else # model
277
+ # models (e.g. Pet) or oneOf
278
+ klass = OpenapiClient.const_get(type)
279
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
280
+ end
281
+ end
282
+
283
+ # Returns the string representation of the object
284
+ # @return [String] String presentation of the object
285
+ def to_s
286
+ to_hash.to_s
287
+ end
288
+
289
+ # to_body is an alias to to_hash (backward compatibility)
290
+ # @return [Hash] Returns the object in the form of hash
291
+ def to_body
292
+ to_hash
293
+ end
294
+
295
+ # Returns the object in the form of hash
296
+ # @return [Hash] Returns the object in the form of hash
297
+ def to_hash
298
+ hash = {}
299
+ self.class.attribute_map.each_pair do |attr, param|
300
+ value = self.send(attr)
301
+ if value.nil?
302
+ is_nullable = self.class.openapi_nullable.include?(attr)
303
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
304
+ end
305
+
306
+ hash[param] = _to_hash(value)
307
+ end
308
+ hash
309
+ end
310
+
311
+ # Outputs non-array value in the form of hash
312
+ # For object, use to_hash. Otherwise, just return the value
313
+ # @param [Object] value Any valid value
314
+ # @return [Hash] Returns the value in the form of hash
315
+ def _to_hash(value)
316
+ if value.is_a?(Array)
317
+ value.compact.map { |v| _to_hash(v) }
318
+ elsif value.is_a?(Hash)
319
+ {}.tap do |hash|
320
+ value.each { |k, v| hash[k] = _to_hash(v) }
321
+ end
322
+ elsif value.respond_to? :to_hash
323
+ value.to_hash
324
+ else
325
+ value
326
+ end
327
+ end
328
+
329
+ end
330
+
331
+ end
@@ -0,0 +1,253 @@
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 TargetData
18
+ attr_accessor :identifier
19
+
20
+ attr_accessor :name
21
+
22
+ attr_accessor :attributes
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'identifier' => :'identifier',
28
+ :'name' => :'name',
29
+ :'attributes' => :'attributes'
30
+ }
31
+ end
32
+
33
+ # Returns all the JSON keys this model knows about
34
+ def self.acceptable_attributes
35
+ attribute_map.values
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.openapi_types
40
+ {
41
+ :'identifier' => :'String',
42
+ :'name' => :'String',
43
+ :'attributes' => :'Array<KeyValue>'
44
+ }
45
+ end
46
+
47
+ # List of attributes with nullable: true
48
+ def self.openapi_nullable
49
+ Set.new([
50
+ ])
51
+ end
52
+
53
+ # Initializes the object
54
+ # @param [Hash] attributes Model attributes in the form of hash
55
+ def initialize(attributes = {})
56
+ if (!attributes.is_a?(Hash))
57
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::TargetData` initialize method"
58
+ end
59
+
60
+ # check to see if the attribute exists and convert string to symbol for hash key
61
+ attributes = attributes.each_with_object({}) { |(k, v), h|
62
+ if (!self.class.attribute_map.key?(k.to_sym))
63
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::TargetData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
64
+ end
65
+ h[k.to_sym] = v
66
+ }
67
+
68
+ if attributes.key?(:'identifier')
69
+ self.identifier = attributes[:'identifier']
70
+ end
71
+
72
+ if attributes.key?(:'name')
73
+ self.name = attributes[:'name']
74
+ end
75
+
76
+ if attributes.key?(:'attributes')
77
+ if (value = attributes[:'attributes']).is_a?(Array)
78
+ self.attributes = value
79
+ end
80
+ end
81
+ end
82
+
83
+ # Show invalid properties with the reasons. Usually used together with valid?
84
+ # @return Array for valid properties with the reasons
85
+ def list_invalid_properties
86
+ invalid_properties = Array.new
87
+ if @identifier.nil?
88
+ invalid_properties.push('invalid value for "identifier", identifier cannot be nil.')
89
+ end
90
+
91
+ if @name.nil?
92
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
93
+ end
94
+
95
+ if @attributes.nil?
96
+ invalid_properties.push('invalid value for "attributes", attributes cannot be nil.')
97
+ end
98
+
99
+ invalid_properties
100
+ end
101
+
102
+ # Check to see if the all the properties in the model are valid
103
+ # @return true if the model is valid
104
+ def valid?
105
+ return false if @identifier.nil?
106
+ return false if @name.nil?
107
+ return false if @attributes.nil?
108
+ true
109
+ end
110
+
111
+ # Checks equality by comparing each attribute.
112
+ # @param [Object] Object to be compared
113
+ def ==(o)
114
+ return true if self.equal?(o)
115
+ self.class == o.class &&
116
+ identifier == o.identifier &&
117
+ name == o.name &&
118
+ attributes == o.attributes
119
+ end
120
+
121
+ # @see the `==` method
122
+ # @param [Object] Object to be compared
123
+ def eql?(o)
124
+ self == o
125
+ end
126
+
127
+ # Calculates hash code according to all attributes.
128
+ # @return [Integer] Hash code
129
+ def hash
130
+ [identifier, name, attributes].hash
131
+ end
132
+
133
+ # Builds the object from hash
134
+ # @param [Hash] attributes Model attributes in the form of hash
135
+ # @return [Object] Returns the model itself
136
+ def self.build_from_hash(attributes)
137
+ new.build_from_hash(attributes)
138
+ end
139
+
140
+ # Builds the object from hash
141
+ # @param [Hash] attributes Model attributes in the form of hash
142
+ # @return [Object] Returns the model itself
143
+ def build_from_hash(attributes)
144
+ return nil unless attributes.is_a?(Hash)
145
+ self.class.openapi_types.each_pair do |key, type|
146
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
147
+ self.send("#{key}=", nil)
148
+ elsif type =~ /\AArray<(.*)>/i
149
+ # check to ensure the input is an array given that the attribute
150
+ # is documented as an array but the input is not
151
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
152
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
153
+ end
154
+ elsif !attributes[self.class.attribute_map[key]].nil?
155
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
156
+ end
157
+ end
158
+
159
+ self
160
+ end
161
+
162
+ # Deserializes the data based on type
163
+ # @param string type Data type
164
+ # @param string value Value to be deserialized
165
+ # @return [Object] Deserialized data
166
+ def _deserialize(type, value)
167
+ case type.to_sym
168
+ when :Time
169
+ Time.parse(value)
170
+ when :Date
171
+ Date.parse(value)
172
+ when :String
173
+ value.to_s
174
+ when :Integer
175
+ value.to_i
176
+ when :Float
177
+ value.to_f
178
+ when :Boolean
179
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
180
+ true
181
+ else
182
+ false
183
+ end
184
+ when :Object
185
+ # generic object (usually a Hash), return directly
186
+ value
187
+ when /\AArray<(?<inner_type>.+)>\z/
188
+ inner_type = Regexp.last_match[:inner_type]
189
+ value.map { |v| _deserialize(inner_type, v) }
190
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
191
+ k_type = Regexp.last_match[:k_type]
192
+ v_type = Regexp.last_match[:v_type]
193
+ {}.tap do |hash|
194
+ value.each do |k, v|
195
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
196
+ end
197
+ end
198
+ else # model
199
+ # models (e.g. Pet) or oneOf
200
+ klass = OpenapiClient.const_get(type)
201
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
202
+ end
203
+ end
204
+
205
+ # Returns the string representation of the object
206
+ # @return [String] String presentation of the object
207
+ def to_s
208
+ to_hash.to_s
209
+ end
210
+
211
+ # to_body is an alias to to_hash (backward compatibility)
212
+ # @return [Hash] Returns the object in the form of hash
213
+ def to_body
214
+ to_hash
215
+ end
216
+
217
+ # Returns the object in the form of hash
218
+ # @return [Hash] Returns the object in the form of hash
219
+ def to_hash
220
+ hash = {}
221
+ self.class.attribute_map.each_pair do |attr, param|
222
+ value = self.send(attr)
223
+ if value.nil?
224
+ is_nullable = self.class.openapi_nullable.include?(attr)
225
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
226
+ end
227
+
228
+ hash[param] = _to_hash(value)
229
+ end
230
+ hash
231
+ end
232
+
233
+ # Outputs non-array value in the form of hash
234
+ # For object, use to_hash. Otherwise, just return the value
235
+ # @param [Object] value Any valid value
236
+ # @return [Hash] Returns the value in the form of hash
237
+ def _to_hash(value)
238
+ if value.is_a?(Array)
239
+ value.compact.map { |v| _to_hash(v) }
240
+ elsif value.is_a?(Hash)
241
+ {}.tap do |hash|
242
+ value.each { |k, v| hash[k] = _to_hash(v) }
243
+ end
244
+ elsif value.respond_to? :to_hash
245
+ value.to_hash
246
+ else
247
+ value
248
+ end
249
+ end
250
+
251
+ end
252
+
253
+ end