Class: SSOReady::AsyncSCIMClient

Inherits:
Object
  • Object
show all
Defined in:
lib/ssoready/scim/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request_client:) ⇒ SSOReady::AsyncSCIMClient

Parameters:



190
191
192
# File 'lib/ssoready/scim/client.rb', line 190

def initialize(request_client:)
  @request_client = request_client
end

Instance Attribute Details

#request_clientSSOReady::AsyncRequestClient (readonly)



186
187
188
# File 'lib/ssoready/scim/client.rb', line 186

def request_client
  @request_client
end

Instance Method Details

#get_scim_group(id:, request_options: nil) ⇒ SSOReady::GetSCIMGroupResponse

Gets a SCIM group in a SCIM directory.

Examples:

api = SSOReady::Client.new(
  base_url: "https://api.example.com",
  environment: SSOReady::Environment::DEFAULT,
  api_key: "YOUR_AUTH_TOKEN"
)
api.scim.get_scim_group(id: "scim_group_...")

Parameters:

Returns:



256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
# File 'lib/ssoready/scim/client.rb', line 256

def get_scim_group(id:, request_options: nil)
  Async do
    response = @request_client.conn.get do |req|
      req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
      req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
      req.headers = {
    **(req.headers || {}),
    **@request_client.get_headers,
    **(request_options&.additional_headers || {})
      }.compact
      unless request_options.nil? || request_options&.additional_query_parameters.nil?
        req.params = { **(request_options&.additional_query_parameters || {}) }.compact
      end
      unless request_options.nil? || request_options&.additional_body_parameters.nil?
        req.body = { **(request_options&.additional_body_parameters || {}) }.compact
      end
      req.url "#{@request_client.get_url(request_options: request_options)}/v1/scim/groups/#{id}"
    end
    SSOReady::GetSCIMGroupResponse.from_json(json_object: response.body)
  end
end

#get_scim_user(id:, request_options: nil) ⇒ SSOReady::GetSCIMUserResponse

Gets a SCIM user.

Examples:

api = SSOReady::Client.new(
  base_url: "https://api.example.com",
  environment: SSOReady::Environment::DEFAULT,
  api_key: "YOUR_AUTH_TOKEN"
)
api.scim.get_scim_user(id: "scim_user_...")

Parameters:

Returns:



342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
# File 'lib/ssoready/scim/client.rb', line 342

def get_scim_user(id:, request_options: nil)
  Async do
    response = @request_client.conn.get do |req|
      req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
      req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
      req.headers = {
    **(req.headers || {}),
    **@request_client.get_headers,
    **(request_options&.additional_headers || {})
      }.compact
      unless request_options.nil? || request_options&.additional_query_parameters.nil?
        req.params = { **(request_options&.additional_query_parameters || {}) }.compact
      end
      unless request_options.nil? || request_options&.additional_body_parameters.nil?
        req.body = { **(request_options&.additional_body_parameters || {}) }.compact
      end
      req.url "#{@request_client.get_url(request_options: request_options)}/v1/scim/users/#{id}"
    end
    SSOReady::GetSCIMUserResponse.from_json(json_object: response.body)
  end
end

#list_scim_groups(scim_directory_id: nil, organization_id: nil, organization_external_id: nil, page_token: nil, request_options: nil) ⇒ SSOReady::ListSCIMGroupsResponse

Gets a list of SCIM groups in a SCIM directory.

Examples:

api = SSOReady::Client.new(
  base_url: "https://api.example.com",
  environment: SSOReady::Environment::DEFAULT,
  api_key: "YOUR_AUTH_TOKEN"
)
api.scim.list_scim_groups(organization_external_id: "my_custom_external_id")

