Ruby client for evaluating Togul feature flags with local TTL caching and fallback behavior.
gem install togul-flagsrequire "togul"
client = Togul::Client.new(Togul::Config.new(
environment: "production",
api_key: "your-environment-api-key",
timeout: 5,
cache_ttl: 30,
fallback_mode: :fail_closed,
retry_count: 2
))
enabled = client.enabled?("new-dashboard", {
"user_id" => "user-123",
"country" => "TR"
})api_keymust be an environment API key, not a user JWT.- Requests are sent to
POST /api/v1/evaluatewith theX-API-Keyheader. - The cache key includes the full evaluation context.
- The client retries
429and5xx, but stops immediately on401/403/404.