Class: MiniAuth::ApiGuard
Instance Attribute Summary collapse
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
Instance Method Summary collapse
- #attempt!(credentials, remember = nil) ⇒ Object
-
#initialize(name, model, request) ⇒ ApiGuard
constructor
A new instance of ApiGuard.
- #login!(user, remember = nil) ⇒ Object
- #logout! ⇒ Object
- #user ⇒ Object
Methods inherited from Guard
#auth_url, #guest?, #logged_in?
Constructor Details
#initialize(name, model, request) ⇒ ApiGuard
Returns a new instance of ApiGuard.
11 12 13 14 15 |
# File 'lib/mini_auth/api_guard.rb', line 11 def initialize(name, model, request) @name = name @model = model @request = request end |
Instance Attribute Details
#model ⇒ Object (readonly)
Returns the value of attribute model.
6 7 8 |
# File 'lib/mini_auth/api_guard.rb', line 6 def model @model end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/mini_auth/api_guard.rb', line 6 def name @name end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
6 7 8 |
# File 'lib/mini_auth/api_guard.rb', line 6 def request @request end |
Instance Method Details
#attempt!(credentials, remember = nil) ⇒ Object
17 18 19 |
# File 'lib/mini_auth/api_guard.rb', line 17 def attempt!(credentials, remember = nil) raise NotImplementedError, 'ApiGuard does not support auth attempt.' end |
#login!(user, remember = nil) ⇒ Object
21 22 23 |
# File 'lib/mini_auth/api_guard.rb', line 21 def login!(user, remember = nil) @user = user end |
#logout! ⇒ Object
25 26 27 |
# File 'lib/mini_auth/api_guard.rb', line 25 def logout! @user = nil end |
#user ⇒ Object
29 30 31 |
# File 'lib/mini_auth/api_guard.rb', line 29 def user @user ||= infer_current_user end |