Class: SafetyKit::Resources::ClientSessions
- Inherits:
-
Object
- Object
- SafetyKit::Resources::ClientSessions
- Defined in:
- lib/safety_kit/resources/client_sessions.rb
Overview
Create browser-safe webapp SDK session tokens from authenticated server-side code.
Instance Method Summary collapse
-
#create_session(customer_session_hash: nil, customer_user_id: nil, request_options: {}) ⇒ SafetyKit::Models::ClientSessionCreateSessionResponse
Create a browser-safe SafetyKit webapp SDK session token from server-side code before rendering pages that load the browser SDK.
-
#initialize(client:) ⇒ ClientSessions
constructor
private
A new instance of ClientSessions.
Constructor Details
#initialize(client:) ⇒ ClientSessions
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of ClientSessions.
37 38 39 |
# File 'lib/safety_kit/resources/client_sessions.rb', line 37 def initialize(client:) @client = client end |
Instance Method Details
#create_session(customer_session_hash: nil, customer_user_id: nil, request_options: {}) ⇒ SafetyKit::Models::ClientSessionCreateSessionResponse
Create a browser-safe SafetyKit webapp SDK session token from server-side code before rendering pages that load the browser SDK. The request must be authenticated with a valid Bearer token.
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/safety_kit/resources/client_sessions.rb', line 23 def create_session(params = {}) parsed, = SafetyKit::ClientSessionCreateSessionParams.dump_request(params) @client.request( method: :post, path: "v1/sessions", body: parsed, model: SafetyKit::Models::ClientSessionCreateSessionResponse, options: ) end |