Class: WorkOS::PipesProvider

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

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ PipesProvider

Returns a new instance of PipesProvider.



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

def initialize(client)
  @client = client
end

Instance Method Details

#list_organization_data_integration_configurations(organization_id:, request_options: {}) ⇒ WorkOS::DataIntegrationConfigurationListResponse

List providers for an organization

Parameters:

  • organization_id (String)

    An Organization identifier to list provider configurations for.

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

    (see WorkOS::Types::RequestOptions)

Returns:



17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/workos/pipes_provider.rb', line 17

def list_organization_data_integration_configurations(
  organization_id:,
  request_options: {}
)
  response = @client.request(
    method: :get,
    path: "/organizations/#{WorkOS::Util.encode_path(organization_id)}/data_integration_configurations",
    auth: true,
    request_options: request_options
  )
  result = WorkOS::DataIntegrationConfigurationListResponse.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

#update_organization_data_integration_configuration(organization_id:, slug:, enabled: nil, scopes: nil, client_id: nil, client_secret: nil, request_options: {}) ⇒ WorkOS::DataIntegrationConfigurationResponse

Configure a provider for an organization

Parameters:

  • organization_id (String)

    An Organization identifier to configure the provider for.

  • slug (String)

    The slug identifier of the provider to configure (e.g., github, slack, notion).

  • enabled (Boolean, nil) (defaults to: nil)

    Whether the provider is enabled for the organization.

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

    The OAuth scopes to request for the organization. Pass null to inherit the provider scopes.

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

    The OAuth client ID of the organization's own application. Must be provided together with client_secret, and only for providers whose credentials are supplied by the organization.

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

    The OAuth client secret of the organization's own application. Must be provided together with client_id.

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

    (see WorkOS::Types::RequestOptions)

Returns:



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/workos/pipes_provider.rb', line 41

def update_organization_data_integration_configuration(
  organization_id:,
  slug:,
  enabled: nil,
  scopes: nil,
  client_id: nil,
  client_secret: nil,
  request_options: {}
)
  body = {
    "enabled" => enabled,
    "scopes" => scopes,
    "client_id" => client_id,
    "client_secret" => client_secret
  }.compact
  response = @client.request(
    method: :put,
    path: "/organizations/#{WorkOS::Util.encode_path(organization_id)}/data_integration_configurations/#{WorkOS::Util.encode_path(slug)}",
    auth: true,
    body: body,
    request_options: request_options
  )
  result = WorkOS::DataIntegrationConfigurationResponse.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