vortex-ruby-sdk 1.1.3 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c2f54f415260bef01b6106dc5d32cf274e4b9c45e00cdd89e18ad6dfbc1df177
4
- data.tar.gz: 32e1ab2a8a7bc1ee1a3a683d82832a301f4e3403289a64ff8eea4c77410dc104
3
+ metadata.gz: ef46095579ff2ce432423b52947fe7b09bcbac70a9aeaaa72c28245f79aee801
4
+ data.tar.gz: b71a185023f2593be2fd5adfa28771eb281de595b8539b023a60448119b29a7b
5
5
  SHA512:
6
- metadata.gz: 61262106b17af91ce480f7fac66a79a9d4bf2b7b77c264eba92ea07bf7a82967991e3629b59c84f0edbed77054a4f3f9ac661f9a101a4e28f8dd1efc16deafe9
7
- data.tar.gz: efc03cda77c4d08a66ef056da5d6c72930ce0003bd6418e2cb145a6a95930e0895f7057d4e864c6c78ca7c5a69ac05dca35d0d6e17ea1aec01e480d795244a32
6
+ metadata.gz: f9fee1a62aa03ee7184bf596b13644f48bb3df7a6164eec8bae3be10ebe9f66e21c848410831a09ff99136d01a023aa7bebdbbe9cdf95c7333d7a55a94bd58ed
7
+ data.tar.gz: 315cdc79b63d0f79563d25e9568df67043245cd8c3d230ef79e322b02c39c7559eb3f5613f0c575b946b01f651397052e1ca8aa76ec51683bec5988a7b2445d2
data/CHANGELOG.md CHANGED
@@ -5,6 +5,18 @@ All notable changes to the Vortex Ruby SDK will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.2.0] - 2026-01-23
9
+
10
+ ### Added
11
+ - **Internal Invitations**: New `'internal'` delivery type for customer-managed invitations
12
+ - Support for `deliveryTypes: ['internal']`
13
+ - No email/SMS communication triggered by Vortex
14
+ - Target value can be any customer-defined identifier
15
+ - Useful for in-app invitation flows managed by customer's application
16
+
17
+ ### Changed
18
+ - Updated `deliveryTypes` field documentation to include `'internal'` as a valid value
19
+
8
20
  ## [1.1.3] - 2025-01-29
9
21
 
10
22
  ### Added
data/README.md CHANGED
@@ -12,6 +12,8 @@ A Ruby SDK for the Vortex invitation system, providing seamless integration with
12
12
  - **Same Route Structure**: Ensures React provider compatibility
13
13
  - **Comprehensive Testing**: Full test coverage with RSpec
14
14
  - **Type Safety**: Clear method signatures and documentation
15
+ - **Multiple Delivery Types**: Support for `email`, `phone`, `share`, and `internal` invitation delivery
16
+ - `internal` invitations allow for customer-managed, in-app invitation flows with no external communication
15
17
 
16
18
  ## Installation
17
19
 
data/lib/vortex/client.rb CHANGED
@@ -80,6 +80,16 @@ module Vortex
80
80
  expires: expires
81
81
  }
82
82
 
83
+ # Add name if present (convert snake_case to camelCase for JWT)
84
+ if user[:name]
85
+ payload[:name] = user[:name]
86
+ end
87
+
88
+ # Add avatarUrl if present (convert snake_case to camelCase for JWT)
89
+ if user[:avatar_url]
90
+ payload[:avatarUrl] = user[:avatar_url]
91
+ end
92
+
83
93
  # Add adminScopes if present
84
94
  if user[:admin_scopes]
85
95
  payload[:adminScopes] = user[:admin_scopes]
@@ -204,7 +214,7 @@ module Vortex
204
214
  case target_type
205
215
  when 'email'
206
216
  user[:email] = target_value
207
- when 'sms', 'phoneNumber'
217
+ when 'phone', 'phoneNumber'
208
218
  user[:phone] = target_value
209
219
  else
210
220
  # For other types, try to use as email
@@ -277,6 +287,86 @@ module Vortex
277
287
  raise VortexError, "Failed to reinvite: #{e.message}"
278
288
  end
279
289
 
