Ruby SDK
Server-side ingest for Ruby. Matches the Node and Python shapes; zero runtime dependencies (uses Net::HTTP from stdlib).
Install
gem install getfluxly
Or in your Gemfile:
gem "getfluxly"
Supports Ruby 3.1+.
Quick start
require "getfluxly"
client = GetFluxly::Client.new(token: "gflux_secret_yourtoken")
client.track("subscription_started",
external_id: "user_42",
properties: { plan: "pro" })
client.identify(external_id: "user_42",
traits: { email: "x@y.com", plan: "pro" })
client.alias(user_id: "user_42",
anonymous_id: "anon_a8f3c2")
client.flush
client.shutdown # also runs from at_exit
Rails integration
Auto-loaded but opt-in via explicit require:
# config/initializers/getfluxly.rb
require "getfluxly/rails"
GetFluxly::Rails.configure do |c|
c.token = ENV["GFLUX_SERVER_TOKEN"]
end
The Railtie installs an optional Rack middleware that attaches request.gflux_anonymous_id from the incoming Cookie header so controller-level track calls can resume an existing browser session.
Configuration
Defaults match Node and Python.
| Option | Default | Notes |
| --- | --- | --- |
| flush_at | 20 | Events queued before forced flush |
| flush_interval | 5.0 | Periodic flush, seconds |
| max_retries | 2 | Per failed batch |
| timeout | 5.0 | Per HTTP request, seconds |
| max_queue_size | 1000 | Hard cap, raises queue_overflow |
A background flusher thread drains the queue every flush_interval. at_exit runs a final flush. Each batch carries a unique X-Idempotency-Key.
Errors
begin
client.track("invoice_paid", external_id: "user_42")
rescue GetFluxly::Error => e
case e.code
when "queue_overflow"
# back-pressure; the batch is full
when "rate_limited"
# SDK already retried max_retries times
end
end