vortex-ruby-sdk 1.3.0 → 1.5.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: ef46095579ff2ce432423b52947fe7b09bcbac70a9aeaaa72c28245f79aee801
4
- data.tar.gz: b71a185023f2593be2fd5adfa28771eb281de595b8539b023a60448119b29a7b
3
+ metadata.gz: ac2c594fa0a88757da59e6df7f87e0d232b25e53035b560bce733c582d953320
4
+ data.tar.gz: 356960f55a08e9c475bf4be6b126510d36ad8251d2988d44c3ede9f3d00598e4
5
5
  SHA512:
6
- metadata.gz: f9fee1a62aa03ee7184bf596b13644f48bb3df7a6164eec8bae3be10ebe9f66e21c848410831a09ff99136d01a023aa7bebdbbe9cdf95c7333d7a55a94bd58ed
7
- data.tar.gz: 315cdc79b63d0f79563d25e9568df67043245cd8c3d230ef79e322b02c39c7559eb3f5613f0c575b946b01f651397052e1ca8aa76ec51683bec5988a7b2445d2
6
+ metadata.gz: f5b8fd2f00a23144c21d87a3cd127bef7dc25d935d78e9a0120048e075c756a5e5db1f3bf6b0a466e7788c626a75e1f91b019acadf2f334ddb9da811ee37fcd0
7
+ data.tar.gz: b4c4a42a681f9cd772cd2310b00692f149e48171ce5c0659f94dc3995a307a5d6c986aa96984aaf403a0ed610c0491718c8c0323771ba308c25a09f586724265
data/README.md CHANGED
@@ -47,7 +47,9 @@ client = Vortex::Client.new(ENV['VORTEX_API_KEY'])
47
47
  user = {
48
48
  id: 'user-123',
49
49
  email: 'user@example.com',
50
- admin_scopes: ['autojoin'] # Optional - included as adminScopes array in JWT
50
+ user_name: 'Jane Doe', # Optional: user's display name
51
+ user_avatar_url: 'https://example.com/avatars/jane.jpg', # Optional: user's avatar URL
52
+ admin_scopes: ['autojoin'] # Optional: grants autojoin admin privileges
51
53
  }
52
54
 
53
55
  # Generate JWT
