Class: Poly::Auth

Inherits:
Object
  • Object
show all
Includes:
Poly
Defined in:
lib/polyhoraire/auth.rb

Constant Summary

Constants included from Poly

URL, XSLDocs

Instance Method Summary collapse

Methods included from Poly

#fetch, userConfDir, userConfDir=

Constructor Details

#initializeAuth

Returns a new instance of Auth.



7
8
9
10
# File 'lib/polyhoraire/auth.rb', line 7

def initialize
  @postParams = Hash.new
  @trimesters = Hash.new
end

Instance Method Details

#connect(user, password, bday) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/polyhoraire/auth.rb', line 12

def connect(user, password, bday)
  params = {
    "code" => user,
    "nip" => password,
    "naissance" => bday }
  response = fetch(Poly::URL[:connection],params)
  extractInformation(response)
  setStatus(response)
end

#connected?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/polyhoraire/auth.rb', line 22

def connected? 
  return @connected
end

#credentialsValid?(user, password, bday) ⇒ Boolean

Returns:

  • (Boolean)


27
28
29
30
# File 'lib/polyhoraire/auth.rb', line 27

def credentialsValid?(user,password,bday)
  connect(user,password,bday)
  return connected?
end

#errorObject



40
41
42
# File 'lib/polyhoraire/auth.rb', line 40

def error
  return @error
end

#postParamsObject

Getters



34
35
36
# File 'lib/polyhoraire/auth.rb', line 34

def postParams
  return @postParams
end

#trimestersObject



37
38
39
# File 'lib/polyhoraire/auth.rb', line 37

def trimesters
  return @trimesters
end