290
+ # Create an invitation from your backend
291
+ #
292
+ # This method allows you to create invitations programmatically using your API key,
293
+ # without requiring a user JWT token. Useful for server-side invitation creation,
294
+ # such as "People You May Know" flows or admin-initiated invitations.
295
+ #
296
+ # Target types:
297
+ # - 'email': Send an email invitation
298
+ # - 'phone': Create a phone invitation (short link returned for you to send)
299
+ # - 'internal': Create an internal invitation for PYMK flows (no email sent)
300
+ #
301
+ # @param widget_configuration_id [String] The widget configuration ID to use
302
+ # @param target [Hash] The invitation target: { type: 'email|sms|internal', value: '...' }
303
+ # @param inviter [Hash] The inviter info: { user_id: '...', user_email: '...', name: '...' }
304
+ # @param groups [Array<Hash>, nil] Optional groups: [{ type: '...', group_id: '...', name: '...' }]
305
+ # @param source [String, nil] Optional source for analytics (defaults to 'api')
306
+ # @param template_variables [Hash, nil] Optional template variables for email customization
307
+ # @param metadata [Hash, nil] Optional metadata passed through to webhooks
308
+ # @return [Hash] Created invitation with :id, :short_link, :status, :created_at
309
+ # @raise [VortexError] If the request fails
310
+ #
311
+ # @example Create an email invitation
312
+ # result = client.create_invitation(
313
+ # 'widget-config-123',
314
+ # { type: 'email', value: 'invitee@example.com' },
315
+ # { user_id: 'user-456', user_email: 'inviter@example.com', name: 'John Doe' },
316
+ # [{ type: 'team', group_id: 'team-789', name: 'Engineering' }]
317
+ # )
318
+ #
319
+ # @example Create an internal invitation (PYMK flow - no email sent)
320
+ # result = client.create_invitation(
321
+ # 'widget-config-123',
322
+ # { type: 'internal', value: 'internal-user-abc' },
323
+ # { user_id: 'user-456' },
324
+ # nil,
325
+ # 'pymk'
326
+ # )
327
+ def create_invitation(widget_configuration_id, target, inviter, groups = nil, source = nil, template_variables = nil, metadata = nil)
328
+ raise VortexError, 'widget_configuration_id is required' if widget_configuration_id.nil? || widget_configuration_id.empty?
329
+ raise VortexError, 'target must have type and value' if target[:type].nil? || target[:value].nil?
330
+ raise VortexError, 'inviter must have user_id' if inviter[:user_id].nil?
331
+
332
+ # Build request body with camelCase keys for the API
333
+ body = {
334
+ widgetConfigurationId: widget_configuration_id,
335
+ target: target,
336
+ inviter: {
337
+ userId: inviter[:user_id],
338
+ userEmail: inviter[:user_email],
339
+ name: inviter[:name],
340
+ avatarUrl: inviter[:avatar_url]
341
+ }.compact
342
+ }
343
+
344
+ if groups && !groups.empty?
345
+ body[:groups] = groups.map do |g|
346
+ {
347
+ type: g[:type],
348
+ groupId: g[:group_id],
349
+ name: g[:name]
350
+ }
351
+ end
352
+ end
353
+
354
+ body[:source] = source if source
355
+ body[:templateVariables] = template_variables if template_variables
356
+ body[:metadata] = metadata if metadata
357
+
358
+ response = @connection.post('/api/v1/invitations') do |req|
359
+ req.headers['Content-Type'] = 'application/json'
360
+ req.body = JSON.generate(body)
361
+ end
362
+
363
+ handle_response(response)
364
+ rescue VortexError
365
+ raise
366
+ rescue => e
367
+ raise VortexError, "Failed to create invitation: #{e.message}"
368
+ end
369
+
280
370
  private
281
371
 
282
372
  def build_connection
data/lib/vortex/types.rb CHANGED
@@ -69,7 +69,7 @@ module Vortex
69
69
  createdAt: String,
70
70
  deactivated: :boolean,
71
71
  deliveryCount: Integer,
72
- deliveryTypes: Array, # of String
72
+ deliveryTypes: Array, # of String - valid values: "email", "phone", "share", "internal"
73
73
  foreignCreatorId: String,
74
74
  invitationType: String,
75
75
  modifiedAt: String,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Vortex
4
- VERSION = '1.1.3'
4
+ VERSION = '1.3.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vortex-ruby-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vortex Software
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-01-05 00:00:00.000000000 Z
11
+ date: 2026-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday