Module: Runners

Included in:
Runtime
Defined in:
lib/magister_cli/runtime.rb

Instance Method Summary collapse

Instance Method Details

#auth(token, school) ⇒ Object



15
16
17
# File 'lib/magister_cli/runtime.rb', line 15

def auth(token, school)
    $magcli_runtime_variables["magister"].authenticate(school, token)
end

#get_classes(date_from, date_to) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/magister_cli/runtime.rb', line 19

def get_classes(date_from, date_to)
    classes = $magcli_runtime_variables["magister"].get_classes(date_from, date_to)
    if classes == nil
        raise "Couldn't fetch classes!"
    end
    if @opts["outputMode"]
        classes.each do |c|
            puts "|#{zulu_to_ams c.classStart.to_s[11..-13]} - #{zulu_to_ams c.classEndInclusive.to_s[11..-13]}| #{c.description} [#{c.location}]"
        end
    else
        puts classes.to_json
    end
end

#login(username, password, school) ⇒ Object



11
12
13
# File 'lib/magister_cli/runtime.rb', line 11

def (username, password, school)
    $magcli_runtime_variables["magister"].(school, username, password)
end