Class: Dropwallet::Core::User

Inherits:
Model
  • Object
show all
Defined in:
lib/dropwallet/core/user.rb

Class Method Summary collapse

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.(username, password)
   = JSON.parse(RestClient.post baseServiceUrl + '/session/login', "username=#{username}&password=#{password}", {:accept => :json})
  if ['status'] == 'SUCCESS'
    return Dropwallet::Core::User.find(['userId'])
  end
  return nil
end