Class: Magister
Overview
The main magister class
Instance Method Summary collapse
-
#authenticate(school, token) ⇒ Object
Create a new profile and authenticate with a token.
-
#initialize ⇒ Magister
constructor
Returns a new instance of Magister.
-
#login(school, username, password) ⇒ Object
Create a new profile based on a username and password.
-
#profile ⇒ Profile
Get the users profile.
Methods included from MagisterData
Constructor Details
#initialize ⇒ Magister
Returns a new instance of Magister.
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/magister.rb', line 30 def initialize @profile = nil if $magister_useCache prev = "" $magister_cachingDirectory.split("/").each do |directory| Dir.mkdir(prev + directory) unless File.exist?(prev + directory) prev += directory + "/" end end end |
Instance Method Details
#authenticate(school, token) ⇒ Object
Create a new profile and authenticate with a token
46 47 48 49 |
# File 'lib/magister.rb', line 46 def authenticate(school, token) @profile = Profile.new(token, school) @profile.verify end |
#login(school, username, password) ⇒ Object
Create a new profile based on a username and password
56 57 58 59 |
# File 'lib/magister.rb', line 56 def login(school, username, password) @profile = Authenticator.login(username, password, school) @profile.verify end |
#profile ⇒ Profile
Get the users profile
64 65 66 |
# File 'lib/magister.rb', line 64 def profile @profile end |