Module: Smooth::UserAdapter::ClassMethods

Defined in:
lib/smooth/user_adapter.rb

Instance Method Summary collapse

Instance Method Details

#anonymous(params = nil, headers = nil) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/smooth/user_adapter.rb', line 26

def anonymous(params = nil, headers = nil)
  User.new.tap do |user|
    user.last_request_params = params if params
    user.last_request_headers = headers if headers
    user.making_anonymous_request = true
  end
end

#find_for_smooth_api_request(id, passed_authentication_token) ⇒ Object



17
18
19
# File 'lib/smooth/user_adapter.rb', line 17

def find_for_smooth_api_request(id, passed_authentication_token)
  where(id: id, authentication_token: passed_authentication_token).first
end

#find_for_token_authentication(passed_authentication_token) ⇒ Object



21
22
23
24
# File 'lib/smooth/user_adapter.rb', line 21

def find_for_token_authentication(passed_authentication_token)
  id, token = passed_authentication_token.split(':')
  find_for_smooth_api_request(id, token)
end