-
Notifications
You must be signed in to change notification settings - Fork 16
/
index.js
34 lines (30 loc) · 983 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
const reportcard = require('./src/reportcard');
const gradebook = require('./src/gradebook');
const authenticate = require('./src/authenticate');
const history = require('./src/history');
module.exports = skywardURL => ({
scrapeReport: (user, pass) => (
authenticate(skywardURL)(user, pass)
.then(auth => reportcard.fetch(skywardURL)(auth))
.then(response => ({
raw: response.data,
data: reportcard.getData(response),
}))
),
scrapeGradebook: (user, pass, { course, bucket }) => (
authenticate(skywardURL)(user, pass)
.then(auth => gradebook.fetch(skywardURL)(auth)(course, bucket))
.then(response => ({
raw: response.data,
data: gradebook.getData(response),
}))
),
scrapeHistory: (user, pass) => (
authenticate(skywardURL)(user, pass)
.then(history.fetch(skywardURL))
.then(response => ({
raw: response.data,
data: history.getData(response),
}))
),
});