This file is GENERATED by scripts/gen_readme.rb from docs/. Do NOT edit by hand โ edit the docs, then run: ruby scripts/gen_readme.rb -->
shipeasy-sdk (Ruby)
Server SDK for Shipeasy โ feature flags, dynamic configs, kill switches, A/B experiments, and metric tracking, with Rails i18n view helpers. Server-key only; never embed in a browser.
๐ Full documentation: https://shipeasy-ai.github.io/sdk-ruby/ โ also browsable under
docs/. This README is generated from those docs.Source-available under the Shipeasy-SAL 1.0.
๐ค Using an AI agent?
This SDK ships an installable agent skill โ a copy-paste-ready guide to
Shipeasy.configure + Client.new(user), testing, experiments, error
reporting, and more, with links the agent can pull for deeper docs:
- Skill:
docs/skill/SKILL.mdยท raw:https://shipeasy-ai.github.io/sdk-ruby/skill/SKILL.md - Install it (ships with the gem โ no network):
shipeasy-skill installโ.claude/skills/shipeasy-ruby/SKILL.md(or via the Shipeasy CLI:shipeasy docs skill --sdk ruby --install)
Humans: you can copy that skill straight into your own project's agent skills
directory (e.g. .claude/skills/shipeasy-ruby/SKILL.md) so your coding agent
always uses the correct Shipeasy patterns. Every doc page and snippet is also
fetchable by URL โ start from the manifest at https://shipeasy-ai.github.io/sdk-ruby/manifest.json.
Install
# Gemfile
gem "shipeasy-sdk"
Requires Ruby 3.0+. Per-framework setup (Rails / Sinatra / serverless) and the anon-id middleware are on the Installation page.
Quickstart โ configure once, then Client.new(user) per request
# boot (config/initializers/shipeasy.rb)
Shipeasy.configure do |c|
c.api_key = ENV.fetch("SHIPEASY_SERVER_KEY")
c.attributes = ->(u) { { "user_id" => u.id, "plan" => u.plan } }
end
# per request โ construct once per callsite (cheap; binds the user)
flags = Shipeasy::Client.new(current_user)
flags.get_flag("new_checkout") # NO user arg โ bound at construction
flags.get_config("button_color")
result = flags.get_experiment("checkout_cta", { label: "Buy" })
flags.log_exposure("checkout_cta") # at the decision point
flags.track("purchase", { revenue: 49 }) # on conversion
flags.get_killswitch("payments")
Constructing Shipeasy::Client.new(user) before Shipeasy.configure raises
Shipeasy::Error.
Documentation
| Page | What |
|---|---|
| Overview | The Shipeasy.configure + Client.new(user) model. |
| Installation | Install, frameworks (Rails / Sinatra / serverless), configure wiring. |
| Configuration | Keys, attributes, one-shot vs poll, every option. |
| Feature flags | get_flag, get_flag_detail, defaults. |
| Dynamic configs | get_config, typed decode, defaults. |
| Kill switches | get_killswitch, named switches. |
| Experiments | get_experiment, log_exposure, track. |
| Internationalization | Rails view helpers + the SSR loader tag. |
| Error reporting | see() structured error reporting. |
| Testing | configure_for_testing / configure_for_offline, overrides. |
| OpenFeature | Shipeasy::OpenFeature::Provider (OpenFeature server provider). |
| Advanced | Anon-id middleware, private attributes, sticky bucketing, SSR. |
Copy-paste snippets live under docs/snippets/
(release ยท metrics ยท i18n ยท ops); an installable agent skill is at
docs/skill/SKILL.md.
Testing
Use Shipeasy.configure_for_testing โ the test-mode sibling of Shipeasy.configure. It does zero network, needs no api key, and seeds the values your code under test should see via override arguments. Then read through the ordinary Shipeasy::Client.new(user) โ the same call your production code uses.
require "shipeasy-sdk"
Shipeasy.configure_for_testing(
flags: { "new_checkout" => true },
configs: { "billing_copy" => { "title" => "Welcome" } },
experiments: { "checkout_button" => ["treatment", { "color" => "green" }] },
)
# construct once per callsite (cheap; binds the user)
client = Shipeasy::Client.new({ "user_id" => "u_123" })
client.get_flag("new_checkout") # => true
client.get_config("billing_copy") # => { "title" => "Welcome" }
result = client.get_experiment("checkout_button", { "color" => "blue" })
result.in_experiment # => true
result.group # => "treatment"
result.params # => { "color" => "green" }
# track / log_exposure are no-ops in test mode โ safe to call, send nothing
client.track("purchase", { amount: 49 })
More โ the on-the-spot override helpers and a working example
shipeasy-snapshot.json โ on the Testing page.
License
Shipeasy-SAL 1.0 โ source-available, non-commercial-use, permitted
as a Shipeasy client. Evaluation is tested against the cross-language
MurmurHash3 vectors in experiment-platform/04-evaluation.md.