Class: Seam::Clients::ClientSessions

Inherits:
Object
  • Object
show all
Defined in:
lib/seam/routes/client_sessions.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:, defaults:) ⇒ ClientSessions

Returns a new instance of ClientSessions.



6
7
8
9
# File 'lib/seam/routes/client_sessions.rb', line 6

def initialize(client:, defaults:)
  @client = client
  @defaults = defaults
end

Instance Method Details

#create(connect_webview_ids: nil, connected_account_ids: nil, customer_id: nil, customer_key: nil, expires_at: nil, user_identifier_key: nil, user_identity_id: nil, user_identity_ids: nil) ⇒ Seam::Resources::ClientSession

Deprecated.

user_identity_ids: Use user_identity_id instead.

Creates a new client session.

Parameters:

  • connect_webview_ids (defaults to: nil)

    IDs of the Connect Webviews for which you want to create a client session.

  • connected_account_ids (defaults to: nil)

    IDs of the connected accounts for which you want to create a client session.

  • customer_id (defaults to: nil)

    Customer ID that you want to associate with the new client session.

  • customer_key (defaults to: nil)

    Customer key that you want to associate with the new client session.

  • expires_at (defaults to: nil)

    Date and time at which the client session should expire, in ISO 8601 format.

  • user_identifier_key (defaults to: nil)

    Your user ID for the user for whom you want to create a client session.

  • user_identity_id (defaults to: nil)

    ID of the user identity for which you want to create a client session.

  • user_identity_ids (defaults to: nil)

    IDs of the user identities that you want to associate with the client session.

Returns:



22
23
24
25
26
# File 'lib/seam/routes/client_sessions.rb', line 22

def create(connect_webview_ids: nil, connected_account_ids: nil, customer_id: nil, customer_key: nil, expires_at: nil, user_identifier_key: nil, user_identity_id: nil, user_identity_ids: nil)
  res = @client.post("/client_sessions/create", {connect_webview_ids: connect_webview_ids, connected_account_ids: , customer_id: customer_id, customer_key: customer_key, expires_at: expires_at, user_identifier_key: user_identifier_key, user_identity_id: user_identity_id, user_identity_ids: user_identity_ids}.compact)

  Seam::Resources::ClientSession.load_from_response(res.body["client_session"])
end

#delete(client_session_id:) ⇒ nil

Deletes a client session.

Parameters:

  • client_session_id

    ID of the client session that you want to delete.

Returns:

  • (nil)

    OK



31
32
33
34
35
# File 'lib/seam/routes/client_sessions.rb', line 31

def delete(client_session_id:)
  @client.post("/client_sessions/delete", {client_session_id: client_session_id}.compact)

  nil
end

#get(client_session_id: nil, user_identifier_key: nil) ⇒ Seam::Resources::ClientSession

Returns a specified client session.

Parameters:

  • client_session_id (defaults to: nil)

    ID of the client session that you want to get.

  • user_identifier_key (defaults to: nil)

    User identifier key associated with the client session that you want to get.

Returns:



41
42
43
44
45
# File 'lib/seam/routes/client_sessions.rb', line 41

def get(client_session_id: nil, user_identifier_key: nil)
  res = @client.post("/client_sessions/get", {client_session_id: client_session_id, user_identifier_key: user_identifier_key}.compact)

  Seam::Resources::ClientSession.load_from_response(res.body["client_session"])
end

#get_or_create(connect_webview_ids: nil, connected_account_ids: nil, expires_at: nil, user_identifier_key: nil, user_identity_id: nil, user_identity_ids: nil) ⇒ Seam::Resources::ClientSession

Deprecated.

user_identity_ids: Use user_identity_id.

Returns a client session with specific characteristics or creates a new client session with these characteristics if it does not yet exist.

Parameters:

  • connect_webview_ids (defaults to: nil)

    IDs of the Connect Webviews that you want to associate with the client session (or that are already associated with the existing client session).

  • connected_account_ids (defaults to: nil)

    IDs of the connected accounts that you want to associate with the client session (or that are already associated with the existing client session).

  • expires_at (defaults to: nil)

    Date and time at which the client session should expire in ISO 8601 format. If the client session already exists, this will update the expiration before returning it.

  • user_identifier_key (defaults to: nil)

    Your user ID for the user that you want to associate with the client session (or that is already associated with the existing client session).

  • user_identity_id (defaults to: nil)

    ID of the user identity that you want to associate with the client session (or that are already associated with the existing client session).

  • user_identity_ids (defaults to: nil)

    IDs of the user identities that you want to associate with the client session.

