vortex-ruby-sdk 1.5.0 → 1.8.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: ac2c594fa0a88757da59e6df7f87e0d232b25e53035b560bce733c582d953320
4
- data.tar.gz: 356960f55a08e9c475bf4be6b126510d36ad8251d2988d44c3ede9f3d00598e4
3
+ metadata.gz: d8b96f994327d61bfa1cb19ee512a9da227762c0212413cb3de3871e9bc26b56
4
+ data.tar.gz: f3750eb0f15fd83a76d5b15da5adf1b39f004b657abb3ac79b811ba56980dce3
5
5
  SHA512:
6
- metadata.gz: f5b8fd2f00a23144c21d87a3cd127bef7dc25d935d78e9a0120048e075c756a5e5db1f3bf6b0a466e7788c626a75e1f91b019acadf2f334ddb9da811ee37fcd0
7
- data.tar.gz: b4c4a42a681f9cd772cd2310b00692f149e48171ce5c0659f94dc3995a307a5d6c986aa96984aaf403a0ed610c0491718c8c0323771ba308c25a09f586724265
6
+ metadata.gz: 73d8968550bb227d4c49fa888e454e3307c8797a33b6812f6cff9b00e48ee144a0396c32492f858e5c8ae02e2a558ecdc56ca192a18dfc4f0d17d81cd57654ea
7
+ data.tar.gz: ab1f06dea51572aa0853ad271cdff44afdb2d502bddedaef32d4c9e3502c74810006af768fe670a8e1a7f8094c9516557e7f006fc0513e3c9764e6d57472c731
data/README.md CHANGED
@@ -58,8 +58,8 @@ jwt = client.generate_jwt(user: user)
58
58
  # Get invitations by target
59
59
  invitations = client.get_invitations_by_target('email', 'user@example.com')
60
60
 
61
- # Accept invitations
62
- client.accept_invitations(['inv1', 'inv2'], { type: 'email', value: 'user@example.com' })
61
+ # Accept an invitation
62
+ client.accept_invitation('inv-123', { email: 'user@example.com' })
63
63
 
64
64
  # Get invitations by group
65
65
  group_invitations = client.get_invitations_by_group('team', 'team1')
@@ -170,7 +170,7 @@ All methods match the functionality of other Vortex SDKs:
170
170
  - `get_invitations_by_target(target_type, target_value)` - Get invitations by target
171
171
  - `get_invitation(invitation_id)` - Get specific invitation
172
172
  - `revoke_invitation(invitation_id)` - Revoke invitation
173
- - `accept_invitations(invitation_ids, target)` - Accept invitations
173
+ - `accept_invitation(invitation_id, user)` - Accept an invitation
174
174
  - `get_invitations_by_group(group_type, group_id)` - Get group invitations
175
175
  - `delete_invitations_by_group(group_type, group_id)` - Delete group invitations
176
176
  - `reinvite(invitation_id)` - Reinvite user
data/lib/vortex/client.rb CHANGED
@@ -95,6 +95,11 @@ module Vortex
95
95
  payload[:adminScopes] = user[:admin_scopes]
96
96
  end
97
97
 
98
+ # Add allowedEmailDomains if present (for domain-restricted invitations)
99
+ if user[:allowed_email_domains] && !user[:allowed_email_domains].empty?
100
+ payload[:allowedEmailDomains] = user[:allowed_email_domains]
101
+ end
102
+
98
103
  # Add any additional properties from attributes
99
104
  if attributes && !attributes.empty?
100
105
  payload.merge!(attributes)
@@ -248,6 +253,22 @@ module Vortex
248
253
  raise VortexError, "Failed to accept invitations: #{e.message}"
249
254
  end
250
255
 
256
+ # Accept a single invitation (recommended method)
257
+ #
258
+ # This is the recommended method for accepting invitations.
259
+ #
260
+ # @param invitation_id [String] Single invitation ID to accept
261
+ # @param user [Hash] User hash with :email and/or :phone
262
+ # @return [Hash] The accepted invitation result
263
+ # @raise [VortexError] If the request fails
264
+ #
265
+ # @example
266
+ # user = { email: 'user@example.com', name: 'John Doe' }
267
+ # result = client.accept_invitation('inv-123', user)
268
+ def accept_invitation(invitation_id, user)
269
+ accept_invitations([invitation_id], user)
270
+ end
271
+
251
272
  # Get invitations by group
252
273
  #
253
274
  # @param group_type [String] The group type
@@ -383,6 +404,81 @@ module Vortex
383
404
  raise VortexError, "Failed to create invitation: #{e.message}"
384
405
  end
385
406
 
407
+ # Get autojoin domains configured for a specific scope
408
+ #
409
+ # @param scope_type [String] The type of scope (e.g., "organization", "team", "project")
410
+ # @param scope [String] The scope identifier (customer's group ID)
411
+ # @return [Hash] Response with :autojoin_domains array and :invitation
412
+ # @raise [VortexError] If the request fails
413
+ #
414
+ # @example
415
+ # result = client.get_autojoin_domains('organization', 'acme-org')
416
+ # result['autojoinDomains'].each do |domain|
417
+ # puts "Domain: #{domain['domain']}"
418
+ # end
419
+ def get_autojoin_domains(scope_type, scope)
420
+ encoded_scope_type = URI.encode_www_form_component(scope_type)
421
+ encoded_scope = URI.encode_www_form_component(scope)
422
+
423
+ response = @connection.get("/api/v1/invitations/by-scope/#{encoded_scope_type}/#{encoded_scope}/autojoin")
424
+ handle_response(response)
425
+ rescue VortexError
426
+ raise
427
+ rescue => e
428
+ raise VortexError, "Failed to get autojoin domains: #{e.message}"
429
+ end
430
+
431
+ # Configure autojoin domains for a specific scope
432
+ #
433
+ # This endpoint syncs autojoin domains - it will add new domains, remove domains
434
+ # not in the provided list, and deactivate the autojoin invitation if all domains
435
+ # are removed (empty array).
436
+ #
437
+ # @param scope [String] The scope identifier (customer's group ID)
438
+ # @param scope_type [String] The type of scope (e.g., "organization", "team")
439
+ # @param domains [Array<String>] Array of domains to configure for autojoin
440
+ # @param widget_id [String] The widget configuration ID
441
+ # @param scope_name [String, nil] Optional display name for the scope
442
+ # @param metadata [Hash, nil] Optional metadata to attach to the invitation
443
+ # @return [Hash] Response with :autojoin_domains array and :invitation
444
+ # @raise [VortexError] If the request fails
445
+ #
446
+ # @example
447
+ # result = client.configure_autojoin(
448
+ # 'acme-org',
449
+ # 'organization',
450
+ # ['acme.com', 'acme.org'],
451
+ # 'widget-123',
452
+ # 'Acme Corporation'
453
+ # )
454
+ def configure_autojoin(scope, scope_type, domains, widget_id, scope_name = nil, metadata = nil)
455
+ raise VortexError, 'scope is required' if scope.nil? || scope.empty?
456
+ raise VortexError, 'scope_type is required' if scope_type.nil? || scope_type.empty?
457
+ raise VortexError, 'widget_id is required' if widget_id.nil? || widget_id.empty?
458
+ raise VortexError, 'domains must be an array' unless domains.is_a?(Array)
459
+
460
+ body = {
461
+ scope: scope,
462
+ scopeType: scope_type,
463
+ domains: domains,
464
+ widgetId: widget_id
465
+ }
466
+
467
+ body[:scopeName] = scope_name if scope_name
468
+ body[:metadata] = metadata if metadata
469
+
470
+ response = @connection.post('/api/v1/invitations/autojoin') do |req|
471
+ req.headers['Content-Type'] = 'application/json'
472
+ req.body = JSON.generate(body)
473
+ end
474
+
475
+ handle_response(response)
476
+ rescue VortexError
477
+ raise
478
+ rescue => e
479
+ raise VortexError, "Failed to configure autojoin: #{e.message}"
480
+ end
481
+
386
482
  private
387
483
 
388
484
  def build_connection
data/lib/vortex/types.rb CHANGED
@@ -113,5 +113,46 @@ module Vortex
113
113
  name: String, # Optional: Display name of the person being invited
114
114
  avatarUrl: String # Optional: Avatar URL for the person being invited
115
115
  }.freeze
116
+
117
+ # AutojoinDomain structure for autojoin domain configuration
118
+ # @example
119
+ # {
120
+ # id: '550e8400-e29b-41d4-a716-446655440000',
121
+ # domain: 'acme.com'
122
+ # }
123
+ AUTOJOIN_DOMAIN = {
124
+ id: String, # Vortex internal UUID
125
+ domain: String # The domain configured for autojoin
126
+ }.freeze
127
+
128
+ # AutojoinDomainsResponse from autojoin API endpoints
129
+ # @example
130
+ # {
131
+ # autojoinDomains: [AUTOJOIN_DOMAIN, ...],
132
+ # invitation: INVITATION # or nil
133
+ # }
134
+ AUTOJOIN_DOMAINS_RESPONSE = {
135
+ autojoinDomains: Array, # Array of AUTOJOIN_DOMAIN structures
136
+ invitation: Hash # INVITATION structure or nil
137
+ }.freeze
138
+
139
+ # ConfigureAutojoinRequest for configuring autojoin domains
140
+ # @example
141
+ # {
142
+ # scope: 'acme-org',
143
+ # scopeType: 'organization',
144
+ # scopeName: 'Acme Corporation', # Optional
145
+ # domains: ['acme.com', 'acme.org'],
146
+ # widgetId: 'widget-123',
147
+ # metadata: { ... } # Optional
148
+ # }
149
+ CONFIGURE_AUTOJOIN_REQUEST = {
150
+ scope: String, # Required: Customer's group ID
151
+ scopeType: String, # Required: Type of scope (e.g., "organization", "team")
152
+ scopeName: String, # Optional: Display name for the scope
153
+ domains: Array, # Required: Array of domain strings
154
+ widgetId: String, # Required: Widget configuration ID
155
+ metadata: Hash # Optional: Metadata to attach to the invitation
156
+ }.freeze
116
157
  end
117
158
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Vortex
4
- VERSION = '1.5.0'
4
+ VERSION = '1.8.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.5.0
4
+ version: 1.8.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-02-04 00:00:00.000000000 Z
11
+ date: 2026-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday