ff-ruby-server-sdk 1.0.0 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -3
- data/Gemfile +0 -3
- data/example/example.rb +4 -3
- data/lib/ff/ruby/server/generated/lib/openapi_client/api/client_api.rb +545 -0
- data/lib/ff/ruby/server/generated/lib/openapi_client/api/metrics_api.rb +89 -0
- data/lib/ff/ruby/server/generated/lib/openapi_client/api_client.rb +390 -0
- data/lib/ff/ruby/server/generated/lib/openapi_client/api_error.rb +57 -0
- data/lib/ff/ruby/server/generated/lib/openapi_client/configuration.rb +282 -0
- data/lib/ff/ruby/server/generated/lib/openapi_client/models/authentication_request.rb +232 -0
- data/lib/ff/ruby/server/generated/lib/openapi_client/models/authentication_request_target.rb +250 -0
- data/lib/ff/ruby/server/generated/lib/openapi_client/models/authentication_response.rb +223 -0
- data/lib/ff/ruby/server/generated/lib/openapi_client/models/clause.rb +281 -0
- data/lib/ff/ruby/server/generated/lib/openapi_client/models/distribution.rb +239 -0
- data/lib/ff/ruby/server/generated/lib/openapi_client/models/error.rb +237 -0
- data/lib/ff/ruby/server/generated/lib/openapi_client/models/evaluation.rb +260 -0
- data/lib/ff/ruby/server/generated/lib/openapi_client/models/feature_config.rb +418 -0
- data/lib/ff/ruby/server/generated/lib/openapi_client/models/feature_state.rb +37 -0
- data/lib/ff/ruby/server/generated/lib/openapi_client/models/key_value.rb +237 -0
- data/lib/ff/ruby/server/generated/lib/openapi_client/models/metrics.rb +231 -0
- data/lib/ff/ruby/server/generated/lib/openapi_client/models/metrics_data.rb +303 -0
- data/lib/ff/ruby/server/generated/lib/openapi_client/models/pagination.rb +274 -0
- data/lib/ff/ruby/server/generated/lib/openapi_client/models/prerequisite.rb +239 -0
- data/lib/ff/ruby/server/generated/lib/openapi_client/models/segment.rb +320 -0
- data/lib/ff/ruby/server/generated/lib/openapi_client/models/serve.rb +227 -0
- data/lib/ff/ruby/server/generated/lib/openapi_client/models/serving_rule.rb +267 -0
- data/lib/ff/ruby/server/generated/lib/openapi_client/models/tag.rb +233 -0
- data/lib/ff/ruby/server/generated/lib/openapi_client/models/target.rb +331 -0
- data/lib/ff/ruby/server/generated/lib/openapi_client/models/target_data.rb +253 -0
- data/lib/ff/ruby/server/generated/lib/openapi_client/models/target_map.rb +232 -0
- data/lib/ff/ruby/server/generated/lib/openapi_client/models/variation.rb +255 -0
- data/lib/ff/ruby/server/generated/lib/openapi_client/models/variation_map.rb +245 -0
- data/lib/ff/ruby/server/generated/lib/openapi_client/models/weighted_variation.rb +237 -0
- data/lib/ff/ruby/server/generated/lib/openapi_client/version.rb +15 -0
- data/lib/ff/ruby/server/generated/lib/openapi_client.rb +65 -0
- data/lib/ff/ruby/server/sdk/api/cf_client.rb +1 -1
- data/lib/ff/ruby/server/sdk/version.rb +1 -1
- data/scripts/install.sh +8 -2
- data/scripts/openapi.sh +51 -10
- data/scripts/publish.sh +1 -1
- data/scripts/sdk_specs.sh +1 -1
- metadata +208 -13
- data/.run/build.sh.run.xml +0 -17
- data/.run/install.sh.run.xml +0 -17
- data/.run/openapi.sh.run.xml +0 -17
- data/.run/publish.sh.run.xml +0 -17
- data/.run/unpublish.sh.run.xml +0 -17
@@ -0,0 +1,245 @@
|
|
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 VariationMap
|
18
|
+
attr_accessor :variation
|
19
|
+
|
20
|
+
attr_accessor :targets
|
21
|
+
|
22
|
+
attr_accessor :target_segments
|
23
|
+
|
24
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
25
|
+
def self.attribute_map
|
26
|
+
{
|
27
|
+
:'variation' => :'variation',
|
28
|
+
:'targets' => :'targets',
|
29
|
+
:'target_segments' => :'targetSegments'
|
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
|
+
:'variation' => :'String',
|
42
|
+
:'targets' => :'Array<TargetMap>',
|
43
|
+
:'target_segments' => :'Array<String>'
|
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::VariationMap` 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::VariationMap`. 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?(:'variation')
|
69
|
+
self.variation = attributes[:'variation']
|
70
|
+
end
|
71
|
+
|
72
|
+
if attributes.key?(:'targets')
|
73
|
+
if (value = attributes[:'targets']).is_a?(Array)
|
74
|
+
self.targets = value
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
if attributes.key?(:'target_segments')
|
79
|
+
if (value = attributes[:'target_segments']).is_a?(Array)
|
80
|
+
self.target_segments = value
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
86
|
+
# @return Array for valid properties with the reasons
|
87
|
+
def list_invalid_properties
|
88
|
+
invalid_properties = Array.new
|
89
|
+
if @variation.nil?
|
90
|
+
invalid_properties.push('invalid value for "variation", variation cannot be nil.')
|
91
|
+
end
|
92
|
+
|
93
|
+
invalid_properties
|
94
|
+
end
|
95
|
+
|
96
|
+
# Check to see if the all the properties in the model are valid
|
97
|
+
# @return true if the model is valid
|
98
|
+
def valid?
|
99
|
+
return false if @variation.nil?
|
100
|
+
true
|
101
|
+
end
|
102
|
+
|
103
|
+
# Checks equality by comparing each attribute.
|
104
|
+
# @param [Object] Object to be compared
|
105
|
+
def ==(o)
|
106
|
+
return true if self.equal?(o)
|
107
|
+
self.class == o.class &&
|
108
|
+
variation == o.variation &&
|
109
|
+
targets == o.targets &&
|
110
|
+
target_segments == o.target_segments
|
111
|
+
end
|
112
|
+
|
113
|
+
# @see the `==` method
|
114
|
+
# @param [Object] Object to be compared
|
115
|
+
def eql?(o)
|
116
|
+
self == o
|
117
|
+
end
|
118
|
+
|
119
|
+
# Calculates hash code according to all attributes.
|
120
|
+
# @return [Integer] Hash code
|
121
|
+
def hash
|
122
|
+
[variation, targets, target_segments].hash
|
123
|
+
end
|
124
|
+
|
125
|
+
# Builds the object from hash
|
126
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
127
|
+
# @return [Object] Returns the model itself
|
128
|
+
def self.build_from_hash(attributes)
|
129
|
+
new.build_from_hash(attributes)
|
130
|
+
end
|
131
|
+
|
132
|
+
# Builds the object from hash
|
133
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
134
|
+
# @return [Object] Returns the model itself
|
135
|
+
def build_from_hash(attributes)
|
136
|
+
return nil unless attributes.is_a?(Hash)
|
137
|
+
self.class.openapi_types.each_pair do |key, type|
|
138
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
139
|
+
self.send("#{key}=", nil)
|
140
|
+
elsif type =~ /\AArray<(.*)>/i
|
141
|
+
# check to ensure the input is an array given that the attribute
|
142
|
+
# is documented as an array but the input is not
|
143
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
144
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
145
|
+
end
|
146
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
147
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
self
|
152
|
+
end
|
153
|
+
|
154
|
+
# Deserializes the data based on type
|
155
|
+
# @param string type Data type
|
156
|
+
# @param string value Value to be deserialized
|
157
|
+
# @return [Object] Deserialized data
|
158
|
+
def _deserialize(type, value)
|
159
|
+
case type.to_sym
|
160
|
+
when :Time
|
161
|
+
Time.parse(value)
|
162
|
+
when :Date
|
163
|
+
Date.parse(value)
|
164
|
+
when :String
|
165
|
+
value.to_s
|
166
|
+
when :Integer
|
167
|
+
value.to_i
|
168
|
+
when :Float
|
169
|
+
value.to_f
|
170
|
+
when :Boolean
|
171
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
172
|
+
true
|
173
|
+
else
|
174
|
+
false
|
175
|
+
end
|
176
|
+
when :Object
|
177
|
+
# generic object (usually a Hash), return directly
|
178
|
+
value
|
179
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
180
|
+
inner_type = Regexp.last_match[:inner_type]
|
181
|
+
value.map { |v| _deserialize(inner_type, v) }
|
182
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
183
|
+
k_type = Regexp.last_match[:k_type]
|
184
|
+
v_type = Regexp.last_match[:v_type]
|
185
|
+
{}.tap do |hash|
|
186
|
+
value.each do |k, v|
|
187
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
188
|
+
end
|
189
|
+
end
|
190
|
+
else # model
|
191
|
+
# models (e.g. Pet) or oneOf
|
192
|
+
klass = OpenapiClient.const_get(type)
|
193
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
# Returns the string representation of the object
|
198
|
+
# @return [String] String presentation of the object
|
199
|
+
def to_s
|
200
|
+
to_hash.to_s
|
201
|
+
end
|
202
|
+
|
203
|
+
# to_body is an alias to to_hash (backward compatibility)
|
204
|
+
# @return [Hash] Returns the object in the form of hash
|
205
|
+
def to_body
|
206
|
+
to_hash
|
207
|
+
end
|
208
|
+
|
209
|
+
# Returns the object in the form of hash
|
210
|
+
# @return [Hash] Returns the object in the form of hash
|
211
|
+
def to_hash
|
212
|
+
hash = {}
|
213
|
+
self.class.attribute_map.each_pair do |attr, param|
|
214
|
+
value = self.send(attr)
|
215
|
+
if value.nil?
|
216
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
217
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
218
|
+
end
|
219
|
+
|
220
|
+
hash[param] = _to_hash(value)
|
221
|
+
end
|
222
|
+
hash
|
223
|
+
end
|
224
|
+
|
225
|
+
# Outputs non-array value in the form of hash
|
226
|
+
# For object, use to_hash. Otherwise, just return the value
|
227
|
+
# @param [Object] value Any valid value
|
228
|
+
# @return [Hash] Returns the value in the form of hash
|
229
|
+
def _to_hash(value)
|
230
|
+
if value.is_a?(Array)
|
231
|
+
value.compact.map { |v| _to_hash(v) }
|
232
|
+
elsif value.is_a?(Hash)
|
233
|
+
{}.tap do |hash|
|
234
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
235
|
+
end
|
236
|
+
elsif value.respond_to? :to_hash
|
237
|
+
value.to_hash
|
238
|
+
else
|
239
|
+
value
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
end
|
244
|
+
|
245
|
+
end
|
@@ -0,0 +1,237 @@
|
|
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 WeightedVariation
|
18
|
+
attr_accessor :variation
|
19
|
+
|
20
|
+
attr_accessor :weight
|
21
|
+
|
22
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
23
|
+
def self.attribute_map
|
24
|
+
{
|
25
|
+
:'variation' => :'variation',
|
26
|
+
:'weight' => :'weight'
|
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
|
+
:'variation' => :'String',
|
39
|
+
:'weight' => :'Integer'
|
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::WeightedVariation` 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::WeightedVariation`. 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?(:'variation')
|
65
|
+
self.variation = attributes[:'variation']
|
66
|
+
end
|
67
|
+
|
68
|
+
if attributes.key?(:'weight')
|
69
|
+
self.weight = attributes[:'weight']
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
74
|
+
# @return Array for valid properties with the reasons
|
75
|
+
def list_invalid_properties
|
76
|
+
invalid_properties = Array.new
|
77
|
+
if @variation.nil?
|
78
|
+
invalid_properties.push('invalid value for "variation", variation cannot be nil.')
|
79
|
+
end
|
80
|
+
|
81
|
+
if @weight.nil?
|
82
|
+
invalid_properties.push('invalid value for "weight", weight cannot be nil.')
|
83
|
+
end
|
84
|
+
|
85
|
+
invalid_properties
|
86
|
+
end
|
87
|
+
|
88
|
+
# Check to see if the all the properties in the model are valid
|
89
|
+
# @return true if the model is valid
|
90
|
+
def valid?
|
91
|
+
return false if @variation.nil?
|
92
|
+
return false if @weight.nil?
|
93
|
+
true
|
94
|
+
end
|
95
|
+
|
96
|
+
# Checks equality by comparing each attribute.
|
97
|
+
# @param [Object] Object to be compared
|
98
|
+
def ==(o)
|
99
|
+
return true if self.equal?(o)
|
100
|
+
self.class == o.class &&
|
101
|
+
variation == o.variation &&
|
102
|
+
weight == o.weight
|
103
|
+
end
|
104
|
+
|
105
|
+
# @see the `==` method
|
106
|
+
# @param [Object] Object to be compared
|
107
|
+
def eql?(o)
|
108
|
+
self == o
|
109
|
+
end
|
110
|
+
|
111
|
+
# Calculates hash code according to all attributes.
|
112
|
+
# @return [Integer] Hash code
|
113
|
+
def hash
|
114
|
+
[variation, weight].hash
|
115
|
+
end
|
116
|
+
|
117
|
+
# Builds the object from hash
|
118
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
119
|
+
# @return [Object] Returns the model itself
|
120
|
+
def self.build_from_hash(attributes)
|
121
|
+
new.build_from_hash(attributes)
|
122
|
+
end
|
123
|
+
|
124
|
+
# Builds the object from hash
|
125
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
126
|
+
# @return [Object] Returns the model itself
|
127
|
+
def build_from_hash(attributes)
|
128
|
+
return nil unless attributes.is_a?(Hash)
|
129
|
+
self.class.openapi_types.each_pair do |key, type|
|
130
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
131
|
+
self.send("#{key}=", nil)
|
132
|
+
elsif type =~ /\AArray<(.*)>/i
|
133
|
+
# check to ensure the input is an array given that the attribute
|
134
|
+
# is documented as an array but the input is not
|
135
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
136
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
137
|
+
end
|
138
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
139
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
self
|
144
|
+
end
|
145
|
+
|
146
|
+
# Deserializes the data based on type
|
147
|
+
# @param string type Data type
|
148
|
+
# @param string value Value to be deserialized
|
149
|
+
# @return [Object] Deserialized data
|
150
|
+
def _deserialize(type, value)
|
151
|
+
case type.to_sym
|
152
|
+
when :Time
|
153
|
+
Time.parse(value)
|
154
|
+
when :Date
|
155
|
+
Date.parse(value)
|
156
|
+
when :String
|
157
|
+
value.to_s
|
158
|
+
when :Integer
|
159
|
+
value.to_i
|
160
|
+
when :Float
|
161
|
+
value.to_f
|
162
|
+
when :Boolean
|
163
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
164
|
+
true
|
165
|
+
else
|
166
|
+
false
|
167
|
+
end
|
168
|
+
when :Object
|
169
|
+
# generic object (usually a Hash), return directly
|
170
|
+
value
|
171
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
172
|
+
inner_type = Regexp.last_match[:inner_type]
|
173
|
+
value.map { |v| _deserialize(inner_type, v) }
|
174
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
175
|
+
k_type = Regexp.last_match[:k_type]
|
176
|
+
v_type = Regexp.last_match[:v_type]
|
177
|
+
{}.tap do |hash|
|
178
|
+
value.each do |k, v|
|
179
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
180
|
+
end
|
181
|
+
end
|
182
|
+
else # model
|
183
|
+
# models (e.g. Pet) or oneOf
|
184
|
+
klass = OpenapiClient.const_get(type)
|
185
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
# Returns the string representation of the object
|
190
|
+
# @return [String] String presentation of the object
|
191
|
+
def to_s
|
192
|
+
to_hash.to_s
|
193
|
+
end
|
194
|
+
|
195
|
+
# to_body is an alias to to_hash (backward compatibility)
|
196
|
+
# @return [Hash] Returns the object in the form of hash
|
197
|
+
def to_body
|
198
|
+
to_hash
|
199
|
+
end
|
200
|
+
|
201
|
+
# Returns the object in the form of hash
|
202
|
+
# @return [Hash] Returns the object in the form of hash
|
203
|
+
def to_hash
|
204
|
+
hash = {}
|
205
|
+
self.class.attribute_map.each_pair do |attr, param|
|
206
|
+
value = self.send(attr)
|
207
|
+
if value.nil?
|
208
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
209
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
210
|
+
end
|
211
|
+
|
212
|
+
hash[param] = _to_hash(value)
|
213
|
+
end
|
214
|
+
hash
|
215
|
+
end
|
216
|
+
|
217
|
+
# Outputs non-array value in the form of hash
|
218
|
+
# For object, use to_hash. Otherwise, just return the value
|
219
|
+
# @param [Object] value Any valid value
|
220
|
+
# @return [Hash] Returns the value in the form of hash
|
221
|
+
def _to_hash(value)
|
222
|
+
if value.is_a?(Array)
|
223
|
+
value.compact.map { |v| _to_hash(v) }
|
224
|
+
elsif value.is_a?(Hash)
|
225
|
+
{}.tap do |hash|
|
226
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
227
|
+
end
|
228
|
+
elsif value.respond_to? :to_hash
|
229
|
+
value.to_hash
|
230
|
+
else
|
231
|
+
value
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
end
|
236
|
+
|
237
|
+
end
|
@@ -0,0 +1,15 @@
|
|
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
|
+
module OpenapiClient
|
14
|
+
VERSION = '1.0.0'
|
15
|
+
end
|
@@ -0,0 +1,65 @@
|
|
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
|
+
# Common files
|
14
|
+
require 'openapi_client/api_client'
|
15
|
+
require 'openapi_client/api_error'
|
16
|
+
require 'openapi_client/version'
|
17
|
+
require 'openapi_client/configuration'
|
18
|
+
|
19
|
+
# Models
|
20
|
+
require 'openapi_client/models/authentication_request'
|
21
|
+
require 'openapi_client/models/authentication_request_target'
|
22
|
+
require 'openapi_client/models/authentication_response'
|
23
|
+
require 'openapi_client/models/clause'
|
24
|
+
require 'openapi_client/models/distribution'
|
25
|
+
require 'openapi_client/models/error'
|
26
|
+
require 'openapi_client/models/evaluation'
|
27
|
+
require 'openapi_client/models/feature_config'
|
28
|
+
require 'openapi_client/models/feature_state'
|
29
|
+
require 'openapi_client/models/key_value'
|
30
|
+
require 'openapi_client/models/metrics'
|
31
|
+
require 'openapi_client/models/metrics_data'
|
32
|
+
require 'openapi_client/models/pagination'
|
33
|
+
require 'openapi_client/models/prerequisite'
|
34
|
+
require 'openapi_client/models/segment'
|
35
|
+
require 'openapi_client/models/serve'
|
36
|
+
require 'openapi_client/models/serving_rule'
|
37
|
+
require 'openapi_client/models/tag'
|
38
|
+
require 'openapi_client/models/target'
|
39
|
+
require 'openapi_client/models/target_data'
|
40
|
+
require 'openapi_client/models/target_map'
|
41
|
+
require 'openapi_client/models/variation'
|
42
|
+
require 'openapi_client/models/variation_map'
|
43
|
+
require 'openapi_client/models/weighted_variation'
|
44
|
+
|
45
|
+
# APIs
|
46
|
+
require 'openapi_client/api/client_api'
|
47
|
+
require 'openapi_client/api/metrics_api'
|
48
|
+
|
49
|
+
module OpenapiClient
|
50
|
+
class << self
|
51
|
+
# Customize default settings for the SDK using block.
|
52
|
+
# OpenapiClient.configure do |config|
|
53
|
+
# config.username = "xxx"
|
54
|
+
# config.password = "xxx"
|
55
|
+
# end
|
56
|
+
# If no block given, return the default Configuration object.
|
57
|
+
def configure
|
58
|
+
if block_given?
|
59
|
+
yield(Configuration.default)
|
60
|
+
else
|
61
|
+
Configuration.default
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
data/scripts/install.sh
CHANGED
@@ -6,5 +6,11 @@ dir_path=$(dirname "$full_path")
|
|
6
6
|
. "$dir_path/sdk_specs.sh"
|
7
7
|
|
8
8
|
# shellcheck disable=SC2154
|
9
|
-
cd "$dir_path/.." && gem build "$ff_ruby_sdk.gemspec" &&
|
10
|
-
|
9
|
+
if cd "$dir_path/.." && gem build "$ff_ruby_sdk.gemspec" && gem install "$ff_ruby_sdk"; then
|
10
|
+
|
11
|
+
echo "The '$ff_ruby_sdk' is installed with success"
|
12
|
+
else
|
13
|
+
|
14
|
+
echo "ERROR: the '$ff_ruby_sdk' is NOT installed with success"
|
15
|
+
exit 1
|
16
|
+
fi
|
data/scripts/openapi.sh
CHANGED
@@ -3,11 +3,23 @@
|
|
3
3
|
full_path=$(realpath "$0")
|
4
4
|
dir_path=$(dirname "$full_path")
|
5
5
|
|
6
|
+
if [ -z "$1" ]
|
7
|
+
then
|
8
|
+
|
9
|
+
installation_path="$dir_path/../lib/ff/ruby/server/generated"
|
10
|
+
echo "No installation has been provided, using the default path: $installation_path"
|
11
|
+
else
|
12
|
+
|
13
|
+
installation_path="$1"
|
14
|
+
echo "Installation path provided: $installation_path"
|
15
|
+
fi
|
16
|
+
|
17
|
+
|
6
18
|
. "$dir_path/sdk_specs.sh"
|
7
19
|
|
8
|
-
if which openapi-generator; then
|
20
|
+
if which openapi-generator-cli; then
|
9
21
|
|
10
|
-
generated_path="$
|
22
|
+
generated_path="$installation_path"
|
11
23
|
|
12
24
|
if test -e "$generated_path"; then
|
13
25
|
|
@@ -16,20 +28,49 @@ if which openapi-generator; then
|
|
16
28
|
echo "'$generated_path' was removed with success 🙂"
|
17
29
|
else
|
18
30
|
|
19
|
-
echo "ERROR: '
|
31
|
+
echo "ERROR: '$generated_path' was not removed before the generation process 😬"
|
32
|
+
exit 1
|
33
|
+
fi
|
34
|
+
else
|
35
|
+
|
36
|
+
if mkdir -p "$generated_path" && test -e "$generated_path"; then
|
37
|
+
|
38
|
+
echo "'$generated_path' has been created with success 🙂"
|
39
|
+
else
|
40
|
+
|
41
|
+
echo "ERROR: '$generated_path' was not created with success 😬"
|
20
42
|
exit 1
|
21
43
|
fi
|
22
44
|
fi
|
23
45
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
46
|
+
if gem install rspec-expectations -v 3.11.0 && \
|
47
|
+
gem install rspec-mocks -v 3.11.0 && \
|
48
|
+
gem install rake -v 13.0 && \
|
49
|
+
gem install minitest -v 5.15.0 && \
|
50
|
+
gem install standard -v 1.11.0 && \
|
51
|
+
gem install pp -v 0.3.0 && \
|
52
|
+
gem install libcache -v 0.4.2 && \
|
53
|
+
gem install rufus-scheduler -v 3.8.1 && \
|
54
|
+
gem install jwt -v 2.3.0 && \
|
55
|
+
gem install moneta -v 1.4.2 && \
|
56
|
+
gem install rest-client -v 2.1.0 && \
|
57
|
+
gem install sse-client -v 1.1.0 && \
|
58
|
+
gem install concurrent-ruby -v 1.1.10 && \
|
59
|
+
gem install murmurhash3 -v 0.1.6 && \
|
60
|
+
cd "$dir_path/.." && \
|
61
|
+
openapi-generator-cli generate -i api.yaml -g ruby -o "$generated_path" && \
|
62
|
+
cd "$generated_path" && gem build openapi_client.gemspec && \
|
63
|
+
test -e "openapi_client-1.0.0.gem" && \
|
64
|
+
gem install --dev "openapi_client-1.0.0.gem"; then
|
30
65
|
|
66
|
+
echo "Generated API has been installed with success: $generated_path"
|
67
|
+
else
|
68
|
+
|
69
|
+
echo "ERROR: 'openapi-generator-cli' is not installed [1] 😬"
|
70
|
+
exit 1
|
71
|
+
fi
|
31
72
|
else
|
32
73
|
|
33
|
-
echo "ERROR: 'openapi-generator' is not installed 😬"
|
74
|
+
echo "ERROR: 'openapi-generator-cli' is not installed [2] 😬"
|
34
75
|
exit 1
|
35
76
|
fi
|
data/scripts/publish.sh
CHANGED
@@ -8,7 +8,7 @@ dir_path=$(dirname "$full_path")
|
|
8
8
|
# shellcheck disable=SC2154
|
9
9
|
if cd "$dir_path/.." && gem build "$ff_ruby_sdk.gemspec"; then
|
10
10
|
|
11
|
-
if
|
11
|
+
if gem install "$ff_ruby_sdk"; then
|
12
12
|
|
13
13
|
gem push "$ff_ruby_sdk-$ff_ruby_sdk_version.gem"
|
14
14
|
else
|
data/scripts/sdk_specs.sh
CHANGED