Module: Epitech::Api::CheckApi

Included in:
Connection
Defined in:
lib/api/check_api.rb

Instance Method Summary collapse

Instance Method Details

#check_authBoolean

Check for a good login/password combination (those given to Epitech::Api::Connection.new)

Returns:

  • (Boolean)

    True (Raise a Epitech::Api::Errors::AuthFail otherwise)



4
5
6
7
# File 'lib/api/check_api.rb', line 4

def check_auth
  call_api(action: 'login')
  true
end

#check_password(login, pwd) ⇒ Boolean

Test if the parameters are an existing login / PPP combination

Parameters:

  • login (String)

    Login to test

  • pwd (String)

    Password to test

Returns:

  • (Boolean)


21
22
23
24
25
# File 'lib/api/check_api.rb', line 21

def check_password(, pwd)
  json = call_api(action: 'check_password', login: , password: pwd)
  return false if json['state'] != 'OK'
  true
end

#is_login?(login) ⇒ Boolean

Test if the parameter is an existing ionis login

Parameters:

  • login (String)

    The login to test

Returns:

  • (Boolean)


11
12
13
14
15
# File 'lib/api/check_api.rb', line 11

def is_login?()
  json = call_api(action: 'is_login', login: )
  return false if json['state'] != 'OK'
  true
end