MoodleUser(username, password, moodleURL)

A new moodle user object which is used to fetch info for a specific person. Can be linked to different moodle websites.

new MoodleUser(username, password, moodleURL)

Create a new moodle user object
Parameters:
Name Type Description
username String The users moodle username
password String The users moodle password
moodleURL String The moodle websites address

Members

grades

Returns the cached user grades

info

Returns the user info

lastLogin

Returns the last login time

modules

Returns the cached user modules

status

Returns the current users login status

Methods

async fetchBlogPosts() → {Promise.<Array(Object)>}

Fetches the users blog posts and stores them in the cache
Returns:
Promise.<Array(Object)>

async fetchCalender() → {Promise.<Array(Object)>}

Fetches the users upcoming calender and stores it in the cache
Returns:
Promise.<Array(Object)>

async fetchGrades() → {Promise.<Array(Object)>}

Fetches the users module grades and stores it in the cache
Returns:
Promise.<Array(Object)>

async fetchModules() → {Promise.<Array(Object)>}

Fetches the users course modules and stores it in the cache
Returns:
Promise.<Array(Object)>

async fetchSessions() → {Promise.<Array(Object)>}

Fetches the users sessions and stores it in the cache
Returns:
Promise.<Array(Object)>

async fetchUserInfo() → {Promise.<Object>}

Fetches the users information and stores it in the cache
Returns:
Promise.<Object>

async login() → {Promise.<Boolean>}

Will attempt log the account in. Recalling this method will refresh the auth token.
Returns:
Promise.<Boolean> - - Weather or not the login was successful

async logout() → {Promise.<Boolean>}

Logs the current user out. Can be logged back in refreshing the auth token.
Returns:
Promise.<Boolean> - - The current logged in status of the account.