devcycle-ruby-server-sdk 2.5.0 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d8c07f64c0f9502b416e2dc3b9afc93e1216882c6ae3d2d66fc4ca7107c67e92
4
- data.tar.gz: f9d5fe62a88f135885813a1dadcee08eb1e2f009e66b060ef0ef755b4076a5ea
3
+ metadata.gz: 1a430c89852328eb9c5b7d6ef5d5af059dc0cca0f4f92d970078c7ce99ba30bb
4
+ data.tar.gz: 779241990b71f283cd20b7f6ddba222988ba4b09269c8380d944267b063a909b
5
5
  SHA512:
6
- metadata.gz: 16baaf07fc0435ea726242cc883e401b5dcb02f4e3dad764c4eaf5271c671721e0f5b70acc23a348ecb3c2783709d75872f697f20b1c5c12d1e905cb2b846097
7
- data.tar.gz: fc33c462bba5e14f85c18017a5faf950b2fe42669028bd18f41fa51a123098077fed950adcc3b6f251185cbc7dde6c196ccc1478e28835ec939aaf06a2892def
6
+ metadata.gz: 69aad9997132cc4635bc9a526c7b32db6f8e2c3debf7fd1523f76df55d072ca1af858820778f89e10cc3b64a6dbf49c136ba9b56a70dd9a6d86bbcb0650b6441
7
+ data.tar.gz: 781849079fdc8cb6377de5a5c06a857fb33d6cc378bb46692cb67dc9f8e4049a349874aacf4865daa5b0da0f3d5bbff79d9a62a0945a30e55d47f3e36c88e5f2
data/README.md CHANGED
@@ -23,15 +23,15 @@ DevCycle.configure do |config|
23
23
  config.api_key['bearerAuth'] = 'YOUR API KEY'
24
24
  end
25
25
 
26
- api_instance = DevCycle::DVCClient.new
27
- user_data = DevCycle::UserData.new({user_id: 'user_id_example'}) # UserData |
26
+ api_instance = DevCycle::Client.new
27
+ user = DevCycle::User.new({ user_id: 'user_id_example' }) # User |
28
28
 
29
29
  begin
30
30
  #Get all features for user data
31
- result = api_instance.all_features(user_data)
31
+ result = api_instance.all_features(user)
32
32
  p result
33
33
  rescue DevCycle::ApiError => e
34
- puts "Exception when calling DVCClient->all_features: #{e}"
34
+ puts "Exception when calling DevCycle::Client->all_features: #{e}"
35
35
  end
36
36
 