Returns:



56
57
58
59
60
# File 'lib/seam/routes/client_sessions.rb', line 56

def get_or_create(connect_webview_ids: nil, connected_account_ids: nil, expires_at: nil, user_identifier_key: nil, user_identity_id: nil, user_identity_ids: nil)
  res = @client.post("/client_sessions/get_or_create", {connect_webview_ids: connect_webview_ids, connected_account_ids: , expires_at: expires_at, user_identifier_key: user_identifier_key, user_identity_id: user_identity_id, user_identity_ids: user_identity_ids}.compact)

  Seam::Resources::ClientSession.load_from_response(res.body["client_session"])
end

#grant_access(client_session_id: nil, connect_webview_ids: nil, connected_account_ids: nil, user_identifier_key: nil, user_identity_id: nil, user_identity_ids: nil) ⇒ nil

Deprecated.

user_identity_ids: Use user_identity_id.

Grants a client session access to one or more resources, such as Connect Webviews, user identities, and so on.

Parameters:

  • client_session_id (defaults to: nil)

    ID of the client session to which you want to grant access to resources.

  • connect_webview_ids (defaults to: nil)

    IDs of the Connect Webviews that you want to associate with the client session.

  • connected_account_ids (defaults to: nil)

    IDs of the connected accounts that you want to associate with the client session.

  • user_identifier_key (defaults to: nil)

    Your user ID for the user that you want to associate with the client session.

  • user_identity_id (defaults to: nil)

    ID of the user identity that you want to associate with the client session.

  • user_identity_ids (defaults to: nil)

    IDs of the user identities that you want to associate with the client session.

Returns:

  • (nil)

    OK



71
72
73
74
75
# File 'lib/seam/routes/client_sessions.rb', line 71

def grant_access(client_session_id: nil, connect_webview_ids: nil, connected_account_ids: nil, user_identifier_key: nil, user_identity_id: nil, user_identity_ids: nil)
  @client.post("/client_sessions/grant_access", {client_session_id: client_session_id, connect_webview_ids: connect_webview_ids, connected_account_ids: , user_identifier_key: user_identifier_key, user_identity_id: user_identity_id, user_identity_ids: user_identity_ids}.compact)

  nil
end

#list(client_session_id: nil, connect_webview_id: nil, user_identifier_key: nil, user_identity_id: nil, without_user_identifier_key: nil) ⇒ Seam::Resources::ClientSession

Returns a list of all client sessions.

Parameters:

  • client_session_id (defaults to: nil)

    ID of the client session that you want to retrieve.

  • connect_webview_id (defaults to: nil)

    ID of the Connect Webview for which you want to retrieve client sessions.

  • user_identifier_key (defaults to: nil)

    Your user ID for the user by which you want to filter client sessions.

  • user_identity_id (defaults to: nil)

    ID of the user identity for which you want to retrieve client sessions.

  • without_user_identifier_key (defaults to: nil)

    Indicates whether to retrieve only client sessions without associated user identifier keys.

Returns:



84
85
86
87
88
# File 'lib/seam/routes/client_sessions.rb', line 84

def list(client_session_id: nil, connect_webview_id: nil, user_identifier_key: nil, user_identity_id: nil, without_user_identifier_key: nil)
  res = @client.post("/client_sessions/list", {client_session_id: client_session_id, connect_webview_id: connect_webview_id, user_identifier_key: user_identifier_key, user_identity_id: user_identity_id, without_user_identifier_key: without_user_identifier_key}.compact)

  Seam::Resources::ClientSession.load_from_response(res.body["client_sessions"])
end

#revoke(client_session_id:) ⇒ nil

Revokes a client session.

Note that deleting a client session is a separate action.

Parameters:

  • client_session_id

    ID of the client session that you want to revoke.

Returns:

  • (nil)

    OK



95
96
97
98
99
# File 'lib/seam/routes/client_sessions.rb', line 95

def revoke(client_session_id:)
  @client.post("/client_sessions/revoke", {client_session_id: client_session_id}.compact)

  nil
end