Class: Dropwallet::Core::User
- Defined in:
- lib/dropwallet/core/user.rb
Class Method Summary collapse
-
.login(username, password) ⇒ Object
Login Function, returns User object on success, nil on failure.
Methods inherited from Model
all, baseServiceUrl, create, debug?, field, find, #initialize, #read_attribute, #read_attribute_for_validation, serviceUrl, #to_json, #to_s, #write_attribute
Constructor Details
This class inherits a constructor from Dropwallet::Core::Model
Class Method Details
.login(username, password) ⇒ Object
Login Function, returns User object on success, nil on failure
10 11 12 13 14 15 16 |
# File 'lib/dropwallet/core/user.rb', line 10 def self.login(username, password) login = JSON.parse(RestClient.post baseServiceUrl + '/session/login', "username=#{username}&password=#{password}", {:accept => :json}) if login['status'] == 'SUCCESS' return Dropwallet::Core::User.find(login['userId']) end return nil end |