Class: WorkOS::OrganizationDomains

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

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ OrganizationDomains

Returns a new instance of OrganizationDomains.



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

def initialize(client)
  @client = client
end

Instance Method Details

#create_organization_domain(domain:, organization_id:, request_options: {}) ⇒ WorkOS::OrganizationDomain

Create an Organization Domain

Parameters:

  • domain (String)

    The domain to add to the organization.

  • organization_id (String)

    The ID of the organization to add the domain to.

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

    (see WorkOS::Types::RequestOptions)

Returns:



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/workos/organization_domains.rb', line 18

def create_organization_domain(
  domain:,
  organization_id:,
  request_options: {}
)
  body = {
    "domain" => domain,
    "organization_id" => organization_id
  }.compact
  response = @client.request(
    method: :post,
    path: "/organization_domains",
    auth: true,
    body: body,
    request_options: request_options
  )
  result = WorkOS::OrganizationDomain.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

#delete_organization_domain(id:, request_options: {}) ⇒ void

This method returns an undefined value.

Delete an Organization Domain

Parameters:

  • id (String)

    Unique identifier of the organization domain.

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

    (see WorkOS::Types::RequestOptions)



62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/workos/organization_domains.rb', line 62

def delete_organization_domain(
  id:,
  request_options: {}
)
  @client.request(
    method: :delete,
    path: "/organization_domains/#{WorkOS::Util.encode_path(id)}",
    auth: true,
    request_options: request_options
  )
  nil
end

#get_organization_domain(id:, request_options: {}) ⇒ WorkOS::OrganizationDomainStandAlone

Get an Organization Domain

Parameters:

  • id (String)

    Unique identifier of the organization domain.

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

    (see WorkOS::Types::RequestOptions)

Returns:



43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/workos/organization_domains.rb', line 43

def get_organization_domain(
  id:,
  request_options: {}
)
  response = @client.request(
    method: :get,
    path: "/organization_domains/#{WorkOS::Util.encode_path(id)}",
    auth: true,
    request_options: request_options
  )
  result = WorkOS::OrganizationDomainStandAlone.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

#verify_organization_domain(id:, request_options: {}) ⇒ WorkOS::OrganizationDomainStandAlone

Verify an Organization Domain

Parameters:

  • id (String)

    Unique identifier of the organization domain.

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

    (see WorkOS::Types::RequestOptions)

Returns:



79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/workos/organization_domains.rb', line 79

def verify_organization_domain(
  id:,
  request_options: {}
)
  response = @client.request(
    method: :post,
    path: "/organization_domains/#{WorkOS::Util.encode_path(id)}/verify",
    auth: true,
    request_options: request_options
  )
  result = WorkOS::OrganizationDomainStandAlone.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