Class: User

Inherits:
Flareshow::Base show all
Defined in:
lib/user.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Flareshow::Base

all, api_endpoint, assimilate_resources, auth_endpoint, authenticate, #changes, commit, create, #destroy, #destroyed?, dispatch, find, first, get, #get, handle_response, http_get, #id, #initialize, list, #method_missing, #method_name, post, process_response, query, #refresh, #save, server_defined?, #set, store, #update

Constructor Details

This class inherits a constructor from Flareshow::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Flareshow::Base

Class Method Details

.currentObject

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
20
21
# File 'lib/user.rb', line 14

def (, password)
  authenticate({:login => , :password => password}, 
    {
      :on_success  => method(:on_authentication_success),
      :on_failure  => method(:on_authentication_failure)
    }
  )
end

Instance Method Details

#commentsObject



55
56
57
# File 'lib/user.rb', line 55

def comments
  Comment.find({"user_id" => {"in" => id}})
end

#filesObject



59
60
61
# File 'lib/user.rb', line 59

def files
  FileAttachment.find({"user_id" => {"in" => id}})
end

#flowsObject

Associations =



47
48
49
# File 'lib/user.rb', line 47

def flows
  Flow.find({"user_id" => {"in" => id}})
end

#logged_in?Boolean

Returns:

  • (Boolean)


70
71
72
# File 'lib/user.rb', line 70

def logged_in?
  auth_token
end

#logoutObject

Authentication =



66
67
68
# File 'lib/user.rb', line 66

def logout
  
end

#postsObject



51
52
53
# File 'lib/user.rb', line 51

def posts
  Post.find({"user_id" => {"in" => id}})
end