37
37
  ```
@@ -1,21 +1,9 @@
1
- =begin
2
- #DevCycle Bucketing API
3
-
4
- #Documents the DevCycle Bucketing API which provides and API interface to User Bucketing and for generated SDKs.
5
-
6
- The version of the OpenAPI document: 1.0.0
7
-
8
- Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 5.3.0
10
-
11
- =end
12
-
13
1
  require 'cgi'
14
2
  require 'logger'
15
3
 
16
4
  module DevCycle
17
- class DVCClient
18
- def initialize(sdkKey, dvc_options = DVCOptions.new, wait_for_init = false)
5
+ class Client
6
+ def initialize(sdkKey, dvc_options = Options.new, wait_for_init = false)
19
7
  if sdkKey.nil?
20
8
  raise ArgumentError.new('Missing SDK key!')
21
9
  elsif !sdkKey.start_with?('server') && !sdkKey.start_with?('dvc_server')
@@ -78,23 +66,23 @@ module DevCycle
78
66
  end
79
67
 
80
68
  # Get all features by key for user data
81
- # @param user_data [UserData]
69
+ # @param user [User]
82
70
  # @param [Hash] opts the optional parameters
83
71
  # @return [Hash<String, Feature>]
84
- def all_features(user_data, opts = {})
85
- if !user_data.is_a?(DevCycle::UserData)
86
- fail ArgumentError, "user_data param must be an instance of UserData!"
72
+ def all_features(user, opts = {})
73
+ if !user.is_a?(DevCycle::User)
74
+ fail ArgumentError, "user param must be an instance of DevCycle::User!"
87
75
  end
88
76
 
89
- validate_model(user_data)
77
+ validate_model(user)
90
78
 
91
79
  if @dvc_options.enable_cloud_bucketing
92
- data, _status_code, _headers = all_features_with_http_info(user_data, opts)
80
+ data, _status_code, _headers = all_features_with_http_info(user, opts)
93
81
  return data
94
82
  end
95
83
 
96
84
  if local_bucketing_initialized? && @local_bucketing.has_config
97
- bucketed_config = @local_bucketing.generate_bucketed_config(user_data)
85
+ bucketed_config = @local_bucketing.generate_bucketed_config(user)
98
86
  bucketed_config.features
99
87
  else
100
88
  {}
@@ -102,16 +90,16 @@ module DevCycle
102
90
  end
103
91
 
104
92
  # Get all features by key for user data
105
- # @param user_data [UserData]
93
+ # @param user [User]
106
94
  # @param [Hash] opts the optional parameters
107
95
  # @return [Array<(Hash<String, Feature>, Integer, Hash)>] Hash<String, Feature> data, response status code and response headers
108
- def all_features_with_http_info(user_data, opts = {})
96
+ def all_features_with_http_info(user, opts = {})
109
97
  if @api_client.config.debugging
110
- @api_client.config.logger.debug 'Calling API: DVCClient.all_features ...'
98
+ @api_client.config.logger.debug 'Calling API: DevCycle::Client.all_features ...'
111
99
  end
112
- # verify the required parameter 'user_data' is set
113
- if @api_client.config.client_side_validation && user_data.nil?
114
- fail ArgumentError, "Missing the required parameter 'user_data' when calling DVCClient.all_features"
100
+ # verify the required parameter 'user' is set
101
+ if @api_client.config.client_side_validation && user.nil?
102
+ fail ArgumentError, "Missing the required parameter 'user' when calling DevCycle::Client.all_features"
115
103
  end
116
104
  # resource path
117
105
  local_var_path = '/v1/features'
@@ -133,7 +121,7 @@ module DevCycle
133
121
  form_params = opts[:form_params] || {}
134
122
 
135
123
  # http body (model)
136
- post_body = opts[:debug_body] || user_data.to_json
124
+ post_body = opts[:debug_body] || user.to_json
137
125
 
138
126
  # return_type
139
127
  return_type = opts[:debug_return_type] || 'Hash<String, Feature>'
@@ -142,7 +130,7 @@ module DevCycle
142
130
  auth_names = opts[:debug_auth_names] || ['bearerAuth']
143
131
 
144
132
  new_options = opts.merge(
145
- :operation => :"DVCClient.all_features",
133
+ :operation => :"Client.all_features",
146
134
  :header_params => header_params,
147
135
  :query_params => query_params,
148
136
  :form_params => form_params,
@@ -153,37 +141,37 @@ module DevCycle
153
141
 
154
142
  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
155
143
  if @api_client.config.debugging
156
- @api_client.config.logger.debug "API called: DVCClient#all_features\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
144
+ @api_client.config.logger.debug "API called: DevCycle::Client#all_features\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
157
145
  end
158
146
  return data, status_code, headers
159
147
  end
160
148
 
161
149
  # Get variable value by key for user data
162
- # @param user_data [UserData]
150
+ # @param user [User]
163
151
  # @param key [String] Variable key
164
152
  # @param default Default value for variable if none is retrieved
165
153
  # @param [Hash] opts the optional parameters
166
154
  # @return variable value which can be: string, number, boolean, or JSON
167
- def variable_value(user_data, key, default, opts = {})
168
- variable_obj = variable(user_data, key, default, opts)
155
+ def variable_value(user, key, default, opts = {})
156
+ variable_obj = variable(user, key, default, opts)
169
157
  variable_obj.value
170
158
  end
171
159
 
172
160
  # Get variable by key for user data
173
- # @param user_data [UserData]
161
+ # @param user [User]
174
162
  # @param key [String] Variable key
175
163
  # @param default Default value for variable if none is retrieved
176
164
  # @param [Hash] opts the optional parameters
177
165
  # @return [Variable]
178
- def variable(user_data, key, default, opts = {})
179
- if !user_data.is_a?(DevCycle::UserData)
180
- fail ArgumentError, "user_data param must be an instance of UserData!"
166
+ def variable(user, key, default, opts = {})
167
+ if !user.is_a?(DevCycle::User)
168
+ fail ArgumentError, "user param must be an instance of DevCycle::User!"
181
169
  end
182
170
 
183
- validate_model(user_data)
171
+ validate_model(user)
184
172
 
185
173
  if @dvc_options.enable_cloud_bucketing
186
- data, _status_code, _headers = variable_with_http_info(key, user_data, default, opts)
174
+ data, _status_code, _headers = variable_with_http_info(key, user, default, opts)
187
175
  return data
188
176
  end
189
177
 
@@ -192,7 +180,7 @@ module DevCycle
192
180
  defaulted = true
193
181
  if local_bucketing_initialized? && @local_bucketing.has_config
194
182
  type_code = variable_type_code_from_type(type)
195
- variable_pb = variable_for_user_pb(user_data, key, type_code)
183
+ variable_pb = variable_for_user_pb(user, key, type_code)
196
184
  unless variable_pb.nil?
197
185
  value = get_variable_value(variable_pb)
198
186
  defaulted = false
@@ -238,21 +226,21 @@ module DevCycle
238
226
 
239
227
  # Get variable by key for user data
240
228
  # @param key [String] Variable key
241
- # @param user_data [UserData]
229
+ # @param user [User]
242
230
  # @param default Default value for variable if none is retrieved
243
231
  # @param [Hash] opts the optional parameters
244
232
  # @return [Array<(Variable, Integer, Hash)>] Variable data, response status code and response headers
245
- def variable_with_http_info(key, user_data, default, opts = {})
233
+ def variable_with_http_info(key, user, default, opts = {})
246
234
  if @api_client.config.debugging
247
- @api_client.config.logger.debug 'Calling API: DVCClient.variable ...'
235
+ @api_client.config.logger.debug 'Calling API: DevCycle::Client.variable ...'
248
236
  end
249
237
  # verify the required parameter 'key' is set
250
238
  if @api_client.config.client_side_validation && key.nil?
251
- fail ArgumentError, "Missing the required parameter 'key' when calling DVCClient.variable"
239
+ fail ArgumentError, "Missing the required parameter 'key' when calling DevCycle::Client.variable"
252
240
  end
253
- # verify the required parameter 'user_data' is set
254
- if @api_client.config.client_side_validation && user_data.nil?
255
- fail ArgumentError, "Missing the required parameter 'user_data' when calling DVCClient.variable"
241
+ # verify the required parameter 'user' is set
242
+ if @api_client.config.client_side_validation && user.nil?
243
+ fail ArgumentError, "Missing the required parameter 'user' when calling DevCycle::Client.variable"
256
244
  end
257
245
  # resource path
258
246
  local_var_path = '/v1/variables/{key}'.sub('{' + 'key' + '}', CGI.escape(key.to_s))
@@ -274,7 +262,7 @@ module DevCycle
274
262
  form_params = opts[:form_params] || {}
275
263
 
276
264
  # http body (model)
277
- post_body = opts[:debug_body] || user_data.to_json
265
+ post_body = opts[:debug_body] || user.to_json
278
266
 
279
267
  # return_type
280
268
  return_type = opts[:debug_return_type] || 'Variable'
@@ -283,7 +271,7 @@ module DevCycle
283
271
  auth_names = opts[:debug_auth_names] || ['bearerAuth']
284
272
 
285
273
  new_options = opts.merge(
286
- :operation => :"DVCClient.variable",
274
+ :operation => :"Client.variable",
287
275
  :header_params => header_params,
288
276
  :query_params => query_params,
289
277
  :form_params => form_params,
@@ -295,7 +283,7 @@ module DevCycle
295
283
  begin
296
284
  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
297
285
  if @api_client.config.debugging
298
- @api_client.config.logger.debug "API called: DVCClient#variable\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
286
+ @api_client.config.logger.debug "API called: DevCycle::Client#variable\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
299
287
  end
300
288
  return data
301
289
  rescue ApiError => error
@@ -308,23 +296,23 @@ module DevCycle
308
296
  end
309
297
 
310
298
  # Get all variables by key for user data
311
- # @param user_data [UserData]
299
+ # @param user [User]
312
300
  # @param [Hash] opts the optional parameters
313
301
  # @return [Hash<String, Variable>]
314
- def all_variables(user_data, opts = {})
315
- if !user_data.is_a?(DevCycle::UserData)
316
- fail ArgumentError, "user_data param must be an instance of UserData!"
302
+ def all_variables(user, opts = {})
303
+ if !user.is_a?(DevCycle::User)
304
+ fail ArgumentError, "user param must be an instance of DevCycle::User!"
317
305
  end
318
306
 
319
- validate_model(user_data)
307
+ validate_model(user)
320
308
 
321
309
  if @dvc_options.enable_cloud_bucketing
322
- data, _status_code, _headers = all_variables_with_http_info(user_data, opts)
310
+ data, _status_code, _headers = all_variables_with_http_info(user, opts)
323
311
  return data
324
312
  end
325
313
 
326
314
  if local_bucketing_initialized? && @local_bucketing.has_config
327
- bucketed_config = @local_bucketing.generate_bucketed_config(user_data)
315
+ bucketed_config = @local_bucketing.generate_bucketed_config(user)
328
316
  bucketed_config.variables
329
317
  else
330
318
  {}
@@ -332,16 +320,16 @@ module DevCycle
332
320
  end
333
321
 
334
322
  # Get all variables by key for user data
335
- # @param user_data [UserData]
323
+ # @param user [User]
336
324
  # @param [Hash] opts the optional parameters
337
325
  # @return [Array<(Hash<String, Variable>, Integer, Hash)>] Hash<String, Variable> data, response status code and response headers
338
- def all_variables_with_http_info(user_data, opts = {})
326
+ def all_variables_with_http_info(user, opts = {})
339
327
  if @api_client.config.debugging
340
- @api_client.config.logger.debug 'Calling API: DVCClient.all_variables ...'
328
+ @api_client.config.logger.debug 'Calling API: DevCycle::Client.all_variables ...'
341
329
  end
342
- # verify the required parameter 'user_data' is set
343
- if @api_client.config.client_side_validation && user_data.nil?
344
- fail ArgumentError, "Missing the required parameter 'user_data' when calling DVCClient.all_variables"
330
+ # verify the required parameter 'user' is set
331
+ if @api_client.config.client_side_validation && user.nil?
332
+ fail ArgumentError, "Missing the required parameter 'user' when calling DevCycle::Client.all_variables"
345
333
  end
346
334
  # resource path
347
335
  local_var_path = '/v1/variables'
@@ -363,7 +351,7 @@ module DevCycle
363
351
  form_params = opts[:form_params] || {}
364
352
 
365
353
  # http body (model)
366
- post_body = opts[:debug_body] || user_data.to_json
354
+ post_body = opts[:debug_body] || user.to_json
367
355
 
368
356
  # return_type
369
357
  return_type = opts[:debug_return_type] || 'Hash<String, Variable>'
@@ -372,7 +360,7 @@ module DevCycle
372
360
  auth_names = opts[:debug_auth_names] || ['bearerAuth']
373
361
 
374
362
  new_options = opts.merge(
375
- :operation => :"DVCClient.all_variables",
363
+ :operation => :"Client.all_variables",
376
364
  :header_params => header_params,
377
365
  :query_params => query_params,
378
366
  :form_params => form_params,
@@ -383,57 +371,57 @@ module DevCycle
383
371
 
384
372
  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
385
373
  if @api_client.config.debugging
386
- @api_client.config.logger.debug "API called: DVCClient#all_variables\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
374
+ @api_client.config.logger.debug "API called: DevCycle::Client#all_variables\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
387
375
  end
388
376
  return data, status_code, headers
389
377
  end
390
378
 
391
379
  # Post events to DevCycle for user
392
- # @param user_data [UserData]
380
+ # @param user [User]
393
381
  # @param event_data [Event]
394
382
  # @param [Hash] opts the optional parameters
395
383
  # @return [InlineResponse201]
396
- def track(user_data, event_data, opts = {})
397
- if !user_data.is_a?(DevCycle::UserData)
398
- fail ArgumentError, "user_data param must be an instance of UserData!"
384
+ def track(user, event_data, opts = {})
385
+ if !user.is_a?(DevCycle::User)
386
+ fail ArgumentError, "user param must be an instance of DevCycle::User!"
399
387
  end
400
388
 
401
- validate_model(user_data)
389
+ validate_model(user)
402
390
 
403
391
  if !event_data.is_a?(DevCycle::Event)
404
- fail ArgumentError, "event_data param must be an instance of Event!"
392
+ fail ArgumentError, "event_data param must be an instance of DevCycle::Event!"
405
393
  end
406
394
 
407
395
  validate_model(event_data)
408
396
 
409
397
  if @dvc_options.enable_cloud_bucketing
410
- track_with_http_info(user_data, event_data, opts)
398
+ track_with_http_info(user, event_data, opts)
411
399
  return
412
400
  end
413
401
 
414
402
  if local_bucketing_initialized?
415
- @event_queue.queue_event(user_data, event_data)
403
+ @event_queue.queue_event(user, event_data)
416
404
  else
417
- @logger.warn('track called before DVCClient initialized, event will not be tracked')
405
+ @logger.warn('track called before DevCycle::Client initialized, event will not be tracked')
418
406
  end
419
407
  end
420
408
 
421
409
  # Post events to DevCycle for user
422
- # @param user_data [UserData]
410
+ # @param user [User]
423
411
  # @param event_data [Event]
424
412
  # @param [Hash] opts the optional parameters
425
413
  # @return [Array<(InlineResponse201, Integer, Hash)>] InlineResponse201 data, response status code and response headers
426
- def track_with_http_info(user_data, event_data, opts = {})
414
+ def track_with_http_info(user, event_data, opts = {})
427
415
  if @api_client.config.debugging
428
- @api_client.config.logger.debug 'Calling API: DVCClient.post_events ...'
416
+ @api_client.config.logger.debug 'Calling API: DevCycle::Client.post_events ...'
429
417
  end
430
418
  # verify the required parameter 'user_data_and_events_body' is set
431
- if @api_client.config.client_side_validation && (user_data.nil? || event_data.nil?)
432
- fail ArgumentError, "Missing the required parameter 'user_data_and_events_body' when calling DVCClient.post_events"
419
+ if @api_client.config.client_side_validation && (user.nil? || event_data.nil?)
420
+ fail ArgumentError, "Missing the required parameter 'user_data_and_events_body' when calling DevCycle::Client.post_events"
433
421
  end
434
422
 
435
423
  user_data_and_events_body = DevCycle::UserDataAndEventsBody.new({
436
- user: user_data,
424
+ user: user,
437
425
  events: [event_data]
438
426
  })
439
427
 
@@ -469,7 +457,7 @@ module DevCycle
469
457
  auth_names = opts[:debug_auth_names] || ['bearerAuth']
470
458
 
471
459
  new_options = opts.merge(
472
- :operation => :"DVCClient.post_events",
460
+ :operation => :"Client.post_events",
473
461
  :header_params => header_params,
474
462
  :query_params => query_params,
475
463
  :form_params => form_params,
@@ -480,7 +468,7 @@ module DevCycle
480
468
 
481
469
  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
482
470
  if @api_client.config.debugging
483
- @api_client.config.logger.debug "API called: DVCClient#post_events\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
471
+ @api_client.config.logger.debug "API called: DevCycle::Client#post_events\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
484
472
  end
485
473
  return data, status_code, headers
486
474
  end
@@ -537,4 +525,7 @@ module DevCycle
537
525
  end
538
526
  end
539
527
  end
528
+
529
+ # @deprecated Use `DevCycle::Client` instead.
530
+ DVCClient = Client
540
531
  end
@@ -38,7 +38,7 @@ module DevCycle
38
38
  fetch_config
39
39
  @config_poller.execute if @polling_enabled
40
40
  rescue => e
41
- @logger.error("DVC Error Initializing Config: #{e.message}")
41
+ @logger.error("DevCycle: Error Initializing Config: #{e.message}")
42
42
  ensure
43
43
  @local_bucketing.initialized = true
44
44
  end
@@ -38,7 +38,7 @@ module DevCycle
38
38
  return
39
39
  end
40
40
  eventCount = payloads.reduce(0) { |sum, payload| sum + payload.eventCount }
41
- @logger.debug("DVC: Flushing #{eventCount} event(s) for #{payloads.length} user(s)")
41
+ @logger.debug("DevCycle: Flushing #{eventCount} event(s) for #{payloads.length} user(s)")
42
42
 
43
43
  payloads.each do |payload|
44
44
  begin
@@ -51,11 +51,11 @@ module DevCycle
51
51
  @logger.error("Error publishing events, status: #{response.code}, body: #{response.return_message}")
52
52
  @local_bucketing.on_payload_failure(payload.payloadId, response.code >= 500)
53
53
  else
54
- @logger.debug("DVC: Flushed #{eventCount} event(s), for #{payload.records.length} user(s)")
54
+ @logger.debug("DevCycle: Flushed #{eventCount} event(s), for #{payload.records.length} user(s)")
55
55
  @local_bucketing.on_payload_success(payload.payloadId)
56
56
  end
57
57
  rescue => e
58
- @logger.error("DVC Error Flushing Events response message: #{e.message}")
58
+ @logger.error("DevCycle: Error Flushing Events response message: #{e.message}")
59
59
  @local_bucketing.on_payload_failure(payload.payloadId, false)
60
60
  end
61
61
  end
@@ -64,7 +64,7 @@ module DevCycle
64
64
  end
65
65
 
66
66
  # Todo: implement PopulatedUser
67
- sig { params(user: UserData, event: Event).returns(NilClass) }
67
+ sig { params(user: User, event: Event).returns(NilClass) }
68
68
  def queue_event(user, event)
69
69
  if max_event_queue_size_reached?
70
70
  @logger.warn("Max event queue size reached, dropping event: #{event}")
@@ -3,7 +3,7 @@ require 'date'
3
3
  require 'bigdecimal'
4
4
  require 'sorbet-runtime'
5
5
 
6
- require_relative 'dvc_options'
6
+ require_relative 'options'
7
7
  require_relative 'platform_data'
8
8
  require_relative 'events_payload'
9
9
  require_relative 'config_manager'
@@ -90,7 +90,7 @@ module DevCycle
90
90
 
91
91
  sig { params(
92
92
  sdkkey: String,
93
- options: DVCOptions,
93
+ options: Options,
94
94
  wait_for_init: T::Boolean
95
95
  ).void }
96
96
  def initialize(sdkkey, options, wait_for_init)
@@ -119,7 +119,7 @@ module DevCycle
119
119
  @config_manager = nil
120
120
  end
121
121
 
122
- sig { params(user: UserData).returns(BucketedUserConfig) }
122
+ sig { params(user: User).returns(BucketedUserConfig) }
123
123
  def generate_bucketed_config(user)
124
124
  @wasm_mutex.synchronize do
125
125
  user_addr = malloc_asc_byte_array(user.to_json)
@@ -138,7 +138,7 @@ module DevCycle
138
138
  end
139
139
  end
140
140
 
141
- sig { params(user: UserData, key: String, variable_type: Integer).returns(T.nilable(String)) }
141
+ sig { params(user: User, key: String, variable_type: Integer).returns(T.nilable(String)) }
142
142
  def variable_for_user(user, key, variable_type)
143
143
  @wasm_mutex.synchronize do
144
144
  user_addr = malloc_asc_string(user.to_json)
@@ -200,7 +200,7 @@ module DevCycle
200
200
  end
201
201
  end
202
202
 
203
- sig { params(user: UserData, event: Event).returns(NilClass) }
203
+ sig { params(user: User, event: Event).returns(NilClass) }
204
204
  def queue_event(user, event)
205
205
  @wasm_mutex.synchronize do
206
206
  begin
@@ -1,5 +1,5 @@
1
1
  module DevCycle
2
- class DVCOptions
2
+ class Options
3
3
  attr_reader :config_polling_interval_ms
4
4
  attr_reader :enable_edge_db
5
5
  attr_reader :enable_cloud_bucketing
@@ -120,4 +120,7 @@ module DevCycle
120
120
  @logger = logger
121
121
  end
122
122
  end
123
+
124
+ # @deprecated Use `DevCycle::Options` instead.
125
+ DVCOptions = Options
123
126
  end
@@ -15,7 +15,7 @@ require 'time'
15
15
  require 'oj'
16
16
 
17
17
  module DevCycle
18
- class UserData
18
+ class User
19
19
 
20
20
  # Unique id to identify the user
21
21
  attr_accessor :user_id
@@ -147,13 +147,13 @@ module DevCycle
147
147
  # @param [Hash] attributes Model attributes in the form of hash
148
148
  def initialize(attributes = {})
149
149
  if (!attributes.is_a?(Hash))
150
- fail ArgumentError, "The input argument (attributes) must be a hash in `DevCycle::UserData` initialize method"
150
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DevCycle::User` initialize method"
151
151
  end
