Skip to main content

Ruby Backend SDK 4.0

Category
SDK
Published

With expanded support for Rails, Rails API, Sinatra, Rack and more

We're excited to announce the release of the Clerk Ruby Backend SDK 4.0! Below is a quick preview of the major changes that we've made.

First-Class Framework Support

In the past, outside of the standard Rails configuration, you had to create your own adapters and helpers to work with Clerk. With this release, we've added or expanded on first-class support for Rails, Rails API, Sinatra, and Rack so that everything works out of the box for the most popular frameworks and configurations.

Here's a quick preview of what 4.0 offers:

Standalone SDK Usage
Clerk.configure do |config|
  config.secret_key = 'sk_live_*****'
end

sdk = Clerk::SDK.new
sdk.users.get_user('*****')
Ruby on Rails
class AdminController < ApplicationController
  include Clerk::Authenticatable

  def index
    @user = clerk.user
  end
end
Sinatra
# Sinatra
class App < Sinatra::Base
  register Sinatra::Clerk

  get "/admin" do
    @user = clerk.user
    erb :index, format: :html5
  end
end

OpenAPI

We've also brought the SDK into full alignment with our Backend API thanks to now generating parts of the SDK from our OpenAPI spec.

You can view the full generated documentation on GitHub.

Upgrading

Upgrade your gem by installing version ~> 4.0.0:

Gemfile
gem 'clerk-skd-ruby', '~> 4.0.0', require: 'clerk'

Breaking Changes

Please note that this release contains a number of breaking changes. Please refer to the upgrade guide for more information.