Skip to content

Commit

Permalink
[FSSDK-8956] chore: prepare 4.0.1 branch for release (#329)
Browse files Browse the repository at this point in the history
* ci: cleanup broken/slow actions (#309)

* fix source clear

* fix readme build badge

* remove readme url check

* updated prefix of ticket-check action (#315)

* [FSSDK-8956] docs: change full stack to feature experimentation (#327)

* change full stack to feature experimentation

* bump version and update changelog (#328)

---------

Co-authored-by: Muhammad Shaharyar <[email protected]>
  • Loading branch information
andrewleap-optimizely and shaharyar123 authored Mar 13, 2023
1 parent 1263f22 commit ff1cd25
Show file tree
Hide file tree
Showing 8 changed files with 102 additions and 75 deletions.
19 changes: 0 additions & 19 deletions .github/workflows/lint_markdown.yml

This file was deleted.

5 changes: 1 addition & 4 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Ruby
name: build

on:
push:
Expand All @@ -7,9 +7,6 @@ on:
branches: [ master ]

jobs:
lint_markdown_files:
uses: optimizely/ruby-sdk/.github/workflows/lint_markdown.yml@master

integration_tests:
uses: optimizely/ruby-sdk/.github/workflows/integration_test.yml@master
secrets:
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/source_clear_crone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.1'
bundler-cache: true
- name: Source clear scan
env:
SRCCLR_API_TOKEN: ${{ secrets.SRCCLR_API_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ticket_reference_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ jobs:
- name: Check for Jira ticket reference
uses: optimizely/github-action-ticket-reference-checker-public@master
with:
bodyRegex: 'OASIS-(?<ticketNumber>\d+)'
bodyRegex: 'FSSDK-(?<ticketNumber>\d+)'
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Optimizely Ruby SDK Changelog

## 4.0.1
March 13th, 2023

We updated our README.md and other non-functional code to reflect that this SDK supports both Optimizely Feature Experimentation and Optimizely Full Stack. ([#327](https://github.com/optimizely/ruby-sdk/pull/327))

## 4.0.0
August 4, 2022
Expand Down
138 changes: 89 additions & 49 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
# Optimizely Ruby SDK
[![Build Status](https://travis-ci.org/optimizely/ruby-sdk.svg?branch=master)](https://travis-ci.org/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.

## Get Started

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).
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.

## Getting Started
### Requirements

### Installing the SDK
* Ruby 2.7+

### Install the SDK

The SDK is available through [RubyGems](https://rubygems.org/gems/optimizely-sdk). To install:

Expand All @@ -20,40 +28,42 @@ 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.

#### Initialization with 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)
```

#### Initialization by OptimizelyFactory

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)
```

When the `datafile` is given then it will be used initially before any update.

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,
Expand All @@ -66,15 +76,14 @@ You can initialize the Optimizely instance in two ways: directly with a datafile
notification_center,
event_processor
)
```
```

#### HTTP Config Manager

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,
Expand All @@ -91,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**
Expand All @@ -107,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.
Expand All @@ -132,19 +141,22 @@ 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

[BatchEventProcessor](https://github.com/optimizely/ruby-sdk/blob/master/lib/optimizely/event/batch_event_processor.rb) is a batched implementation of the [EventProcessor](https://github.com/optimizely/ruby-sdk/blob/master/lib/optimizely/event/event_processor.rb)
[BatchEventProcessor](https://github.com/optimizely/ruby-sdk/blob/master/lib/optimizely/event/batch_event_processor.rb) is a batched implementation of the [EventProcessor](https://github.com/optimizely/ruby-sdk/blob/master/lib/optimizely/event/event_processor.rb)

* Events passed to the `BatchEventProcessor` are immediately added to a `Queue`.

* 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
```ruby
event_processor = Optimizely::BatchEventProcessor.new(
event_queue: SizedQueue.new(10),
event_dispatcher: event_dispatcher,
Expand All @@ -153,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.
Expand All @@ -176,9 +188,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

Expand All @@ -188,9 +201,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:
```
Expand All @@ -202,47 +215,74 @@ 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)
Copyright &copy; 2008 John Nunemaker
**Httparty** [https://github.com/jnunemaker/httparty](https://github.com/jnunemaker/httparty)
Copyright &copy; 2008 John Nunemaker
License (MIT): [https://github.com/jnunemaker/httparty/blob/master/MIT-LICENSE](https://github.com/jnunemaker/httparty/blob/master/MIT-LICENSE)
**JSON Schema Validator** [https://github.com/ruby-json-schema/json-schema](https://github.com/ruby-json-schema/json-schema)
Copyright &copy; 2010-2011, Lookingglass Cyber Solutions
**JSON Schema Validator** [https://github.com/ruby-json-schema/json-schema](https://github.com/ruby-json-schema/json-schema)
Copyright &copy; 2010-2011, Lookingglass Cyber Solutions
License (MIT): [https://github.com/ruby-json-schema/json-schema/blob/master/LICENSE.md](https://github.com/ruby-json-schema/json-schema/blob/master/LICENSE.md)
**Murmurhash3** [https://github.com/funny-falcon/murmurhash3-ruby](https://github.com/funny-falcon/murmurhash3-ruby)
Copyright &copy; 2012 Sokolov Yura 'funny-falcon'
**Murmurhash3** [https://github.com/funny-falcon/murmurhash3-ruby](https://github.com/funny-falcon/murmurhash3-ruby)
Copyright &copy; 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_.
**Bundler** [https://github.com/bundler/bundler](https://github.com/bundler/bundler)
Copyright &copy; 2008-2018 Andre Arko, Engine Yard, et al
**Bundler** [https://github.com/bundler/bundler](https://github.com/bundler/bundler)
Copyright &copy; 2008-2018 Andre Arko, Engine Yard, et al
License (MIT): [https://github.com/bundler/bundler/blob/master/LICENSE.md](https://github.com/bundler/bundler/blob/master/LICENSE.md)
**Coveralls** [https://github.com/lemurheavy/coveralls-ruby](https://github.com/lemurheavy/coveralls-ruby)
Copyright &copy; 2012 Wil Gieseler
**Coveralls** [https://github.com/lemurheavy/coveralls-ruby](https://github.com/lemurheavy/coveralls-ruby)
Copyright &copy; 2012 Wil Gieseler
License (MIT): [https://github.com/lemurheavy/coveralls-ruby/blob/master/LICENSE](https://github.com/lemurheavy/coveralls-ruby/blob/master/LICENSE)
**Rake** [https://github.com/ruby/rake](https://github.com/ruby/rake)
Copyright &copy; 2004-2017 Jim Weirich
License (MIT): [https://github.com/ruby/rake/blob/master/MIT-LICENSE](https://github.com/ruby/rake/blob/master/MIT-LICENSE)
**Rake** [https://github.com/ruby/rake](https://github.com/ruby/rake)
Copyright &copy; 2004-2017 Jim Weirich
License (MIT): [https://github.com/ruby/rake/blob/master/MIT-LICENSE](https://github.com/ruby/rake/blob/master/MIT-LICENSE)
**RSpec** [https://github.com/rspec/rspec](https://github.com/rspec/rspec)
Copyright &copy; 2009 Chad Humphries, David Chelimsky
Copyright &copy; 2006 David Chelimsky, The RSpec Development Team
Copyright &copy; 2005 Steven Baker
License (MIT): [https://github.com/rspec/rspec/blob/master/LICENSE.md](https://github.com/rspec/rspec/blob/master/LICENSE.md)
**RSpec** [https://github.com/rspec/rspec](https://github.com/rspec/rspec)
Copyright &copy; 2009 Chad Humphries, David Chelimsky
Copyright &copy; 2006 David Chelimsky, The RSpec Development Team
Copyright &copy; 2005 Steven Baker
License (MIT): [https://github.com/rspec/rspec/blob/master/LICENSE.md](https://github.com/rspec/rspec/blob/master/LICENSE.md)
**RuboCop** [https://github.com/rubocop-hq/rubocop](https://github.com/rubocop-hq/rubocop)
Copyright &copy; 2012-19 Bozhidar Batsov
**RuboCop** [https://github.com/rubocop-hq/rubocop](https://github.com/rubocop-hq/rubocop)
Copyright &copy; 2012-19 Bozhidar Batsov
License (MIT): [https://github.com/rubocop-hq/rubocop/blob/master/LICENSE.txt](https://github.com/rubocop-hq/rubocop/blob/master/LICENSE.txt)
**WebMock** [https://github.com/bblimke/webmock](https://github.com/bblimke/webmock)
Copyright &copy; 2009-2010 Bartosz Blimke
**WebMock** [https://github.com/bblimke/webmock](https://github.com/bblimke/webmock)
Copyright &copy; 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
2 changes: 1 addition & 1 deletion lib/optimizely/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
#
module Optimizely
CLIENT_ENGINE = 'ruby-sdk'
VERSION = '4.0.0'
VERSION = '4.0.1'
end
2 changes: 1 addition & 1 deletion optimizely-sdk.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down

0 comments on commit ff1cd25

Please sign in to comment.