{"id":19149815,"url":"https://github.com/harness/ff-ruby-server-sdk","last_synced_at":"2025-05-07T04:44:56.930Z","repository":{"id":37959724,"uuid":"429211998","full_name":"harness/ff-ruby-server-sdk","owner":"harness","description":"Ruby Server SDK for integrating with Harness Feature Flag service.","archived":false,"fork":false,"pushed_at":"2025-01-20T15:05:15.000Z","size":526,"stargazers_count":3,"open_issues_count":1,"forks_count":5,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-05-07T04:44:50.354Z","etag":null,"topics":["cd","ci","feature-flags","ruby","sdk"],"latest_commit_sha":null,"homepage":"https://www.harness.io/","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/harness.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-11-17T21:52:43.000Z","updated_at":"2025-01-20T15:05:18.000Z","dependencies_parsed_at":"2023-11-07T12:31:47.267Z","dependency_job_id":"b93432b1-b3b8-41eb-b981-5359e6ff41dc","html_url":"https://github.com/harness/ff-ruby-server-sdk","commit_stats":{"total_commits":360,"total_committers":7,"mean_commits":51.42857142857143,"dds":0.09722222222222221,"last_synced_commit":"829feaa559a0d566ce87f139a8878b0076862f8a"},"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harness%2Fff-ruby-server-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harness%2Fff-ruby-server-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harness%2Fff-ruby-server-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harness%2Fff-ruby-server-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/harness","download_url":"https://codeload.github.com/harness/ff-ruby-server-sdk/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252816520,"owners_count":21808702,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cd","ci","feature-flags","ruby","sdk"],"created_at":"2024-11-09T08:09:45.905Z","updated_at":"2025-05-07T04:44:56.910Z","avatar_url":"https://github.com/harness.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"Harness CF Ruby Server SDK\n========================\n\n## Table of Contents\n**[Intro](#Intro)**\u003cbr\u003e\n**[Requirements](#Requirements)**\u003cbr\u003e\n**[Quickstart](#Quickstart)**\u003cbr\u003e\n**[Further Reading](docs/further_reading.md)**\u003cbr\u003e\n**[Build Instructions](docs/build.md)**\u003cbr\u003e\n\n## Intro\n\nHarness Feature Flags (FF) is a feature management solution that enables users to change the software’s functionality, without deploying new code. FF uses feature flags to hide code or behaviours without having to ship new versions of the software. A feature flag is like a powerful if statement.\n* For more information, see https://harness.io/products/feature-flags/\n* To read more, see https://ngdocs.harness.io/category/vjolt35atg-feature-flags\n* To sign up, https://app.harness.io/auth/#/signup/\n\n![FeatureFlags](./docs/images/ff-gui.png)\n\n## Requirements\n[Ruby 2.7](https://www.ruby-lang.org/en/documentation/installation/) or newer (ruby --version)\u003cbr\u003e\n\n## Quickstart\nThe Feature Flag SDK provides a client that connects to the feature flag service, and fetches the value\nof feature flags.   The following section provides an example of how to install the SDK and initialize it from\nan application.\nThis quickstart assumes you have followed the instructions to [setup a Feature Flag project and have created a flag called `harnessappdemodarkmode` and created a server API Key](https://ngdocs.harness.io/article/1j7pdkqh7j-create-a-feature-flag#step_1_create_a_project).\n\n### Install the SDK\nInstall the ruby SDK using gem\n```bash\ngem install ff-ruby-server-sdk\n```\nor by adding the following snippet to your project's `Gemfile` file:\n\n```\ngem \"ff-ruby-server-sdk\"\n```\n\n### A Simple Example\nHere is a complete example that will connect to the feature flag service and report the flag value every 10 seconds until the connection is closed.  \nAny time a flag is toggled from the feature flag service you will receive the updated value.\n\n```ruby\nrequire 'ff/ruby/server/sdk/api/config'\nrequire 'ff/ruby/server/sdk/dto/target'\nrequire 'ff/ruby/server/sdk/api/cf_client'\nrequire 'ff/ruby/server/sdk/api/config_builder'\n\nrequire \"logger\"\nrequire \"securerandom\"\n\n$stdout.sync = true\nlogger = Logger.new $stdout\n\n# API Key\napiKey = ENV['FF_API_KEY'] || 'changeme'\n\n# Flag Name\nflagName = ENV['FF_FLAG_NAME'] || 'harnessappdemodarkmode'\n\n# Create a Feature Flag Client and wait for it to initialize\nclient = CfClient.instance\nclient.init(apiKey, ConfigBuilder.new.logger(logger).build)\nclient.wait_for_initialization\n\n# Create a target (different targets can get different results based on rules.  This include a custom attribute 'location')\ntarget = Target.new(\"RubySDK\", identifier=\"rubysdk\", attributes={\"location\": \"emea\"})\n\n# Loop forever reporting the state of the flag\nloop do\n  result = client.bool_variation(flagName, target, false)\n  logger.info \"Flag variation:  #{result}\"\n  sleep 10\nend\n\nclient.close\n```\n\n### Running the example\n\n```bash\n# Install the deps\ngem install ff-ruby-server-sdk typhoeus\n\n# Set your API Key\nexport FF_API_KEY=\u003cyour key here\u003e\n\n# Run the example\nruby ./example/getting_started/getting_started.rb\n```\n\n### Running with docker\nIf you don't have the right version of ruby installed locally, or don't want to install the dependencies you can\nuse docker to quickly get started\n\n```bash\n# Install the package\ndocker run -v $(pwd):/app -w /app -e FF_API_KEY=$FF_API_KEY ruby:2.7-buster gem install --install-dir ./gems ff-ruby-server-sdk typhoeus\n\n# Run the script\ndocker run -v $(pwd):/app -w /app -e FF_API_KEY=$FF_API_KEY -e GEM_HOME=/app/gems ruby:2.7-buster ruby ./example/getting_started/getting_started.rb\n```\n\n### Additional Reading\n\nFurther examples and config options are in the further reading section:\n\n[Further Reading](docs/further_reading.md)\n\n[Ruby on Rails example](ruby_on_rails_example/README.md)\n\n-------------------------\n[Harness](https://www.harness.io/) is a feature management platform that helps teams to build better software and to\ntest features quicker.\n\n-------------------------\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharness%2Fff-ruby-server-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fharness%2Fff-ruby-server-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharness%2Fff-ruby-server-sdk/lists"}