Module: Spore::Client::Users

Included in:
Spore::Client
Defined in:
lib/spore/client/users.rb

Instance Method Summary collapse

Instance Method Details

#login(email, password) ⇒ Object



11
12
13
14
15
16
# File 'lib/spore/client/users.rb', line 11

def (email, password)
  response = post "/users/#{email}/keys", { password: password }
  @email = email
  @key = response.body["key"]
  self
end

#signed_in?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/spore/client/users.rb', line 24

def signed_in?
  !email.nil? && !key.nil?
end

#signup(email, password) ⇒ Object



4
5
6
7
8
9
# File 'lib/spore/client/users.rb', line 4

def (email, password)
  response = post "/users", { email: email, password: password }
  @verified = response.body["user"]["verified"]
  (email, password)
  self
end

#verify(token) ⇒ Object



18
19
20
21
22
# File 'lib/spore/client/users.rb', line 18

def verify(token)
  response = patch "/users/#{@email}", { token: token }
  @verified = response.body["user"]["verified"]
  self
end