Class: User
Class Method Summary
collapse
Instance Method Summary
collapse
#cache, cache_response, #changes, create, #destroy, #destroyed?, find, #get, get_from_cache, #id, #initialize, list_cache, #method_missing, #method_name, #refresh, #resource_key, resource_key, #save, #set, store, #update
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
9
10
11
|
# File 'lib/user.rb', line 9
def current
@current
end
|
.log_in(login, password) ⇒ Object
authenticate user credentials
14
15
16
17
18
19
|
# File 'lib/user.rb', line 14
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
|
.logout ⇒ Object
24
25
26
27
|
# File 'lib/user.rb', line 24
def logout
Flareshow::Service.logout
@current = nil
end
|
Instance Method Details
46
47
48
|
# File 'lib/user.rb', line 46
def
.find({"user_id" => ["in", id]})
end
|
#files ⇒ Object
50
51
52
|
# File 'lib/user.rb', line 50
def files
File.find({"user_id" => ["in", id]})
end
|
#flows ⇒ Object
38
39
40
|
# File 'lib/user.rb', line 38
def flows
Flow.find({"user_id" => ["in", id]})
end
|
#logged_in? ⇒ Boolean
54
55
56
|
# File 'lib/user.rb', line 54
def logged_in?
@current
end
|
#posts ⇒ Object
42
43
44
|
# File 'lib/user.rb', line 42
def posts
Post.find({"user_id" => ["in", id]})
end
|