Module: Consulkit::Client::Session
- Included in:
- Consulkit::Client
- Defined in:
- lib/consulkit/client/session.rb
Overview
Methods for creating, deleting, and querying sessions.
Instance Method Summary collapse
-
#session_create(session_opts = {}) ⇒ Object
Creates a session.
-
#session_delete(session_id) ⇒ Boolean
Deletes a session.
-
#session_read(session_id) ⇒ Hash
Reads a session.
-
#session_renew(session_id) ⇒ Hash
Renews a session.
Instance Method Details
#session_create(session_opts = {}) ⇒ Object
Creates a session.
25 26 27 |
# File 'lib/consulkit/client/session.rb', line 25 def session_create(session_opts = {}) put('/v1/session/create', camel_case_keys(session_opts)).body['ID'] end |
#session_delete(session_id) ⇒ Boolean
Deletes a session.
34 35 36 |
# File 'lib/consulkit/client/session.rb', line 34 def session_delete(session_id) put("/v1/session/destroy/#{session_id}").body == true end |
#session_read(session_id) ⇒ Hash
Reads a session.
43 44 45 |
# File 'lib/consulkit/client/session.rb', line 43 def session_read(session_id) get("/v1/session/info/#{session_id}").body.first end |
#session_renew(session_id) ⇒ Hash
Renews a session.
52 53 54 |
# File 'lib/consulkit/client/session.rb', line 52 def session_renew(session_id) put("/v1/session/renew/#{session_id}").body.first end |