Skip to content

Commit 05cd689

Browse files
authored
Update README.md
Add basic descriptions on how to get started Signed-off-by: Jose Miguel Colella <[email protected]>
1 parent f6f996e commit 05cd689

File tree

1 file changed

+49
-14
lines changed

1 file changed

+49
-14
lines changed

README.md

Lines changed: 49 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,72 @@
1-
# Openfeature::Sdk
1+
# OpenFeature SDK for Ruby
22

3-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/openfeature/sdk`. To experiment with that code, run `bin/console` for an interactive prompt.
3+
[![a](https://img.shields.io/badge/slack-%40cncf%2Fopenfeature-brightgreen?style=flat&logo=slack)](https://cloud-native.slack.com/archives/C0344AANLA1)
4+
[![v0.5.1](https://img.shields.io/static/v1?label=Specification&message=v0.5.1&color=yellow)](https://github.com/open-feature/spec/tree/v0.5.1)
5+
![Ruby](https://img.shields.io/badge/ruby-%23CC342D.svg?style=for-the-badge&logo=ruby&logoColor=white)
46

5-
TODO: Delete this and the text above, and describe your gem
7+
This is the Ruby implementation of [OpenFeature](https://openfeature.dev), a vendor-agnostic abstraction library for evaluating feature flags.
8+
9+
We support multiple data types for flags (numbers, strings, booleans, objects) as well as hooks, which can alter the lifecycle of a flag evaluation.
10+
11+
## Requirements
12+
13+
- Ruby 2.7.6
14+
- Ruby 3.0.4
15+
- Ruby 3.1.2
616

717
## Installation
818

919
Install the gem and add to the application's Gemfile by executing:
1020

11-
$ bundle add openfeature-sdk
21+
```sh
22+
bundle add openfeature-sdk
23+
```
1224

1325
If bundler is not being used to manage dependencies, install the gem by executing:
1426

15-
$ gem install openfeature-sdk
27+
```sh
28+
gem install openfeature-sdk
29+
```
1630

1731
## Usage
1832

19-
TODO: Write usage instructions here
33+
```ruby
34+
require 'openfeature/sdk'
35+
require 'json' # For JSON.dump
36+
37+
# API Initialization and configuration
38+
39+
OpenFeature::SDK.configure do |config|
40+
# your provider of choice
41+
config.provider = OpenFeature::SDK::Provider::NoOpProvider.new
42+
end
2043

21-
## Development
44+
# Create a client
45+
client = OpenFeature::SDK.build_client(name: "my-app")
2246

23-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
47+
# get a bool value
48+
const bool_value = client.fetch_boolean_value(flag_key: 'boolean_flag', default_value: false);
2449

25-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
50+
// get a string value
51+
const string_value = client.fetch_string_value(flag_key: 'string_flag', default_value: false);
52+
53+
// get an numeric value
54+
const float_value = client.fetch_number_value(flag_key: 'number_value', default_value: 1.0);
55+
const integer_value = client.fetch_number_value(flag_key: 'number_value', default_value: 1);
56+
57+
// get an object value
58+
const object = await client.fetch_object_value('object_value', JSON.dump({ name: 'object'}));
59+
```
60+
61+
For complete documentation, visit: https://docs.openfeature.dev/docs/category/concepts
2662

2763
## Contributing
2864

29-
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/openfeature-sdk. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/openfeature-sdk/blob/main/CODE_OF_CONDUCT.md).
65+
See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to the OpenFeature project.
3066

31-
## License
67+
Our community meetings are held regularly and open to everyone. Check the [OpenFeature community calendar](https://calendar.google.com/calendar/u/0?cid=MHVhN2kxaGl2NWRoMThiMjd0b2FoNjM2NDRAZ3JvdXAuY2FsZW5kYXIuZ29vZ2xlLmNvbQ) for specific dates and for the Zoom meeting links.
3268

33-
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
3469

35-
## Code of Conduct
70+
## License
3671

37-
Everyone interacting in the Openfeature::Sdk project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/openfeature-sdk/blob/main/CODE_OF_CONDUCT.md).
72+
[Apache License 2.0](LICENSE)

0 commit comments

Comments
 (0)