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: WorkOS::OMIT, client_id: nil, client_secret: nil, config: 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: WorkOS::OMIT)

    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.

  • config (Hash{String => String}, nil) (defaults to: nil)

    Provider-specific config values to set for the organization, keyed by config field. Only fields the provider declares are accepted, and each value must match that field's pattern. Accepted only for providers whose credentials are organization-managed; for shared or custom credential providers, config belongs on the integration itself (via the data-integrations API) and supplying it here is rejected.

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

    (see WorkOS::Types::RequestOptions)

Returns:



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
67
68
69
# File 'lib/workos/pipes_provider.rb', line 42

def update_organization_data_integration_configuration(
  organization_id:,
  slug:,
  enabled: nil,
  scopes: WorkOS::OMIT,
  client_id: nil,
  client_secret: nil,
  config: nil,
  request_options: {}
)
  body = {
    "enabled" => enabled,
    "client_id" => client_id,
    "client_secret" => client_secret,
    "config" => config
  }.compact
  body["scopes"] = scopes unless scopes.equal?(WorkOS::OMIT)
  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