Class: Tumbz::User

Inherits:
Object
  • Object
show all
Includes:
Her::Model, Model
Defined in:
lib/tumbz/user.rb

Class Method Summary collapse

Methods included from Model

#error?

Class Method Details

.set_access_token!(access_token) ⇒ Object



14
15
16
# File 'lib/tumbz/user.rb', line 14

def self.set_access_token!(access_token)
  Thread.current[:tumbz_access_token] = access_token
end

.sign_in!(email, password) ⇒ Object



8
9
10
11
12
# File 'lib/tumbz/user.rb', line 8

def self.sign_in!(email, password)
  post_raw("auth", :email => email, :password => password) do |parsed_data|
    Thread.current[:tumbz_access_token] = parsed_data[:data][:access_token]
  end
end

.sign_out!Object



18
19
20
21
# File 'lib/tumbz/user.rb', line 18

def self.sign_out!
  Thread.current[:tumbz_access_token] = nil
  Thread.current[:tumbz_access_token].nil?
end