152
152
 
153
153
  # check to see if the attribute exists and convert string to symbol for hash key
154
154
  attributes = attributes.each_with_object({}) { |(k, v), h|
155
155
  if (!self.class.attribute_map.key?(k.to_sym))
156
- fail ArgumentError, "`#{k}` is not a valid attribute in `DevCycle::UserData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
156
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DevCycle::User`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
157
157
  end
158
158
  h[k.to_sym] = v
159
159
  }
@@ -436,4 +436,7 @@ module DevCycle
436
436
  pb_user
437
437
  end
438
438
  end
439
+
440
+ # @deprecated Use `DevCycle::User` instead.
441
+ UserData = User
439
442
  end
@@ -36,7 +36,7 @@ module DevCycle
36
36
  def self.openapi_types
37
37
  {
38
38
  :'events' => :'Array<Event>',
39
- :'user' => :'UserData'
39
+ :'user' => :'User'
40
40
  }
41
41
  end
42
42
 
@@ -11,5 +11,5 @@ OpenAPI Generator version: 5.3.0
11
11
  =end
12
12
 
13
13
  module DevCycle
14
- VERSION = '2.5.0'
14
+ VERSION = '2.6.0'
15
15
  end
@@ -21,14 +21,14 @@ require 'devcycle-ruby-server-sdk/models/error_response'
21
21
  require 'devcycle-ruby-server-sdk/models/event'
22
22
  require 'devcycle-ruby-server-sdk/models/feature'
23
23
  require 'devcycle-ruby-server-sdk/models/inline_response201'
24
- require 'devcycle-ruby-server-sdk/models/user_data'
24
+ require 'devcycle-ruby-server-sdk/models/user'
25
25
  require 'devcycle-ruby-server-sdk/models/user_data_and_events_body'
26
26
  require 'devcycle-ruby-server-sdk/models/variable'
27
27
 
28
28
  # APIs
29
- require 'devcycle-ruby-server-sdk/api/devcycle_api'
29
+ require 'devcycle-ruby-server-sdk/api/client'
30
30
 
31
- require 'devcycle-ruby-server-sdk/localbucketing/dvc_options'
31
+ require 'devcycle-ruby-server-sdk/localbucketing/options'
32
32
  require 'devcycle-ruby-server-sdk/localbucketing/local_bucketing'
33
33
  require 'devcycle-ruby-server-sdk/localbucketing/platform_data'
34
34
  require 'devcycle-ruby-server-sdk/localbucketing/bucketed_user_config'
@@ -13,16 +13,16 @@ OpenAPI Generator version: 5.3.0
13
13
  require 'spec_helper'
14
14
  require 'json'
15
15
 
16
- # Unit tests for DevCycle::DVCClient
16
+ # Unit tests for DevCycle::Client
17
17
  # Automatically generated by openapi-generator (https://openapi-generator.tech)
18
18
  # Please update as you see appropriate
19
- describe 'DVCClient' do
19
+ describe 'DevCycle::Client' do
20
20
  before(:all) do
21
21
  # run before each test
22
- options = DevCycle::DVCOptions.new(enable_cloud_bucketing: true)
23
- @api_instance = DevCycle::DVCClient.new("dvc_server_token_hash", options)
22
+ options = DevCycle::Options.new(enable_cloud_bucketing: true)
23
+ @api_instance = DevCycle::Client.new("dvc_server_token_hash", options)
24
24
 
25
- @user_data = DevCycle::UserData.new({
25
+ @user = DevCycle::User.new({
26
26
  user_id: 'test-user',
27
27
  appVersion: '1.2.3'
28
28
  })
@@ -34,18 +34,18 @@ describe 'DVCClient' do
34
34
 
35
35
  describe 'test an instance of DevcycleApi' do
36
36
  it 'should create an instance of DevcycleApi' do
37
- expect(@api_instance).to be_instance_of(DevCycle::DVCClient)
37
+ expect(@api_instance).to be_instance_of(DevCycle::Client)
38
38
  end
39
39
  end
40
40
 
41
41
  # unit tests for get_features
42
42
  # Get all features by key for user data
43
- # @param user_data
43
+ # @param user
44
44
  # @param [Hash] opts the optional parameters
45
45
  # @return [Hash<String, Feature>]
46
46
  describe 'get_features test' do
47
47
  it 'should work' do # but it don't
48
- #result = @api_instance.all_features(@user_data)
48
+ #result = @api_instance.all_features(@user)
49
49
 
50
50
  #expect(result.length).to eq 1
51
51
  end
@@ -54,15 +54,15 @@ describe 'DVCClient' do
54
54
  # unit tests for get_variable_by_key
55
55
  # Get variable by key for user data
56
56
  # @param key Variable key
57
- # @param user_data
57
+ # @param user
58
58
  # @param [Hash] opts the optional parameters
59
59
  # @return [Variable]
60
60
  describe 'get_variable_by_key activate-flag' do
61
61
  it 'should work' do
62
- result = @api_instance.variable(@user_data, "activate-flag", false)
62
+ result = @api_instance.variable(@user, "activate-flag", false)
63
63
  expect(result.isDefaulted).to eq true
64
64
 
65
- result = @api_instance.variable_value(@user_data, "activate-flag", true)
65
+ result = @api_instance.variable_value(@user, "activate-flag", true)
66
66
  expect(result).to eq true
67
67
  end
68
68
  end
@@ -70,28 +70,28 @@ describe 'DVCClient' do
70
70
  # unit tests for get_variable_by_key
71
71
  # Get variable by key for user data
72
72
  # @param key Variable key
73
- # @param user_data
73
+ # @param user
74
74
  # @param [Hash] opts the optional parameters
75
75
  # @return [Variable]
76
76
  describe 'get_variable_by_key test' do
77
77
  it 'should work' do
78
- result = @api_instance.variable(@user_data, "test", false)
78
+ result = @api_instance.variable(@user, "test", false)
79
79
  expect(result.isDefaulted).to eq false
80
80
  expect(result.value).to eq true
81
81
 
82
- result = @api_instance.variable_value(@user_data, "test", true)
82
+ result = @api_instance.variable_value(@user, "test", true)
83
83
  expect(result).to eq true
84
84
  end
85
85
  end
86
86
 
87
87
  # unit tests for get_variables
88
88
  # Get all variables by key for user data
89
- # @param user_data
89
+ # @param user
90
90
  # @param [Hash] opts the optional parameters
91
91
  # @return [Hash<String, Variable>]
92
92
  describe 'get_variables test' do
93
93
  it 'should work' do
94
- result = @api_instance.all_variables(@user_data)
94
+ result = @api_instance.all_variables(@user)
95
95
 
96
96
  expect(result.length).to eq 1
97
97
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devcycle-ruby-server-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0
4
+ version: 2.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - DevCycleHQ
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-17 00:00:00.000000000 Z
11
+ date: 2023-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -133,18 +133,18 @@ files:
133
133
  - README.md
134
134
  - devcycle-ruby-server-sdk.gemspec
135
135
  - lib/devcycle-ruby-server-sdk.rb
136
- - lib/devcycle-ruby-server-sdk/api/devcycle_api.rb
136
+ - lib/devcycle-ruby-server-sdk/api/client.rb
137
137
  - lib/devcycle-ruby-server-sdk/api_client.rb
138
138
  - lib/devcycle-ruby-server-sdk/api_error.rb
139
139
  - lib/devcycle-ruby-server-sdk/configuration.rb
140
140
  - lib/devcycle-ruby-server-sdk/localbucketing/bucketed_user_config.rb
141
141
  - lib/devcycle-ruby-server-sdk/localbucketing/bucketing-lib.release.wasm
142
142
  - lib/devcycle-ruby-server-sdk/localbucketing/config_manager.rb
143
- - lib/devcycle-ruby-server-sdk/localbucketing/dvc_options.rb
144
143
  - lib/devcycle-ruby-server-sdk/localbucketing/event_queue.rb
145
144
  - lib/devcycle-ruby-server-sdk/localbucketing/event_types.rb
146
145
  - lib/devcycle-ruby-server-sdk/localbucketing/events_payload.rb
147
146
  - lib/devcycle-ruby-server-sdk/localbucketing/local_bucketing.rb
147
+ - lib/devcycle-ruby-server-sdk/localbucketing/options.rb
148
148
  - lib/devcycle-ruby-server-sdk/localbucketing/platform_data.rb
149
149
  - lib/devcycle-ruby-server-sdk/localbucketing/proto/helpers.rb
150
150
  - lib/devcycle-ruby-server-sdk/localbucketing/proto/variableForUserParams.proto
@@ -153,7 +153,7 @@ files:
153
153
  - lib/devcycle-ruby-server-sdk/models/event.rb
154
154
  - lib/devcycle-ruby-server-sdk/models/feature.rb
155
155
  - lib/devcycle-ruby-server-sdk/models/inline_response201.rb
156
- - lib/devcycle-ruby-server-sdk/models/user_data.rb
156
+ - lib/devcycle-ruby-server-sdk/models/user.rb
157
157
  - lib/devcycle-ruby-server-sdk/models/user_data_and_events_body.rb
158
158
  - lib/devcycle-ruby-server-sdk/models/variable.rb
159
159
  - lib/devcycle-ruby-server-sdk/version.rb