Skip to content
This repository has been archived by the owner on Oct 5, 2024. It is now read-only.
/ doodle-api Public archive

This is the API for dealing with Doodle Surveys.

License

Notifications You must be signed in to change notification settings

janmaterne/doodle-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Doodle API

Overview

This is an API for dealing with Doodle Surveys. Actually only reading them is provided.

A Doodle survey is provided to find the "best" date. Whereby it is not defined what "best" means ...

A survey consists of three main parts:

  • a description of the survey
  • a table where members could vote for their attendance
  • a comments section

The main class of this API is DoodleClient.

Description

The description itself contains mainly a free text for describing the intent of the survey. This is captured by Description.

Voting Table

The administrator creates the survey and during that the columns of the table. Members add themselves by providing their name and vote about the given dates. Depending on the kind of survey you could vote YES/NO or YES/NO/MAYBE.
If the admin adds additional columns after members have voted, you have missing votes for that date.

The table is represented as a list of a triple - Entry - containing the name, the date and the vote Choice.

Comments

Members could post comments with their name and a free text. The representation if a comment is Comment. If you are interested in written dates in a comment, you could use the CommentWithTimestamps decorator. For example you could write a report with all information to a give date.

Usage

First step is getting the client and opening the survey. If you try to get survey information before opening it you will get a DoodleException.

DoodleClient client = DoodleClient.create();
client.open("http://doodle.com/....");

After this you could get the information:

String title = client.getDescription().getTitle();
String description = client.getDescription().getDescription();

If you are interested in the votes you could use Java8 stream filters:

List<Entry> johnsEntries = entries
    .stream()
    .filter( e -> e.getName().equals("John Doe"))
    .collect(Collectors.toList());

All data for a given date:

LocalDateTime search = LocalDateTime.of(...);
List<Entry> attendees = client.getEntries()
    .stream()
    .filter( e -> search.equals(e.getTstamp()) )
    .filter( e -> e.getChoice() == Choice.YES )
    .collect(Collectors.toList());
List<CommentWithTimestamps> comments = CommentWithTimestamps.from(client.getComments())
    .stream()
    .filter( c -> c.getDates().contains(search) )
    .collect(Collectors.toList());

Hints

The only implementation of the DoodleClient is DoodleClientImpl which depends on Firefox and Selenium. Therefore you have to ensure the compatibility of these two.

The survey website is using lots of JavaScript for its representation. That's why it is more difficult to parse, so we use a standard browser.

Using Selenium and Firefox means depending on the Gecko marionette driver. You have to specify the system property webdriver.gecko.driver pointing to its executable. You could that by providing a doodle-api.properties file defining that value in the current directory or in the home directory.

About

This is the API for dealing with Doodle Surveys.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages