Sha256: 573cb899c19d07f8cc2d582510431a1c3fd79edb56d3a5ccf267689cb1c6ff42

Contents?: true

Size: 836 Bytes

Versions: 4

Compression:

Stored size: 836 Bytes

Contents

require 'parse/protocol'
require 'parse/client'
require 'parse/error'
require 'parse/object'

module Parse
  class User < Parse::Object
    
    def self.authenticate(username, password)
      body = {
        "username" => username,
        "password" => password
      }

      response = Parse.client.request(Parse::Protocol::USER_LOGIN_URI, :get, nil, body)
      
      new(response)
    end

    def self.reset_password(email)
      body = {"email" => email}
      Parse.client.post(Parse::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(Parse::Protocol::CLASS_USER, data)
    end
    
    def uri
      Protocol.user_uri @parse_object_id
    end
    
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
parse-ruby-client-0.1.9 lib/parse/user.rb
parse-ruby-client-0.1.8 lib/parse/user.rb
parse-ruby-client-0.1.7 lib/parse/user.rb
parse-ruby-client-0.1.6 lib/parse/user.rb