diff --git a/harness/types/capabilities.ts b/harness/types/capabilities.ts index 327040a6..d9f90ecc 100644 --- a/harness/types/capabilities.ts +++ b/harness/types/capabilities.ts @@ -101,6 +101,7 @@ let sdkCapabilities: { [key: string]: string[] } = { Capabilities.allFeatures, ], Ruby: [ + Capabilities.cloud, Capabilities.clientCustomData, Capabilities.v2Config, Capabilities.variablesFeatureId, diff --git a/proxies/ruby/app.rb b/proxies/ruby/app.rb index bf4234cb..ffdc3e7a 100644 --- a/proxies/ruby/app.rb +++ b/proxies/ruby/app.rb @@ -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 @@ -29,8 +29,8 @@ 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 @@ -38,15 +38,26 @@ 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}" diff --git a/proxies/ruby/helpers.rb b/proxies/ruby/helpers.rb index e919bab9..901e672f 100644 --- a/proxies/ruby/helpers.rb +++ b/proxies/ruby/helpers.rb @@ -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'