Class: WorkOS::PlatformTeams

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

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ PlatformTeams

Returns a new instance of PlatformTeams.



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

def initialize(client)
  @client = client
end

Instance Method Details

#create_team(admin_email:, name:, request_options: {}) ⇒ WorkOS::Team

Create a team

Parameters:

  • admin_email (String)

    The email address of the person who will administer the team. An invitation is sent to this address.

  • name (String)

    Name of the team.

  • 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/platform_teams.rb', line 18

def create_team(
  admin_email:,
  name:,
  request_options: {}
)
  body = {
    "admin_email" => admin_email,
    "name" => name
  }
  response = @client.request(
    method: :post,
    path: "/platform/teams",
    auth: true,
    body: body,
    request_options: request_options
  )
  result = WorkOS::Team.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

#get_team(team_id:, request_options: {}) ⇒ WorkOS::Team

Get a team

Parameters:

  • team_id (String)

    The ID of the team.

  • 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/platform_teams.rb', line 43

def get_team(
  team_id:,
  request_options: {}
)
  response = @client.request(
    method: :get,
    path: "/platform/teams/#{WorkOS::Util.encode_path(team_id)}",
    auth: true,
    request_options: request_options
  )
  result = WorkOS::Team.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