@@ -63,22 +65,6 @@ client.accept_invitations(['inv1', 'inv2'], { type: 'email', value: 'user@exampl
63
65
  group_invitations = client.get_invitations_by_group('team', 'team1')
64
66
  ```
65
67
 
66
- ### Generate JWT with Additional Properties
67
-
68
- ```ruby
69
- user = {
70
- id: 'user-123',
71
- email: 'user@example.com'
72
- }
73
-
74
- extra = {
75
- role: 'admin',
76
- department: 'Engineering'
77
- }
78
-
79
- jwt = client.generate_jwt(user: user, extra: extra)
80
- ```
81
-
82
68
  ## Rails Integration
83
69
 
84
70
  Create a controller with Vortex routes:
data/lib/vortex/client.rb CHANGED
@@ -81,13 +81,13 @@ module Vortex
81
81
  }
82
82
 
83
83
  # Add name if present (convert snake_case to camelCase for JWT)
84
- if user[:name]
85
- payload[:name] = user[:name]
84
+ if user[:user_name]
85
+ payload[:userName] = user[:user_name]
86
86
  end
87
87
 
88
- # Add avatarUrl if present (convert snake_case to camelCase for JWT)
89
- if user[:avatar_url]
90
- payload[:avatarUrl] = user[:avatar_url]
88
+ # Add userAvatarUrl if present (convert snake_case to camelCase for JWT)
89
+ if user[:user_avatar_url]
90
+ payload[:userAvatarUrl] = user[:user_avatar_url]
91
91
  end
92
92
 
93
93
  # Add adminScopes if present
@@ -303,17 +303,23 @@ module Vortex
303
303
  # @param inviter [Hash] The inviter info: { user_id: '...', user_email: '...', name: '...' }
304
304
  # @param groups [Array<Hash>, nil] Optional groups: [{ type: '...', group_id: '...', name: '...' }]
305
305
  # @param source [String, nil] Optional source for analytics (defaults to 'api')
306
+ # @param subtype [String, nil] Optional subtype for analytics segmentation (e.g., 'pymk', 'find-friends')
306
307
  # @param template_variables [Hash, nil] Optional template variables for email customization
307
308
  # @param metadata [Hash, nil] Optional metadata passed through to webhooks
309
+ # @param unfurl_config [Hash, nil] Optional link unfurl (Open Graph) config: { title: '...', description: '...', image: '...', type: '...', site_name: '...' }
308
310
  # @return [Hash] Created invitation with :id, :short_link, :status, :created_at
309
311
  # @raise [VortexError] If the request fails
310
312
  #
311
- # @example Create an email invitation
313
+ # @example Create an email invitation with custom link preview
312
314
  # result = client.create_invitation(
313
315
  # 'widget-config-123',
314
316
  # { type: 'email', value: 'invitee@example.com' },
315
317
  # { user_id: 'user-456', user_email: 'inviter@example.com', name: 'John Doe' },
316
- # [{ type: 'team', group_id: 'team-789', name: 'Engineering' }]
318
+ # [{ type: 'team', group_id: 'team-789', name: 'Engineering' }],
319
+ # nil,
320
+ # nil,
321
+ # nil,
322
+ # { title: 'Join the team!', description: 'You have been invited', image: 'https://example.com/og.png' }
317
323
  # )
318
324
  #
319
325
  # @example Create an internal invitation (PYMK flow - no email sent)
@@ -324,7 +330,7 @@ module Vortex
324
330
  # nil,
325
331
  # 'pymk'
326
332
  # )
327
- def create_invitation(widget_configuration_id, target, inviter, groups = nil, source = nil, template_variables = nil, metadata = nil)
333
+ def create_invitation(widget_configuration_id, target, inviter, groups = nil, source = nil, subtype = nil, template_variables = nil, metadata = nil, unfurl_config = nil)
328
334
  raise VortexError, 'widget_configuration_id is required' if widget_configuration_id.nil? || widget_configuration_id.empty?
329
335
  raise VortexError, 'target must have type and value' if target[:type].nil? || target[:value].nil?
330
336
  raise VortexError, 'inviter must have user_id' if inviter[:user_id].nil?
@@ -336,8 +342,8 @@ module Vortex
336
342
  inviter: {
337
343
  userId: inviter[:user_id],
338
344
  userEmail: inviter[:user_email],
339
- name: inviter[:name],
340
- avatarUrl: inviter[:avatar_url]
345
+ userName: inviter[:user_name],
346
+ userAvatarUrl: inviter[:user_avatar_url]
341
347
  }.compact
342
348
  }
343
349
 
@@ -352,8 +358,18 @@ module Vortex
352
358
  end
353
359
 
354
360
  body[:source] = source if source
361
+ body[:subtype] = subtype if subtype
355
362
  body[:templateVariables] = template_variables if template_variables
356
363
  body[:metadata] = metadata if metadata
364
+ if unfurl_config
365
+ body[:unfurlConfig] = {
366
+ title: unfurl_config[:title],
367
+ description: unfurl_config[:description],
368
+ image: unfurl_config[:image],
369
+ type: unfurl_config[:type],
370
+ siteName: unfurl_config[:site_name]
371
+ }.compact
372
+ end
357
373
 
358
374
  response = @connection.post('/api/v1/invitations') do |req|
359
375
  req.headers['Content-Type'] = 'application/json'
data/lib/vortex/types.rb CHANGED
@@ -60,6 +60,21 @@ module Vortex
60
60
  # groups: [INVITATION_GROUP, ...],
61
61
  # # ... other fields
62
62
  # }
63
+ # InvitationTarget represents the target of an invitation
64
+ # @example
65
+ # {
66
+ # type: 'email', # 'email', 'phone', 'share', or 'internal'
67
+ # value: 'user@example.com',
68
+ # name: 'Jane Smith', # Optional: Display name of the person being invited
69
+ # avatarUrl: 'https://...' # Optional: Avatar URL for display in invitation lists
70
+ # }
71
+ INVITATION_TARGET = {
72
+ type: String, # Required: 'email', 'phone', 'share', or 'internal'
73
+ value: String, # Required: Email, phone, or internal ID
74
+ name: String, # Optional: Display name of the person being invited
75
+ avatarUrl: String # Optional: Avatar URL for the person being invited
76
+ }.freeze
77
+
63
78
  INVITATION = {
64
79
  id: String,
65
80
  accountId: String,
@@ -74,7 +89,7 @@ module Vortex
74
89
  invitationType: String,
75
90
  modifiedAt: String,
76
91
  status: String,
77
- target: Array, # of { type: String, value: String }
92
+ target: Array, # of INVITATION_TARGET structures
78
93
  views: Integer,
79
94
  widgetConfigurationId: String,
80
95
  projectId: String,
@@ -83,5 +98,20 @@ module Vortex
83
98
  expired: :boolean,
84
99
  expires: String # ISO 8601 timestamp (optional)
85
100
  }.freeze
101
+
102
+ # CreateInvitationTarget for creating invitations
103
+ # @example
104
+ # {
105
+ # type: 'email',
106
+ # value: 'invitee@example.com',
107
+ # name: 'Jane Smith', # Optional
108
+ # avatarUrl: 'https://...' # Optional
109
+ # }
110
+ CREATE_INVITATION_TARGET = {
111
+ type: String, # Required: 'email', 'phone', or 'internal'
112
+ value: String, # Required: Email, phone, or internal ID
113
+ name: String, # Optional: Display name of the person being invited
114
+ avatarUrl: String # Optional: Avatar URL for the person being invited
115
+ }.freeze
86
116
  end
87
117
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Vortex
4
- VERSION = '1.3.0'
4
+ VERSION = '1.5.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.3.0
4
+ version: 1.5.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-28 00:00:00.000000000 Z
11
+ date: 2026-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday