Class: WorkOS::AdminPortal

Inherits:
Object
  • Object
show all
Defined in:
lib/workos/admin_portal.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ AdminPortal

Returns a new instance of AdminPortal.



9
10
11
# File 'lib/workos/admin_portal.rb', line 9

def initialize(client)
  @client = client
end

Instance Method Details

Generate a Portal Link

Parameters:

  • return_url (String, nil) (defaults to: nil)

    The URL to go to when an admin clicks on your logo in the Admin Portal. If not specified, the return URL configured on the [Redirects](dashboard.workos.com/redirects) page will be used.

  • success_url (String, nil) (defaults to: nil)

    The URL to redirect the admin to when they finish setup. If not specified, the success URL configured on the [Redirects](dashboard.workos.com/redirects) page will be used.

  • organization (String)

    An [Organization](workos.com/docs/reference/organization) identifier.

  • intent (WorkOS::Types::GenerateLinkIntent, nil) (defaults to: nil)

    The intent of the Admin Portal. - ‘sso` - Launch Admin Portal for creating SSO connections - `dsync` - Launch Admin Portal for creating Directory Sync connections - `audit_logs` - Launch Admin Portal for viewing Audit Logs - `log_streams` - Launch Admin Portal for creating Log Streams - `domain_verification` - Launch Admin Portal for Domain Verification - `certificate_renewal` - Launch Admin Portal for renewing SAML Certificates - `bring_your_own_key` - Launch Admin Portal for configuring Bring Your Own Key

  • intent_options (WorkOS::IntentOptions, nil) (defaults to: nil)

    Options to configure the Admin Portal based on the intent.

  • admin_emails (Array<String>, nil) (defaults to: nil)

    The email addresses of the IT admins to grant access to the Admin Portal for the given organization. Accepts up to 20 emails.

  • request_options (Hash) (defaults to: {})

    (see WorkOS::Types::RequestOptions)

Returns:



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/workos/admin_portal.rb', line 22

def generate_link(
  organization:,
  return_url: nil,
  success_url: nil,
  intent: nil,
  intent_options: nil,
  admin_emails: nil,
  request_options: {}
)
  body = {
    "return_url" => return_url,
    "success_url" => success_url,
    "organization" => organization,
    "intent" => intent,
    "intent_options" => intent_options,
    "admin_emails" => admin_emails
  }.compact
  response = @client.request(
    method: :post,
    path: "/portal/generate_link",
    auth: true,
    body: body,
    request_options: request_options
  )
  result = WorkOS::PortalLinkResponse.new(response.body)
  result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
  result
end