Sha256: f9e621c197b462abdcb460bd30092a46bb58cb48bc2118485713c2c0a397de42
Contents?: true
Size: 919 Bytes
Versions: 2
Compression:
Stored size: 919 Bytes
Contents
# -*- encoding : utf-8 -*- require 'leancloud/protocol' require 'leancloud/client' require 'leancloud/error' require 'leancloud/object' module AV class User < AV::Object def self.authenticate(username, password) body = { "username" => username, "password" => password } response = AV.client.request(AV::Protocol::USER_LOGIN_URI, :get, nil, body) AV.client.session_token = response[AV::Protocol::KEY_USER_SESSION_TOKEN] new(response) end def self.reset_password(email) body = {"email" => email} AV.client.post(AV::Protocol::PASSWORD_RESET_URI, body.to_json) end def initialize(data = nil) data["username"] = data[:username] if data[:username] data["password"] = data[:password] if data[:password] super(AV::Protocol::CLASS_USER, data) end def uri Protocol.user_uri @parse_object_id end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
leancloud-ruby-client-0.1.1 | lib/leancloud/user.rb |
leancloud-ruby-client-0.1.0 | lib/leancloud/user.rb |