Skip to content

Ruby SDK

The audience-kit gem wraps the REST API. It is early: today it fetches venues and events by ID. Use GraphQL directly for anything else.

Requires Ruby 3.2 or newer.

The gem lives in sdk/ruby/ of the AudienceKit repository. Install it from Git with Bundler:

gem "audience-kit", git: "https://github.com/audience-kit/audience-kit.git", glob: "sdk/ruby/*.gemspec"
require "audience-kit"
Audience::Kit.configure do |c|
c.token = ENV["AUDIENCE_KIT_TOKEN"] # sent as "Authorization: Bearer <token>"
c.base_url = "https://api.audiencekit.io" # the default
end

Without configure, the gem reads AUDIENCE_KIT_TOKEN and AUDIENCE_KIT_BASE_URL from the environment. The token is sent with the Bearer scheme, so use an application API key.

venue = Audience::Kit::Venue.find(venue_id)
venue.data["name"]
event = Audience::Kit::Event.find(event_id)
event.data

data is the raw JSON hash from GET /v1/venues/:id or GET /v1/events/:id. HTTP failures raise Audience::Kit::Error.