Ruby SDK
Use this page to integrate LicenseKit from Ruby with the first-party licensekit-ruby gem.
Who This Is For
- Ruby developers building internal tools or app integrations
- teams that want a lightweight first-party client with verification helpers
- AI agents generating Ruby code against the LicenseKit API
When To Use This
Use this page when your integration language is Ruby and you want the official gem instead of direct HTTP calls.
How It Works
Install
bash
gem install licensekit-ruby -v 0.1.0.alpha.1Package shape
The gem exposes:
LicenseKit::ManagementClientLicenseKit::RuntimeClientLicenseKit::SystemClientLicenseKit::PublicKeyStoreLicenseKit.verify_runtime_result- scope metadata helpers
Auth split
- management routes use
Authorization: Bearer <token> - runtime routes use
Authorization: License <license-key> - system routes use no auth
Reporting support
The management client also covers reporting reads and exports, including activities, usage reports, audit reports, customer summaries, settlement summaries, and export creation/download.
Generated method names follow the existing snake_case pattern, such as:
list_activitiesget_usage_summarylist_usage_ledgercreate_report_export
Scope metadata
ruby
required = LicenseKit.get_required_scopes("createReportExport")
allowed = LicenseKit.has_required_scopes("getUsageSummary", ["report:read"])Example
Runtime validation and verification:
ruby
require "licensekit"
base_url = ENV.fetch("LICENSEKIT_BASE_URL", "https://api.licensekit.dev")
runtime = LicenseKit::RuntimeClient.new(
base_url: base_url,
license_key: ENV.fetch("LICENSEKIT_LICENSE_KEY")
)
system = LicenseKit::SystemClient.new(base_url: base_url)
result = runtime.validate_license(
body: {
"fingerprint" => ENV.fetch("LICENSEKIT_FINGERPRINT", "host-123")
}
)
public_keys = system.list_public_keys
verified = LicenseKit.verify_runtime_result(
result,
LicenseKit::PublicKeyStore.new(public_keys["data"])
)Reporting export example:
ruby
management = LicenseKit::ManagementClient.new(
base_url: base_url,
token: ENV.fetch("LICENSEKIT_MANAGEMENT_TOKEN")
)
export = management.create_report_export(
body: {
"report_kind" => "usage-summary",
"format" => "csv",
"filters" => {
"product_id" => "prod_123"
}
}
)Common Mistakes
- using a management token with the runtime client
- assuming export creation only needs
report:read - skipping verification because Ruby already parsed the JSON response
- treating reporting exports as live reruns instead of frozen artifacts