Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions harness/types/capabilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ let sdkCapabilities: { [key: string]: string[] } = {
Capabilities.allFeatures,
],
Ruby: [
Capabilities.cloud,
Capabilities.clientCustomData,
Capabilities.v2Config,
Capabilities.variablesFeatureId,
Expand Down
35 changes: 23 additions & 12 deletions proxies/ruby/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
{
name: 'Ruby',
version: '', # TODO: Add branch name or SDK version here
capabilities: %w[EdgeDB LocalBucketing]
capabilities: %w[EdgeDB LocalBucketing CloudBucketing]
}.to_json
end

Expand All @@ -29,24 +29,35 @@
request.body.rewind
body = JSON.parse request.body.read

client_id, sdk_key, wait_for_initialization, options =
body.values_at('clientId', 'sdkKey', 'waitForInitialization', 'options')
client_id, sdk_key, wait_for_initialization, enable_cloud_bucketing, options =
body.values_at('clientId', 'sdkKey', 'waitForInitialization', 'enableCloudBucketing', 'options')

if client_id.nil?
status 400
return { message: 'Invalid request: missing clientId' }.to_json
end

begin
dvc_options = DevCycle::DVCOptions.new(
config_cdn_uri: options.fetch('configCDNURI', ''),
events_api_uri: options.fetch('eventsAPIURI', ''),
config_polling_interval_ms: options.fetch('configPollingIntervalMS', 10_000),
event_flush_interval_ms: options.fetch('eventFlushIntervalMS', 10_000),
disable_realtime_updates: true,
)

data_store[:clients][client_id] = DevCycle::DVCClient.new(sdk_key, dvc_options, wait_for_initialization)
options ||= {}

if enable_cloud_bucketing
cloud_options = DevCycle::DVCCloudOptions.new(
enable_edge_db: options.fetch('enableEdgeDB', false),
bucketing_api_uri: options.fetch('bucketingAPIURI', ''),
)

data_store[:clients][client_id] = DevCycle::DVCCloudClient.new(sdk_key, cloud_options, wait_for_initialization)
else
dvc_options = DevCycle::DVCOptions.new(
config_cdn_uri: options.fetch('configCDNURI', ''),
events_api_uri: options.fetch('eventsAPIURI', ''),
config_polling_interval_ms: options.fetch('configPollingIntervalMS', 10_000),
event_flush_interval_ms: options.fetch('eventFlushIntervalMS', 10_000),
disable_realtime_updates: true,
)

data_store[:clients][client_id] = DevCycle::DVCClient.new(sdk_key, dvc_options, wait_for_initialization)
end

status 201
headers 'Location' => "/client/#{client_id}"
Expand Down
2 changes: 1 addition & 1 deletion proxies/ruby/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def get_entity_from_param_type(type, body)
def get_entity_type_from_class_name(class_name)
entity_type = class_name == 'NilClass' ? 'Void' : class_name.split('::').last
case entity_type
when 'DVCClient'
when 'DVCClient', 'DVCCloudClient'
return 'Client'
when 'Hash'
return 'Object'
Expand Down
Loading