devcycle-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.
- checksums.yaml +4 -4
- data/README.md +34 -38
- data/devcycle-server-sdk-1.0.0.gem +0 -0
- data/devcycle-server-sdk.gemspec +3 -7
- data/examples/sinatra/Gemfile +1 -1
- data/examples/sinatra/Gemfile.lock +3 -7
- data/examples/sinatra/app.rb +2 -2
- data/lib/devcycle-server-sdk/api/devcycle_api.rb +25 -25
- data/lib/devcycle-server-sdk/version.rb +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa8e4179916b31d1838dbfc2bde1c3d0ba75b2faab66b90406579dae09868709
|
4
|
+
data.tar.gz: dec6f3e808e049e79b24962e390ae2581201ecbc6610b3df039be6daee71d00c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7fa695b877f3c5dd287bd4fe46c6c4f0f3c771ce9261ddf0c60ea9911fcde5dd23a25ed57a076b57cd4c074c7f4854a987fabefd63f8a341ad20393290a70166
|
7
|
+
data.tar.gz: 20f8ceebdf7695329019745bdd14cf6ab041679c5338ada6fc0ea3c99e064c277a52e045a77c94917977217e151e3e72acd9967885d041bd66426ee7be3987a3
|
data/README.md
CHANGED
@@ -12,35 +12,10 @@ This SDK is automatically generated by the [OpenAPI Generator](https://openapi-g
|
|
12
12
|
|
13
13
|
## Installation
|
14
14
|
|
15
|
-
|
15
|
+
Install the gem
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
```shell
|
20
|
-
gem build devcycle-server-sdk.gemspec
|
21
|
-
```
|
22
|
-
|
23
|
-
Then either install the gem locally:
|
24
|
-
|
25
|
-
```shell
|
26
|
-
gem install ./devcycle-server-sdk-1.0.0.gem
|
27
|
-
```
|
28
|
-
|
29
|
-
(for development, run `gem install --dev ./devcycle-server-sdk-1.0.0.gem` to install the development dependencies)
|
30
|
-
|
31
|
-
or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
|
32
|
-
|
33
|
-
Finally add this to the Gemfile:
|
34
|
-
|
35
|
-
gem 'devcycle-server-sdk', '~> 1.0.0'
|
36
|
-
|
37
|
-
### Include the Ruby code directly
|
38
|
-
|
39
|
-
Include the Ruby code directly using `-I` as follows:
|
40
|
-
|
41
|
-
```shell
|
42
|
-
ruby -Ilib script.rb
|
43
|
-
```
|
17
|
+
`gem install devcycle-server-sdk`
|
18
|
+
|
44
19
|
|
45
20
|
## Getting Started
|
46
21
|
|
@@ -61,10 +36,10 @@ user_data = DevCycle::UserData.new({user_id: 'user_id_example'}) # UserData |
|
|
61
36
|
|
62
37
|
begin
|
63
38
|
#Get all features for user data
|
64
|
-
result = api_instance.
|
39
|
+
result = api_instance.all_features(user_data)
|
65
40
|
p result
|
66
41
|
rescue DevCycle::ApiError => e
|
67
|
-
puts "Exception when calling DVCClient->
|
42
|
+
puts "Exception when calling DVCClient->all_features: #{e}"
|
68
43
|
end
|
69
44
|
|
70
45
|
```
|
@@ -90,10 +65,10 @@ user_data = DevCycle::UserData.new({user_id: 'user_id_example'}) # UserData |
|
|
90
65
|
```ruby
|
91
66
|
begin
|
92
67
|
#Get all features for user data
|
93
|
-
result = api_instance.
|
68
|
+
result = api_instance.all_features(user_data)
|
94
69
|
p result
|
95
70
|
rescue DevCycle::ApiError => e
|
96
|
-
puts "Exception when calling DVCClient->
|
71
|
+
puts "Exception when calling DVCClient->all_features: #{e}"
|
97
72
|
end
|
98
73
|
```
|
99
74
|
|
@@ -101,10 +76,10 @@ end
|
|
101
76
|
```ruby
|
102
77
|
begin
|
103
78
|
# Get value of given variable by key, using default value if segmentation is not passed or variable does not exit
|
104
|
-
result = api_instance.
|
79
|
+
result = api_instance.variable("variable-key", user_data, true)
|
105
80
|
p "Received value for #{result.key}: #{result.value}"
|
106
81
|
rescue DevCycle::ApiError => e
|
107
|
-
puts "Exception when calling DVCClient->
|
82
|
+
puts "Exception when calling DVCClient->variable: #{e}"
|
108
83
|
end
|
109
84
|
```
|
110
85
|
|
@@ -112,10 +87,10 @@ end
|
|
112
87
|
```ruby
|
113
88
|
begin
|
114
89
|
#Get all variables for user data
|
115
|
-
result = api_instance.
|
90
|
+
result = api_instance.all_variables(user_data)
|
116
91
|
p result
|
117
92
|
rescue DevCycle::ApiError => e
|
118
|
-
puts "Exception when calling DVCClient->
|
93
|
+
puts "Exception when calling DVCClient->all_variables: #{e}"
|
119
94
|
end
|
120
95
|
```
|
121
96
|
|
@@ -133,10 +108,10 @@ event_data = DevCycle::Event.new({
|
|
133
108
|
|
134
109
|
begin
|
135
110
|
# Post events for given user data
|
136
|
-
result = api_instance.
|
111
|
+
result = api_instance.track(user_data, event_data)
|
137
112
|
p result
|
138
113
|
rescue DevCycle::ApiError => e
|
139
|
-
puts "Exception when calling DVCClient->
|
114
|
+
puts "Exception when calling DVCClient->track: #{e}"
|
140
115
|
end
|
141
116
|
```
|
142
117
|
|
@@ -173,3 +148,24 @@ end
|
|
173
148
|
- [DevCycle::UserData](docs/UserData.md)
|
174
149
|
- [DevCycle::Variable](docs/Variable.md)
|
175
150
|
|
151
|
+
### Development
|
152
|
+
|
153
|
+
To build the Ruby code into a gem:
|
154
|
+
|
155
|
+
```shell
|
156
|
+
gem build devcycle-server-sdk.gemspec
|
157
|
+
```
|
158
|
+
|
159
|
+
Then either install the gem locally:
|
160
|
+
|
161
|
+
```shell
|
162
|
+
gem install ./devcycle-server-sdk-1.0.0.gem
|
163
|
+
```
|
164
|
+
|
165
|
+
(for development, run `gem install --dev ./devcycle-server-sdk-1.0.0.gem` to install the development dependencies)
|
166
|
+
|
167
|
+
or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
|
168
|
+
|
169
|
+
Finally add this to the Gemfile:
|
170
|
+
|
171
|
+
gem 'devcycle-server-sdk', '~> 1.0.0'
|
Binary file
|
data/devcycle-server-sdk.gemspec
CHANGED
@@ -2,14 +2,10 @@
|
|
2
2
|
|
3
3
|
=begin
|
4
4
|
#DevCycle Bucketing API
|
5
|
-
|
6
5
|
#Documents the DevCycle Bucketing API which provides and API interface to User Bucketing and for generated SDKs.
|
7
|
-
|
8
6
|
The version of the OpenAPI document: 1.0.0
|
9
|
-
|
10
7
|
Generated by: https://openapi-generator.tech
|
11
8
|
OpenAPI Generator version: 5.3.0
|
12
|
-
|
13
9
|
=end
|
14
10
|
|
15
11
|
$:.push File.expand_path("../lib", __FILE__)
|
@@ -21,9 +17,9 @@ Gem::Specification.new do |s|
|
|
21
17
|
s.platform = Gem::Platform::RUBY
|
22
18
|
s.authors = ["DevCycleHQ"]
|
23
19
|
s.email = ["support@devcycle.com"]
|
24
|
-
s.homepage = "https://
|
20
|
+
s.homepage = "https://devcycle.com"
|
25
21
|
s.summary = "DevCycle Bucketing API Ruby Gem"
|
26
|
-
s.description = "
|
22
|
+
s.description = "DevCycle Ruby Server SDK, for interacting with feature flags created with the DevCycle platform."
|
27
23
|
s.license = "MIT"
|
28
24
|
s.required_ruby_version = ">= 2.4"
|
29
25
|
|
@@ -35,4 +31,4 @@ Gem::Specification.new do |s|
|
|
35
31
|
s.test_files = `find spec/*`.split("\n")
|
36
32
|
s.executables = []
|
37
33
|
s.require_paths = ["lib"]
|
38
|
-
end
|
34
|
+
end
|
data/examples/sinatra/Gemfile
CHANGED
@@ -1,13 +1,9 @@
|
|
1
|
-
PATH
|
2
|
-
remote: ../..
|
3
|
-
specs:
|
4
|
-
devcycle-server-sdk (1.0.0)
|
5
|
-
typhoeus (~> 1.0, >= 1.0.1)
|
6
|
-
|
7
1
|
GEM
|
8
2
|
remote: https://rubygems.org/
|
9
3
|
specs:
|
10
4
|
daemons (1.4.1)
|
5
|
+
devcycle-server-sdk (1.0.0)
|
6
|
+
typhoeus (~> 1.0, >= 1.0.1)
|
11
7
|
ethon (0.15.0)
|
12
8
|
ffi (>= 1.15.0)
|
13
9
|
eventmachine (1.2.7)
|
@@ -42,7 +38,7 @@ PLATFORMS
|
|
42
38
|
x86_64-darwin-19
|
43
39
|
|
44
40
|
DEPENDENCIES
|
45
|
-
devcycle-server-sdk
|
41
|
+
devcycle-server-sdk
|
46
42
|
sinatra
|
47
43
|
sinatra-contrib
|
48
44
|
thin
|
data/examples/sinatra/app.rb
CHANGED
@@ -25,7 +25,7 @@ get '/' do
|
|
25
25
|
end
|
26
26
|
|
27
27
|
get '/experiment' do
|
28
|
-
result = api_instance.
|
28
|
+
result = api_instance.variable("test-feature", user_data, false)
|
29
29
|
p result
|
30
30
|
|
31
31
|
"Your variable result is: #{result.value}"
|
@@ -41,7 +41,7 @@ get '/track-event' do
|
|
41
41
|
}
|
42
42
|
})
|
43
43
|
|
44
|
-
result = api_instance.
|
44
|
+
result = api_instance.track(user_data, event_data)
|
45
45
|
|
46
46
|
p result
|
47
47
|
end
|
@@ -29,14 +29,14 @@ module DevCycle
|
|
29
29
|
# @param user_data [UserData]
|
30
30
|
# @param [Hash] opts the optional parameters
|
31
31
|
# @return [Hash<String, Feature>]
|
32
|
-
def
|
32
|
+
def all_features(user_data, opts = {})
|
33
33
|
if !user_data.is_a?(DevCycle::UserData)
|
34
34
|
fail ArgumentError, "user_data param must be an instance of UserData!"
|
35
35
|
end
|
36
36
|
|
37
37
|
validate_model(user_data)
|
38
38
|
|
39
|
-
data, _status_code, _headers =
|
39
|
+
data, _status_code, _headers = all_features_with_http_info(user_data, opts)
|
40
40
|
data
|
41
41
|
end
|
42
42
|
|
@@ -44,13 +44,13 @@ module DevCycle
|
|
44
44
|
# @param user_data [UserData]
|
45
45
|
# @param [Hash] opts the optional parameters
|
46
46
|
# @return [Array<(Hash<String, Feature>, Integer, Hash)>] Hash<String, Feature> data, response status code and response headers
|
47
|
-
def
|
47
|
+
def all_features_with_http_info(user_data, opts = {})
|
48
48
|
if @api_client.config.debugging
|
49
|
-
@api_client.config.logger.debug 'Calling API: DVCClient.
|
49
|
+
@api_client.config.logger.debug 'Calling API: DVCClient.all_features ...'
|
50
50
|
end
|
51
51
|
# verify the required parameter 'user_data' is set
|
52
52
|
if @api_client.config.client_side_validation && user_data.nil?
|
53
|
-
fail ArgumentError, "Missing the required parameter 'user_data' when calling DVCClient.
|
53
|
+
fail ArgumentError, "Missing the required parameter 'user_data' when calling DVCClient.all_features"
|
54
54
|
end
|
55
55
|
# resource path
|
56
56
|
local_var_path = '/v1/features'
|
@@ -81,7 +81,7 @@ module DevCycle
|
|
81
81
|
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
82
82
|
|
83
83
|
new_options = opts.merge(
|
84
|
-
:operation => :"DVCClient.
|
84
|
+
:operation => :"DVCClient.all_features",
|
85
85
|
:header_params => header_params,
|
86
86
|
:query_params => query_params,
|
87
87
|
:form_params => form_params,
|
@@ -92,7 +92,7 @@ module DevCycle
|
|
92
92
|
|
93
93
|
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
94
94
|
if @api_client.config.debugging
|
95
|
-
@api_client.config.logger.debug "API called: DVCClient#
|
95
|
+
@api_client.config.logger.debug "API called: DVCClient#all_features\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
96
96
|
end
|
97
97
|
return data, status_code, headers
|
98
98
|
end
|
@@ -103,14 +103,14 @@ module DevCycle
|
|
103
103
|
# @param default Default value for variable if none is retrieved
|
104
104
|
# @param [Hash] opts the optional parameters
|
105
105
|
# @return [Variable]
|
106
|
-
def
|
106
|
+
def variable(key, user_data, default, opts = {})
|
107
107
|
if !user_data.is_a?(DevCycle::UserData)
|
108
108
|
fail ArgumentError, "user_data param must be an instance of UserData!"
|
109
109
|
end
|
110
110
|
|
111
111
|
validate_model(user_data)
|
112
112
|
|
113
|
-
data, _status_code, _headers =
|
113
|
+
data, _status_code, _headers = variable_with_http_info(key, user_data, default, opts)
|
114
114
|
data
|
115
115
|
end
|
116
116
|
|
@@ -120,17 +120,17 @@ module DevCycle
|
|
120
120
|
# @param default Default value for variable if none is retrieved
|
121
121
|
# @param [Hash] opts the optional parameters
|
122
122
|
# @return [Array<(Variable, Integer, Hash)>] Variable data, response status code and response headers
|
123
|
-
def
|
123
|
+
def variable_with_http_info(key, user_data, default, opts = {})
|
124
124
|
if @api_client.config.debugging
|
125
|
-
@api_client.config.logger.debug 'Calling API: DVCClient.
|
125
|
+
@api_client.config.logger.debug 'Calling API: DVCClient.variable ...'
|
126
126
|
end
|
127
127
|
# verify the required parameter 'key' is set
|
128
128
|
if @api_client.config.client_side_validation && key.nil?
|
129
|
-
fail ArgumentError, "Missing the required parameter 'key' when calling DVCClient.
|
129
|
+
fail ArgumentError, "Missing the required parameter 'key' when calling DVCClient.variable"
|
130
130
|
end
|
131
131
|
# verify the required parameter 'user_data' is set
|
132
132
|
if @api_client.config.client_side_validation && user_data.nil?
|
133
|
-
fail ArgumentError, "Missing the required parameter 'user_data' when calling DVCClient.
|
133
|
+
fail ArgumentError, "Missing the required parameter 'user_data' when calling DVCClient.variable"
|
134
134
|
end
|
135
135
|
# resource path
|
136
136
|
local_var_path = '/v1/variables/{key}'.sub('{' + 'key' + '}', CGI.escape(key.to_s))
|
@@ -161,7 +161,7 @@ module DevCycle
|
|
161
161
|
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
162
162
|
|
163
163
|
new_options = opts.merge(
|
164
|
-
:operation => :"DVCClient.
|
164
|
+
:operation => :"DVCClient.variable",
|
165
165
|
:header_params => header_params,
|
166
166
|
:query_params => query_params,
|
167
167
|
:form_params => form_params,
|
@@ -173,7 +173,7 @@ module DevCycle
|
|
173
173
|
begin
|
174
174
|
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
175
175
|
if @api_client.config.debugging
|
176
|
-
@api_client.config.logger.debug "API called: DVCClient#
|
176
|
+
@api_client.config.logger.debug "API called: DVCClient#variable\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
177
177
|
end
|
178
178
|
return data
|
179
179
|
rescue ApiError => error
|
@@ -189,14 +189,14 @@ module DevCycle
|
|
189
189
|
# @param user_data [UserData]
|
190
190
|
# @param [Hash] opts the optional parameters
|
191
191
|
# @return [Hash<String, Variable>]
|
192
|
-
def
|
192
|
+
def all_variables(user_data, opts = {})
|
193
193
|
if !user_data.is_a?(DevCycle::UserData)
|
194
194
|
fail ArgumentError, "user_data param must be an instance of UserData!"
|
195
195
|
end
|
196
196
|
|
197
197
|
validate_model(user_data)
|
198
198
|
|
199
|
-
data, _status_code, _headers =
|
199
|
+
data, _status_code, _headers = all_variables_with_http_info(user_data, opts)
|
200
200
|
data
|
201
201
|
end
|
202
202
|
|
@@ -204,13 +204,13 @@ module DevCycle
|
|
204
204
|
# @param user_data [UserData]
|
205
205
|
# @param [Hash] opts the optional parameters
|
206
206
|
# @return [Array<(Hash<String, Variable>, Integer, Hash)>] Hash<String, Variable> data, response status code and response headers
|
207
|
-
def
|
207
|
+
def all_variables_with_http_info(user_data, opts = {})
|
208
208
|
if @api_client.config.debugging
|
209
|
-
@api_client.config.logger.debug 'Calling API: DVCClient.
|
209
|
+
@api_client.config.logger.debug 'Calling API: DVCClient.all_variables ...'
|
210
210
|
end
|
211
211
|
# verify the required parameter 'user_data' is set
|
212
212
|
if @api_client.config.client_side_validation && user_data.nil?
|
213
|
-
fail ArgumentError, "Missing the required parameter 'user_data' when calling DVCClient.
|
213
|
+
fail ArgumentError, "Missing the required parameter 'user_data' when calling DVCClient.all_variables"
|
214
214
|
end
|
215
215
|
# resource path
|
216
216
|
local_var_path = '/v1/variables'
|
@@ -241,7 +241,7 @@ module DevCycle
|
|
241
241
|
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
242
242
|
|
243
243
|
new_options = opts.merge(
|
244
|
-
:operation => :"DVCClient.
|
244
|
+
:operation => :"DVCClient.all_variables",
|
245
245
|
:header_params => header_params,
|
246
246
|
:query_params => query_params,
|
247
247
|
:form_params => form_params,
|
@@ -252,7 +252,7 @@ module DevCycle
|
|
252
252
|
|
253
253
|
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
254
254
|
if @api_client.config.debugging
|
255
|
-
@api_client.config.logger.debug "API called: DVCClient#
|
255
|
+
@api_client.config.logger.debug "API called: DVCClient#all_variables\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
256
256
|
end
|
257
257
|
return data, status_code, headers
|
258
258
|
end
|
@@ -261,7 +261,7 @@ module DevCycle
|
|
261
261
|
# @param user_data_and_events_body [UserDataAndEventsBody]
|
262
262
|
# @param [Hash] opts the optional parameters
|
263
263
|
# @return [InlineResponse201]
|
264
|
-
def
|
264
|
+
def track(user_data, event_data, opts = {})
|
265
265
|
if !user_data.is_a?(DevCycle::UserData)
|
266
266
|
fail ArgumentError, "user_data param must be an instance of UserData!"
|
267
267
|
end
|
@@ -274,7 +274,7 @@ module DevCycle
|
|
274
274
|
|
275
275
|
validate_model(event_data)
|
276
276
|
|
277
|
-
data, _status_code, _headers =
|
277
|
+
data, _status_code, _headers = track_with_http_info(user_data, event_data, opts)
|
278
278
|
data
|
279
279
|
end
|
280
280
|
|
@@ -282,7 +282,7 @@ module DevCycle
|
|
282
282
|
# @param user_data_and_events_body [UserDataAndEventsBody]
|
283
283
|
# @param [Hash] opts the optional parameters
|
284
284
|
# @return [Array<(InlineResponse201, Integer, Hash)>] InlineResponse201 data, response status code and response headers
|
285
|
-
def
|
285
|
+
def track_with_http_info(user_data, event_data, opts = {})
|
286
286
|
if @api_client.config.debugging
|
287
287
|
@api_client.config.logger.debug 'Calling API: DVCClient.post_events ...'
|
288
288
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devcycle-server-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- DevCycleHQ
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-11-
|
11
|
+
date: 2021-11-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|
@@ -50,8 +50,8 @@ dependencies:
|
|
50
50
|
- - ">="
|
51
51
|
- !ruby/object:Gem::Version
|
52
52
|
version: 3.6.0
|
53
|
-
description:
|
54
|
-
|
53
|
+
description: DevCycle Ruby Server SDK, for interacting with feature flags created
|
54
|
+
with the DevCycle platform.
|
55
55
|
email:
|
56
56
|
- support@devcycle.com
|
57
57
|
executables: []
|
@@ -61,6 +61,7 @@ files:
|
|
61
61
|
- Gemfile
|
62
62
|
- README.md
|
63
63
|
- Rakefile
|
64
|
+
- devcycle-server-sdk-1.0.0.gem
|
64
65
|
- devcycle-server-sdk.gemspec
|
65
66
|
- docs/DevcycleApi.md
|
66
67
|
- docs/ErrorResponse.md
|
@@ -97,7 +98,7 @@ files:
|
|
97
98
|
- spec/models/user_data_spec.rb
|
98
99
|
- spec/models/variable_spec.rb
|
99
100
|
- spec/spec_helper.rb
|
100
|
-
homepage: https://
|
101
|
+
homepage: https://devcycle.com
|
101
102
|
licenses:
|
102
103
|
- MIT
|
103
104
|
metadata: {}
|