Parameters:

  • scim_directory_id (String) (defaults to: nil)

    The SCIM directory to list from. One of ‘scimDirectoryId`, `organizationId`, or `organizationExternalId` must be specified.

  • organization_id (String) (defaults to: nil)

    The ID of the organization to list from. The primary SCIM directory of this organization is used. One of ‘scimDirectoryId`, `organizationId`, or `organizationExternalId` must be specified.

  • organization_external_id (String) (defaults to: nil)

    The ‘externalId` of the organization to list from. The primary SCIM directory of this organization is used. One of `scimDirectoryId`, `organizationId`, or `organizationExternalId` must be specified.

  • page_token (String) (defaults to: nil)

    Pagination token. Leave empty to get the first page of results.

  • request_options (SSOReady::RequestOptions) (defaults to: nil)

Returns:



217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
# File 'lib/ssoready/scim/client.rb', line 217

def list_scim_groups(scim_directory_id: nil, organization_id: nil, organization_external_id: nil, page_token: nil,
                     request_options: nil)
  Async do
    response = @request_client.conn.get do |req|
      req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
      req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
      req.headers = {
    **(req.headers || {}),
    **@request_client.get_headers,
    **(request_options&.additional_headers || {})
      }.compact
      req.params = {
        **(request_options&.additional_query_parameters || {}),
        "scimDirectoryId": scim_directory_id,
        "organizationId": organization_id,
        "organizationExternalId": organization_external_id,
        "pageToken": page_token
      }.compact
      unless request_options.nil? || request_options&.additional_body_parameters.nil?
        req.body = { **(request_options&.additional_body_parameters || {}) }.compact
      end
      req.url "#{@request_client.get_url(request_options: request_options)}/v1/scim/groups"
    end
    SSOReady::ListSCIMGroupsResponse.from_json(json_object: response.body)
  end
end

#list_scim_users(scim_directory_id: nil, organization_id: nil, organization_external_id: nil, scim_group_id: nil, page_token: nil, request_options: nil) ⇒ SSOReady::ListSCIMUsersResponse

Gets a list of SCIM users in a SCIM directory.

Examples:

api = SSOReady::Client.new(
  base_url: "https://api.example.com",
  environment: SSOReady::Environment::DEFAULT,
  api_key: "YOUR_AUTH_TOKEN"
)
api.scim.list_scim_users(organization_external_id: "my_custom_external_id")

Parameters:

  • scim_directory_id (String) (defaults to: nil)

    The SCIM directory to list from. One of ‘scimDirectoryId`, `organizationId`, or `organizationExternalId` must be specified.

  • organization_id (String) (defaults to: nil)

    The ID of the organization to list from. The primary SCIM directory of this organization is used. One of ‘scimDirectoryId`, `organizationId`, or `organizationExternalId` must be specified.

  • organization_external_id (String) (defaults to: nil)

    The ‘externalId` of the organization to list from. The primary SCIM directory of this organization is used. One of `scimDirectoryId`, `organizationId`, or `organizationExternalId` must be specified.

  • scim_group_id (String) (defaults to: nil)

    If specified, only users that are members of this SCIM group are returned.

  • page_token (String) (defaults to: nil)

    Pagination token. Leave empty to get the first page of results.

  • request_options (SSOReady::RequestOptions) (defaults to: nil)

Returns:



302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
# File 'lib/ssoready/scim/client.rb', line 302

def list_scim_users(scim_directory_id: nil, organization_id: nil, organization_external_id: nil,
                    scim_group_id: nil, page_token: nil, request_options: nil)
  Async do
    response = @request_client.conn.get do |req|
      req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
      req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
      req.headers = {
    **(req.headers || {}),
    **@request_client.get_headers,
    **(request_options&.additional_headers || {})
      }.compact
      req.params = {
        **(request_options&.additional_query_parameters || {}),
        "scimDirectoryId": scim_directory_id,
        "organizationId": organization_id,
        "organizationExternalId": organization_external_id,
        "scimGroupId": scim_group_id,
        "pageToken": page_token
      }.compact
      unless request_options.nil? || request_options&.additional_body_parameters.nil?
        req.body = { **(request_options&.additional_body_parameters || {}) }.compact
      end
      req.url "#{@request_client.get_url(request_options: request_options)}/v1/scim/users"
    end
    SSOReady::ListSCIMUsersResponse.from_json(json_object: response.body)
  end
end