Class: CampactUserService::Session
- Inherits:
-
Object
- Object
- CampactUserService::Session
- Defined in:
- lib/campact_user_service/session.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#session_cookie_name ⇒ Object
readonly
Returns the value of attribute session_cookie_name.
-
#session_id ⇒ Object
readonly
Returns the value of attribute session_id.
Instance Method Summary collapse
- #destroy ⇒ Object
- #external_account_id ⇒ Object
- #has_hard_login_session? ⇒ Boolean
- #has_soft_login_session? ⇒ Boolean
-
#initialize(client, session_id, session_cookie_name) ⇒ Session
constructor
A new instance of Session.
Constructor Details
#initialize(client, session_id, session_cookie_name) ⇒ Session
Returns a new instance of Session.
5 6 7 8 9 |
# File 'lib/campact_user_service/session.rb', line 5 def initialize(client, session_id, ) @client = client @session_id = session_id @session_cookie_name = end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
3 4 5 |
# File 'lib/campact_user_service/session.rb', line 3 def client @client end |
#session_cookie_name ⇒ Object (readonly)
Returns the value of attribute session_cookie_name.
3 4 5 |
# File 'lib/campact_user_service/session.rb', line 3 def @session_cookie_name end |
#session_id ⇒ Object (readonly)
Returns the value of attribute session_id.
3 4 5 |
# File 'lib/campact_user_service/session.rb', line 3 def session_id @session_id end |
Instance Method Details
#destroy ⇒ Object
23 24 25 |
# File 'lib/campact_user_service/session.rb', line 23 def destroy client.delete_request('/v1/sessions', cookies: { => session_id}) end |
#external_account_id ⇒ Object
11 12 13 |
# File 'lib/campact_user_service/session.rb', line 11 def external_account_id session["external_account_id"] end |
#has_hard_login_session? ⇒ Boolean
19 20 21 |
# File 'lib/campact_user_service/session.rb', line 19 def has_hard_login_session? session["permission_level"] == 'full' end |
#has_soft_login_session? ⇒ Boolean
15 16 17 |
# File 'lib/campact_user_service/session.rb', line 15 def has_soft_login_session? session["permission_level"] == 'limited' end |