Class: User
Class Method Summary
collapse
Instance Method Summary
collapse
#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
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
|
.logout ⇒ Object
26
27
28
29
|
# File 'lib/user.rb', line 26
def logout
Flareshow::Service.logout
@current = nil
end
|
Instance Method Details
48
49
50
|
# File 'lib/user.rb', line 48
def
.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
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
|
#posts ⇒ Object
44
45
46
|
# File 'lib/user.rb', line 44
def posts
Post.find({"user_id" => ["in", id]})
end
|