Class: Parse::User
Instance Attribute Summary
Attributes inherited from Object
#acl, #created_at, #obj_id, #updated_at
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Object
create, #create, #delete, #deleted?, find, #get_column, #method_missing, #new?, #parse_class_name, #parse_client, #save, #set_column, #to_s, #update, #updated?
Constructor Details
#initialize(username, password, hash = {}) ⇒ User
Returns a new instance of User.
15
16
17
18
19
|
# File 'lib/parse/user.rb', line 15
def initialize username, password, hash={}
super hash
@username = username
@password = password
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Parse::Object
Class Method Details
.log_in(username, password) ⇒ Object
10
11
12
|
# File 'lib/parse/user.rb', line 10
def log_in username, password
self.new(username, password).log_in
end
|
.sign_up(username, password, hash = {}) ⇒ Object
6
7
8
|
# File 'lib/parse/user.rb', line 6
def sign_up username, password, hash={}
self.new(username, password, hash).sign_up
end
|
Instance Method Details
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/parse/user.rb', line 32
def log_in
parse_client.log_in @username, @password do |resp_body|
@obj_id = resp_body['objectId']
@created_at = resp_body['createdAt']
@updated_at = resp_body['updatedAt']
@raw_hash.update(@updated_hash).update resp_body
@updated_hash.clear
parse_client.session_token = resp_body['sessionToken']
self
end
end
|
44
45
|
# File 'lib/parse/user.rb', line 44
def log_out
end
|
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/parse/user.rb', line 21
def sign_up
parse_client.sign_up @username, @password, opts do |resp_body|
@obj_id = resp_body['objectId']
@created_at = resp_body['createdAt']
@raw_hash.update(@updated_hash).update resp_body
@updated_hash.clear
parse_client.session_token = resp_body['sessionToken']
self
end
end
|