{"id":28759698,"url":"https://github.com/amplitude/experiment-ruby-server","last_synced_at":"2025-06-17T05:08:01.407Z","repository":{"id":45462149,"uuid":"479489426","full_name":"amplitude/experiment-ruby-server","owner":"amplitude","description":"Amplitude Experiment Ruby Server SDK","archived":false,"fork":false,"pushed_at":"2025-06-10T19:11:19.000Z","size":9521,"stargazers_count":3,"open_issues_count":4,"forks_count":4,"subscribers_count":12,"default_branch":"main","last_synced_at":"2025-06-10T20:29:16.952Z","etag":null,"topics":["experiment","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/amplitude.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","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":"2022-04-08T17:56:30.000Z","updated_at":"2025-06-10T19:11:21.000Z","dependencies_parsed_at":"2023-02-15T13:01:42.648Z","dependency_job_id":"6d1f0eaa-8858-42c0-93f1-d9b95fbd5329","html_url":"https://github.com/amplitude/experiment-ruby-server","commit_stats":{"total_commits":36,"total_committers":7,"mean_commits":5.142857142857143,"dds":"0.41666666666666663","last_synced_commit":"7737f29b964e60756693583ca2157445d46b01b7"},"previous_names":[],"tags_count":33,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amplitude%2Fexperiment-ruby-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amplitude%2Fexperiment-ruby-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amplitude%2Fexperiment-ruby-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amplitude%2Fexperiment-ruby-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amplitude","download_url":"https://codeload.github.com/amplitude/experiment-ruby-server/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amplitude%2Fexperiment-ruby-server/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259148955,"owners_count":22812742,"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":["experiment","ruby"],"created_at":"2025-06-17T05:08:00.893Z","updated_at":"2025-06-17T05:08:01.390Z","avatar_url":"https://github.com/amplitude.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://amplitude.com\" target=\"_blank\" align=\"center\"\u003e\n    \u003cimg src=\"https://static.amplitude.com/lightning/46c85bfd91905de8047f1ee65c7c93d6fa9ee6ea/static/media/amplitude-logo-with-text.4fb9e463.svg\" width=\"280\"\u003e\n  \u003c/a\u003e\n  \u003cbr /\u003e\n\u003c/p\u003e\n\n[![Gem Version](https://badge.fury.io/rb/amplitude-experiment.svg)](https://badge.fury.io/rb/amplitude-experiment)\n\n# Experiment Ruby SDK\nAmplitude Ruby Server SDK for Experiment.\n\n\u003e ⚠️ **Local evaluation process fork safety:** When using a `LocalEvaluationClient` and forking the process, you must call `#start` _after forking_ to update the flag configuration state on the new process. For example, in Puma, this means calling `#start` in the [`on_worker_boot` hook](https://www.rubydoc.info/gems/puma/Puma%2FDSL:on_worker_boot). \n\n## Installation\nInto Gemfile from rubygems.org:\n```ruby\ngem 'amplitude-experiment'\n```\nInto environment gems from rubygems.org:\n```ruby\ngem install 'amplitude-experiment'\n```\nTo install beta versions:\n```ruby\ngem install amplitude-experiment --pre\n```\n\n## Remote Evaluation Quick Start\n```ruby\nrequire 'amplitude-experiment'\n\n# (1) Get your deployment's API key\napiKey = 'YOUR-API-KEY'\n\n# (2) Initialize the experiment client\nexperiment = AmplitudeExperiment.initialize_remote(api_key)\n\n# (3) Fetch variants for a user\nuser = AmplitudeExperiment::User.new(user_id: 'user@company.com', device_id: 'abcezas123', user_properties: {'premium' =\u003e true})\n\n# (4) Lookup a flag's variant\n# \n# To fetch asynchronous\nexperiment.fetch_async(user) do |_, variants|\n  variant = variants['YOUR-FLAG-KEY']\n  unless variant.nil?\n    if variant.value == 'on'\n      # Flag is on\n    else\n      # Flag is off\n    end\n  end\nend\n\n# To fetch synchronous\nvariants = experiment.fetch(user)\nvariant = variants['YOUR-FLAG-KEY']\nunless variant.nil?\n  if variant.value == 'on'\n    # Flag is on\n  else\n    # Flag is off\n  end\nend\n```\n\n## Local Evaluation Quick Start\n\n```ruby\nrequire 'amplitude-experiment'\n\n# (1) Get your deployment's API key\napiKey = 'YOUR-API-KEY'\n\n# (2) Initialize the experiment client\nexperiment = AmplitudeExperiment.initialize_local(api_key)\n\n# (3) Start the local evaluation client\nexperiment.start\n\n# (4) Evaluate a user\nuser = AmplitudeExperiment::User.new(user_id: 'user@company.com', device_id: 'abcezas123', user_properties: {'premium' =\u003e true})\nvariants = experiment.evaluate(user)\nvariant = variants['YOUR-FLAG-KEY']\nunless variant.nil?\n  if variant.value == 'on'\n    # Flag is on\n  else\n    # Flag is off\n  end\nend\n```\n\n## More Information\nPlease visit our :100:[Developer Center](https://www.docs.developers.amplitude.com/experiment/sdks/ruby-sdk/) for more instructions on using our the SDK.\n\nSee our [Experiment Ruby SDK Docs](https://amplitude.github.io/experiment-ruby-server/) for a list and description of all available SDK methods.\n\nSee our [Local Evaluation Repo](https://github.com/amplitude/experiment-evaluation) for more details about local evaluation binary logic.\n\n## Need Help?\nIf you have any problems or issues over our SDK, feel free to [create a github issue](https://github.com/amplitude/experiments-ruby-server/issues/new) or submit a request on [Amplitude Help](https://help.amplitude.com/hc/en-us/requests/new).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famplitude%2Fexperiment-ruby-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famplitude%2Fexperiment-ruby-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famplitude%2Fexperiment-ruby-server/lists"}