Module: Vortex

Defined in:
lib/vortex.rb,
lib/vortex/error.rb,
lib/vortex/rails.rb,
lib/vortex/types.rb,
lib/vortex/client.rb,
lib/vortex/sinatra.rb,
lib/vortex/version.rb,
lib/vortex/webhooks.rb,
lib/vortex/webhook_types.rb

Overview

Vortex Ruby SDK

This gem provides a Ruby interface to the Vortex invitation system, with the same functionality and API compatibility as other Vortex SDKs (Node.js, Python, Java, Go).

Features:

  • JWT generation with identical algorithm to other SDKs

  • Complete invitation management API

  • Rails and Sinatra framework integrations

  • Same route structure for React provider compatibility

Basic usage:

require 'vortex'

client = Vortex::Client.new(ENV['VORTEX_API_KEY'])

jwt = client.generate_jwt(
  user_id: 'user123',
  identifiers: [{ type: 'email', value: '[email protected]' }],
  groups: [{ id: 'team1', type: 'team', name: 'Engineering' }],
  role: 'admin'
)

Framework integrations:

# Rails
require 'vortex/rails'

# Sinatra
require 'vortex/sinatra'

Defined Under Namespace

Modules: AnalyticsEventTypes, Rails, Sinatra, Types, WebhookEventTypes Classes: AnalyticsEvent, Client, VortexError, WebhookEvent, WebhookSignatureError, Webhooks

Constant Summary collapse

VERSION =
'1.9.0'

Class Method Summary collapse

Class Method Details

.analytics_event?(parsed) ⇒ Boolean

Returns true if the parsed hash is an analytics event

Returns:

  • (Boolean)


108
109
110
# File 'lib/vortex/webhook_types.rb', line 108

def self.analytics_event?(parsed)
  parsed.key?('name')
end

.new(api_key, base_url: nil) ⇒ Vortex::Client

Create a new Vortex client instance

Parameters:

  • api_key (String)

    Your Vortex API key

  • base_url (String) (defaults to: nil)

    Custom base URL (optional)

Returns:



47
48
49
# File 'lib/vortex.rb', line 47

def new(api_key, base_url: nil)
  Client.new(api_key, base_url: base_url)
end

.versionString

Get the current version of the SDK

Returns:

  • (String)

    Version string



54
55
56
# File 'lib/vortex.rb', line 54

def version
  VERSION
end

.webhook_event?(parsed) ⇒ Boolean

Returns true if the parsed hash is a webhook event

Returns:

  • (Boolean)


103
104
105
# File 'lib/vortex/webhook_types.rb', line 103

def self.webhook_event?(parsed)
  parsed.key?('type') && !parsed.key?('name')
end