Class: ParseUser

Inherits:
ParseResource::Base show all
Defined in:
lib/parse_user.rb

Constant Summary

Constants inherited from ParseResource::Base

ParseResource::Base::HashWithIndifferentAccess

Class Method Summary collapse

Methods inherited from ParseResource::Base

all, #attributes, #attributes=, class_attributes, count, #create, create, #create_setters!, #created_at, #destroy, destroy_all, field, fields, find, first, #id, included, #initialize, #instance_resource, limit, load!, #new?, #persisted?, #resource, resource, #save, settings, #update, #update_attributes, #updated_at, where

Constructor Details

This class inherits a constructor from ParseResource::Base

Class Method Details

.login(username, password) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/parse_user.rb', line 4

def self.(username, password)
  base_uri   = "https://api.parse.com/1/login"
  app_id     = settings['app_id']
  master_key = settings['master_key']
  resource = RestClient::Resource.new(base_uri, app_id, master_key)
  
  resp = resource.get(:params => {:username => username, :password => password})
  user = model_name.constantize.new(JSON.parse(resp), false)

  user
end