scrapegoat
This library requests a calendar object and its events provided by a CalDav server.
Note: This project is under active development. Things may change.
Specify basic configuration:
config = auth: user: 'username' pass: 'password' uri: 'http://example.com/cal.php/calendars/user/calendar_name'
API
Scrapegoat.getCtag()
Fetches the ctag of a calendar. You can use the calendars ctag to see if anything in the calendar has changed.
var rec = config;rec;
You'll get an object, which looks like this:
href: '/calendars/test/holidays/' name: 'Holiday' ctag: '452'
Scrapegoat.getEtags()
Fetches the etags of a all events. You can use the events etags to see if an event has changed.
rec;
You'll get an array of objects, which looks like this:
ics: '/calendars/test/holidays/6151613161614616.ics' etag: 'fc46dd304e83f572688c68ab63816c8f' ics: '/calendars/test/holidays/6816189165131651.ics' etag: '8d59671ba294af1de0e0b154a8ea64c2'
Scrapegoat.getEvents(events)
Fetches events with its data/details. events
has to be an array with objects, which contain an ics attribute. The ics attribute has to look like the ones we get with getEtags()
.
var events = ics: '/calendars/user/calendar_name/12345.ics' ics: '/calendars/user/calendar_name/67890.ics' ; rec;
Output should be something like this:
ics: '/calendars/test/holidays/1234564316516.ics' etag: 'fc46dd304e83f572688c68ab63816c8f"' data: title: 'Holiday: John Doe' start: Wed Jul 08 2015 00:00:00 GMT+ end: Sat Aug 08 2015 00:00:00 GMT+ createdAt: Wed Mar 04 2015 18:09:02 GMT+
Scrapegoat.getAllEvents()
Fetches all events of the given calendar with data/details.
Scrapegoat.getEventsByTime(start, end)
Fetch all events which occur between start
and end
(have to be valid iCal Dates). If you leave start
and end
out, you'll get all events from today.
var start = ;var end = ; return rec;