Class: HighLevel::Storage::Base
- Inherits:
-
Object
- Object
- HighLevel::Storage::Base
- Defined in:
- lib/high_level/storage/base.rb
Overview
Abstract base for session storage backends. Subclasses must implement the seven session operations; the base only provides the shared expire-at calculation. Ported from vendor/highlevel-api-sdk/lib/storage/session-storage.ts.
Direct Known Subclasses
Constant Summary collapse
- DEFAULT_EXPIRY_MS =
Default session lifetime, in milliseconds, when an OAuth response carries no
expires_in. 24 * 60 * 60 * 1000
Instance Method Summary collapse
-
#delete_session(resource_id) ⇒ void
Remove a stored session.
-
#disconnect ⇒ void
Release any resources held by the backend.
-
#get_access_token(resource_id) ⇒ String?
Fetch just the access token from a stored session.
-
#get_session(resource_id) ⇒ Hash?
Fetch a stored session.
-
#init ⇒ void
Initialize the backend (open connections, ensure schema, …).
-
#set_client_id(client_id) ⇒ void
Set the OAuth client id; its first hyphen-separated segment becomes the application namespace for stored sessions.
-
#set_session(resource_id, session_data) ⇒ void
Store (or replace) a session, stamping
:expire_at.
Instance Method Details
#delete_session(resource_id) ⇒ void
This method returns an undefined value.
Remove a stored session.
65 66 67 |
# File 'lib/high_level/storage/base.rb', line 65 def delete_session(resource_id) raise NotImplementedError, "#{self.class}#delete_session must be implemented" end |
#disconnect ⇒ void
This method returns an undefined value.
Release any resources held by the backend.
28 29 30 |
# File 'lib/high_level/storage/base.rb', line 28 def disconnect raise NotImplementedError, "#{self.class}#disconnect must be implemented" end |
#get_access_token(resource_id) ⇒ String?
Fetch just the access token from a stored session.
58 59 60 |
# File 'lib/high_level/storage/base.rb', line 58 def get_access_token(resource_id) raise NotImplementedError, "#{self.class}#get_access_token must be implemented" end |
#get_session(resource_id) ⇒ Hash?
Fetch a stored session.
43 44 45 |
# File 'lib/high_level/storage/base.rb', line 43 def get_session(resource_id) raise NotImplementedError, "#{self.class}#get_session must be implemented" end |
#init ⇒ void
This method returns an undefined value.
Initialize the backend (open connections, ensure schema, …).
22 23 24 |
# File 'lib/high_level/storage/base.rb', line 22 def init raise NotImplementedError, "#{self.class}#init must be implemented" end |
#set_client_id(client_id) ⇒ void
This method returns an undefined value.
Set the OAuth client id; its first hyphen-separated segment becomes the application namespace for stored sessions.
36 37 38 |
# File 'lib/high_level/storage/base.rb', line 36 def set_client_id(client_id) raise NotImplementedError, "#{self.class}#set_client_id must be implemented" end |
#set_session(resource_id, session_data) ⇒ void
This method returns an undefined value.
Store (or replace) a session, stamping :expire_at.
51 52 53 |
# File 'lib/high_level/storage/base.rb', line 51 def set_session(resource_id, session_data) raise NotImplementedError, "#{self.class}#set_session must be implemented" end |