Class: User
- Inherits:
-
Flareshow::Resource
- Object
- Flareshow::Resource
- User
- Defined in:
- lib/user.rb
Class Method Summary collapse
-
.current ⇒ Object
return the current authenticated user.
-
.log_in(login, password) ⇒ Object
authenticate user credentials.
-
.logout ⇒ Object
= Authentication = ==================.
Instance Method Summary collapse
- #comments ⇒ Object
- #files ⇒ Object
-
#flows ⇒ Object
= Associations = ================.
- #logged_in? ⇒ Boolean
- #posts ⇒ Object
Methods inherited from Flareshow::Resource
#cache, cache_response, #changes, create, default_params, #destroy, #destroyed?, find, first, #get, get_from_cache, #id, #initialize, list_cache, #method_missing, #method_name, #refresh, #resource_key, resource_key, #save, #set, store, #update
Constructor Details
This class inherits a constructor from Flareshow::Resource
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Flareshow::Resource
Class Method Details
.current ⇒ Object
return the current authenticated user
11 12 13 |
# File 'lib/user.rb', line 11 def current @current end |
.log_in(login, password) ⇒ Object
authenticate user credentials
16 17 18 19 20 21 |
# File 'lib/user.rb', line 16 def log_in(login, password) response = Flareshow::Service.authenticate(login, password) user_data = response["resources"]["data"] Flareshow::CacheManager.assimilate_resources({resource_key => [user_data]}) @current = User.get_from_cache(user_data["id"]) end |
Instance Method Details
#comments ⇒ Object
48 49 50 |
# File 'lib/user.rb', line 48 def comments Comment.find({"user_id" => ["in", id]}) end |
#files ⇒ Object
52 53 54 |
# File 'lib/user.rb', line 52 def files File.find({"user_id" => ["in", id]}) end |
#flows ⇒ Object
Associations =
40 41 42 |
# File 'lib/user.rb', line 40 def flows Flow.find({"user_id" => ["in", id]}) end |
#logged_in? ⇒ Boolean
56 57 58 |
# File 'lib/user.rb', line 56 def logged_in? @current end |