From 1fb51873fae8c93da886cc7e04f8c2af442cd47c Mon Sep 17 00:00:00 2001 From: Andy Leap Date: Fri, 10 Mar 2023 14:47:04 -0500 Subject: [PATCH 1/2] change full stack to feature experimentation --- README.md | 64 ++++++++++++++++++++++++++++++++---------- optimizely-sdk.gemspec | 2 +- 2 files changed, 50 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 16c0a30d..b774a27d 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,25 @@ # Optimizely Ruby SDK + [![Build Status](https://github.com/optimizely/ruby-sdk/actions/workflows/ruby.yml/badge.svg?branch=master)](https://github.com/optimizely/ruby-sdk/actions/workflows/ruby.yml?query=branch%3Amaster) [![Coverage Status](https://coveralls.io/repos/github/optimizely/ruby-sdk/badge.svg)](https://coveralls.io/github/optimizely/ruby-sdk) [![Apache 2.0](https://img.shields.io/github/license/nebula-plugins/gradle-extra-configurations-plugin.svg)](http://www.apache.org/licenses/LICENSE-2.0) -This repository houses the Ruby SDK for use with Optimizely Full Stack and Optimizely Rollouts. -Optimizely Full Stack is A/B testing and feature flag management for product development teams. Experiment in any application. Make every feature on your roadmap an opportunity to learn. Learn more at https://www.optimizely.com/platform/full-stack/, or see the [documentation](https://docs.developers.optimizely.com/full-stack/docs). +This repository houses the Ruby SDK for use with Optimizely Feature Experimentation and Optimizely Full Stack (legacy). + +Optimizely Feature Experimentation is an A/B testing and feature management tool for product development teams that enables you to experiment at every step. Using Optimizely Feature Experimentation allows for every feature on your roadmap to be an opportunity to discover hidden insights. Learn more at [Optimizely.com](https://www.optimizely.com/products/experiment/feature-experimentation/), or see the [developer documentation](https://docs.developers.optimizely.com/experimentation/v4.0.0-full-stack/docs/welcome). + +Optimizely Rollouts is [free feature flags](https://www.optimizely.com/free-feature-flagging/) for development teams. You can easily roll out and roll back features in any application without code deploys, mitigating risk for every feature on your roadmap. -Optimizely Rollouts is free feature flags for development teams. Easily roll out and roll back features in any application without code deploys. Mitigate risk for every feature on your roadmap. Learn more at https://www.optimizely.com/rollouts/, or see the [documentation](https://docs.developers.optimizely.com/rollouts/docs). +## Get Started -## Getting Started +Refer to the [Ruby SDK's developer documentation](https://docs.developers.optimizely.com/experimentation/v4.0.0-full-stack/docs/ruby-sdk) for detailed instructions on getting started with using the SDK. ### Requirements + * Ruby 2.7+ -### Installing the SDK +### Install the SDK The SDK is available through [RubyGems](https://rubygems.org/gems/optimizely-sdk). To install: @@ -23,9 +28,11 @@ gem install optimizely-sdk ``` ### Feature Management Access -To access the Feature Management configuration in the Optimizely dashboard, please contact your Optimizely account executive. +To access the Feature Management configuration in the Optimizely dashboard, please contact your Optimizely customer success manager. + +## Use the Ruby SDK -### Using the SDK +### Initialization You can initialize the Optimizely instance in two ways: directly with a datafile, or by using a factory class, `OptimizelyFactory`, which provides methods to create an Optimizely instance with the default configuration. @@ -71,7 +78,6 @@ You can initialize the Optimizely instance in two ways: directly with a datafile ) ``` - #### HTTP Config Manager The `HTTPConfigManager` asynchronously polls for datafiles from a specified URL at regular intervals by making HTTP requests. @@ -110,7 +116,7 @@ The polling interval is used to specify a fixed delay between consecutive HTTP r A string with placeholder `{sdk_key}` can be provided so that this template along with the provided `sdk_key` is used to form the target URL. **start_by_default** -Boolean flag used to start the `AsyncScheduler` for datafile polling if set to `True`. +Boolean flag used to start the `AsyncScheduler` for datafile polling if set to `true`. **blocking_timeout** The blocking timeout period is used to specify a maximum time to wait for initial bootstrapping. Valid blocking timeout period is between 1 and 2592000 seconds. Default is 15 seconds. @@ -146,7 +152,7 @@ A notification signal will be triggered whenever a _new_ datafile is fetched and * The `BatchEventProcessor` maintains a single consumer thread that pulls events off of the `Queue` and buffers them for either a configured batch size or for a maximum duration before the resulting `LogEvent` is sent to the `NotificationCenter`. -##### Use BatchEventProcessor +#### Use BatchEventProcessor ~~~~~~ event_processor = Optimizely::BatchEventProcessor.new( event_queue: SizedQueue.new(10), @@ -179,9 +185,10 @@ If you enable event batching, make sure that you call the `close` method, `optim | -- | -- | `close()` | Stops all timers and flushes the event queue. This method will also stop any timers that are happening for the datafile manager. -See the Optimizely Full Stack [developer documentation](http://developers.optimizely.com/server/reference/index.html) to learn how to set up your first Full Stack project and use the SDK. +For Further details see the Optimizely [Feature Experimentation documentation](https://docs.developers.optimizely.com/experimentation/v4.0.0-full-stack/docs/welcome) +to learn how to set up your first Ruby project and use the SDK. -## Development +## SDK Development ### Building the SDK @@ -191,9 +198,9 @@ To build a local copy of the gem which will be output to `/pkg`: rake build ``` -### Unit tests +### Unit Tests -##### Running all tests +#### Running all tests You can run all unit tests with: ``` @@ -205,6 +212,7 @@ rake spec Please see [CONTRIBUTING](CONTRIBUTING.md). ### Credits + This software incorporates code from the following open source projects: **Httparty** [https://github.com/jnunemaker/httparty](https://github.com/jnunemaker/httparty) @@ -219,8 +227,8 @@ License (MIT): [https://github.com/ruby-json-schema/json-schema/blob/master/LICE Copyright © 2012 Sokolov Yura 'funny-falcon' License (MIT): [https://github.com/funny-falcon/murmurhash3-ruby/blob/master/LICENSE](https://github.com/funny-falcon/murmurhash3-ruby/blob/master/LICENSE) - ### Additional Code + This software may be used with additional code that is separately downloaded by you. _These components are subject to their own license terms, which you should review carefully_. @@ -249,3 +257,29 @@ License (MIT): [https://github.com/rubocop-hq/rubocop/blob/master/LICENSE.txt](h **WebMock** [https://github.com/bblimke/webmock](https://github.com/bblimke/webmock) Copyright © 2009-2010 Bartosz Blimke License (MIT): [https://github.com/bblimke/webmock/blob/master/LICENSE](https://github.com/bblimke/webmock/blob/master/LICENSE) + +### Other Optimizely SDKs + +- Agent - https://github.com/optimizely/agent + +- Android - https://github.com/optimizely/android-sdk + +- C# - https://github.com/optimizely/csharp-sdk + +- Flutter - https://github.com/optimizely/optimizely-flutter-sdk + +- Go - https://github.com/optimizely/go-sdk + +- Java - https://github.com/optimizely/java-sdk + +- JavaScript - https://github.com/optimizely/javascript-sdk + +- PHP - https://github.com/optimizely/php-sdk + +- Python - https://github.com/optimizely/python-sdk + +- React - https://github.com/optimizely/react-sdk + +- Ruby - https://github.com/optimizely/ruby-sdk + +- Swift - https://github.com/optimizely/swift-sdk diff --git a/optimizely-sdk.gemspec b/optimizely-sdk.gemspec index dd90d70b..c1c5b881 100644 --- a/optimizely-sdk.gemspec +++ b/optimizely-sdk.gemspec @@ -10,7 +10,7 @@ Gem::Specification.new do |spec| spec.required_ruby_version = '>= 2.7' spec.summary = "Ruby SDK for Optimizely's testing framework" - spec.description = "A Ruby SDK for Optimizely's Full Stack product." + spec.description = 'A Ruby SDK for use with Optimizely Feature Experimentation, Optimizely Full Stack (legacy), and Optimizely Rollouts' spec.homepage = 'https://www.optimizely.com/' spec.license = 'Apache-2.0' From c7485ebb784f095d7f58785be26745213a1fef60 Mon Sep 17 00:00:00 2001 From: Andy Leap Date: Fri, 10 Mar 2023 15:45:36 -0500 Subject: [PATCH 2/2] cleanup code blocks --- README.md | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index b774a27d..a10ba8d9 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ You can initialize the Optimizely instance in two ways: directly with a datafile Initialize Optimizely with a datafile. This datafile will be used as ProjectConfig throughout the life of the Optimizely instance. - ``` + ```ruby optimizely_instance = Optimizely::Project.new(datafile) ``` @@ -48,7 +48,7 @@ You can initialize the Optimizely instance in two ways: directly with a datafile 1. Initialize Optimizely by providing an `sdk_key` and an optional `datafile`. This will initialize an HTTPConfigManager that makes an HTTP GET request to the URL (formed using your provided `sdk_key` and the default datafile CDN url template) to asynchronously download the project datafile at regular intervals and update ProjectConfig when a new datafile is received. - ``` + ```ruby optimizely_instance = Optimizely::OptimizelyFactory.default_instance('put_your_sdk_key_here', datafile) ``` @@ -56,14 +56,14 @@ You can initialize the Optimizely instance in two ways: directly with a datafile 2. Initialize Optimizely by providing a Config Manager that implements a `config` method. You can customize our `HTTPConfigManager` as needed. - ``` + ```ruby custom_config_manager = CustomConfigManager.new optimizely_instance = Optimizely::OptimizelyFactory.default_instance_with_config_manager(custom_config_manager) ``` 3. Initialize Optimizely with required `sdk_key` and other optional arguments. - ``` + ```ruby optimizely_instance = Optimizely::OptimizelyFactory.custom_instance( sdk_key, datafile, @@ -83,7 +83,7 @@ You can initialize the Optimizely instance in two ways: directly with a datafile The `HTTPConfigManager` asynchronously polls for datafiles from a specified URL at regular intervals by making HTTP requests. -~~~~~~ +```ruby http_project_config_manager = Optimizely::HTTPProjectConfigManager.new( sdk_key: nil, url: nil, @@ -100,7 +100,7 @@ The `HTTPConfigManager` asynchronously polls for datafiles from a specified URL datafile_access_token: nil, proxy_config: nil ) -~~~~~~ +``` **Note:** You must provide either the `sdk_key` or URL. If you provide both, the URL takes precedence. **sdk_key** @@ -141,7 +141,10 @@ The following properties can be set to override the default configurations for ` | start_by_default | true | Boolean flag to specify if datafile polling should start right away as soon as `HTTPConfigManager` initializes | blocking_timeout | 15 seconds | Maximum time in seconds to block the `config` call until config has been initialized -A notification signal will be triggered whenever a _new_ datafile is fetched and Project Config is updated. To subscribe to these notifications, use the `notification_center.add_notification_listener(Optimizely::NotificationCenter::NOTIFICATION_TYPES[:OPTIMIZELY_CONFIG_UPDATE], @callback)` +A notification signal will be triggered whenever a _new_ datafile is fetched and Project Config is updated. To subscribe to these notifications, use the +```ruby +notification_center.add_notification_listener(Optimizely::NotificationCenter::NOTIFICATION_TYPES[:OPTIMIZELY_CONFIG_UPDATE], @callback) +``` #### BatchEventProcessor @@ -153,7 +156,7 @@ A notification signal will be triggered whenever a _new_ datafile is fetched and * The `BatchEventProcessor` maintains a single consumer thread that pulls events off of the `Queue` and buffers them for either a configured batch size or for a maximum duration before the resulting `LogEvent` is sent to the `NotificationCenter`. #### Use BatchEventProcessor -~~~~~~ +```ruby event_processor = Optimizely::BatchEventProcessor.new( event_queue: SizedQueue.new(10), event_dispatcher: event_dispatcher, @@ -162,7 +165,7 @@ event_processor = Optimizely::BatchEventProcessor.new( logger: logger, notification_center: notification_center ) -~~~~~~ +``` #### Advanced configuration The following properties can be used to customize the `BatchEventProcessor` configuration.