lib/teachable_api/user.rb
# Authenticates the current user with the service, obtaining a user token.
Authenticates the current user with the service, obtaining a user token.
Authenticates the current user with the service obtaining a user token .
def authenticate!(password)
      raise_if_blank password, 'password'
      resp = API.connection.post 'users/sign_in', { 
        user: {
          email: @email, 
          password: password
        }
      }
      case resp.status
      when 201
        refresh_from_user_response resp
      when 401
        raise Teachable::AuthError, resp.body['error']
      else
        raise Teachable::Error, 'Unknown response.'
      end
    end
def authenticate! ( password ) raise_if_blank password , 'password' resp = API . connection . post 'users/sign_in' , { user : { email : @email , password : password } } case resp . status when 201 refresh_from_user_response resp when 401 raise Teachable :: AuthError , resp . body [ 'error' ] else raise Teachable :: Error , 'Unknown response.' end end
Authenticates the current user with the service, obtaining a user token.
Authenticates the current user with the service obtaining a user token .
password
<not_specific>