2017 © Pedro Peláez
 

library doodle_client

A small, lightweight library to interact with Doodle (http://doodle.com)

image

causal/doodle_client

A small, lightweight library to interact with Doodle (http://doodle.com)

  • Thursday, November 30, 2017
  • by xperseguers
  • Repository
  • 5 Watchers
  • 15 Stars
  • 65 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 7 Forks
  • 4 Open issues
  • 9 Versions
  • 0 % Grown

The README.md

Doodle Client

This library provides a missing feature of Doodle (https://doodle.com): an API to programmatically access and create polls on the Doodle platform., (*1)

I was surprised to find only a basic API to initiate polls (not actually creating them, just pre-filling the form) but not anything else to fetch the list of polls or related participant answers so I contacted them and got this answer on September 25th, 2015:, (*2)

Unfortunately, Doodle won't be offering an API any longer., (*3)

-- Katharina, (*4)

As such I wrote this PHP client., (*5)

Basic Usage

$doodleUsername = 'me@example.com';
$doodlePassword = 'my-very-secret-password';

$client = new \Causal\DoodleClient\Client($doodleUsername, $doodlePassword);
$client->connect();

$myPolls = $client->getPersonalPolls();

echo '

My polls

'; echo '
'; // Optional, if you want to prevent actually authenticating over and over again // with future requests (thus reusing the local authentication cookies) $client->disconnect();

Create a Poll (Text Options)

$newPoll = $client->createPoll([
    'type' => 'text',
    'title' => 'Dinner',
    'location' => 'Restaurant Xtra',
    'description' => 'I suggest we meet and have a nice time together',
    'name' => 'John Doo',
    'email' => 'john.doo@example.com',
    'options' => [
        'Lasagna',
        'Pizza',
        'Meat',
    ],
]);
echo 'link to new poll: ' . $newPoll->getPublicUrl();

Create a Poll (Dates)

$newPoll = $client->createPoll([
    'type' => 'date',
    'title' => 'Dinner',
    'location' => 'Restaurant Xtra',
    'description' => 'I suggest we meet and have a nice time together',
    'name' => 'John Doo',
    'email' => 'john.doo@example.com',
    'dates' => [
        '20150929' => ['1930', '2000'],
        '20150930' => ['2000'],
        '20151030' => ['1945', '2000'],
    ],
]);
echo 'link to new poll: ' . $newPoll->getPublicUrl();

Invite participants

// Selection of a given poll could be based on any "$poll" from the
// foreach loop in "Basic Usage" example or of course "$newPoll".
$emailAdresses = [
    'someone@example.tld',
    'someone-else@gmail.com',
];
$message = 'Hey there! Please check this doodle!';
$client->inviteParticipants($poll, $emailAddresses, $message);

Delete a Poll

// Selection of a given poll could be based on any "$poll" from the
// foreach loop in "Basic Usage" example.

$client->deletePoll($poll);

Table of Answers

Another example of use, would be to fetch answers for a given poll., (*6)

// Selection of a given poll could be based on any "$poll" from the
// foreach loop in "Basic Usage" example.

echo '

'; echo ''; echo ''; echo ''; $options = $poll->getOptions(); foreach ($options as $option) { echo ''; } echo ''; echo ''; echo ''; $participants = $poll->getParticipants(); foreach ($participants as $participant) { echo ''; echo ''; foreach ($participant->getPreferences() as $preference) { switch ($preference) { case '0': $value = 'NO'; $color = '#ffccca'; break; case '1': $value = 'YES'; $color = '#d1f3d1'; break; case '2': $value = 'If needed'; $color = '#ffeda1'; break; default: $value = '?'; $color = '#eaeaea'; break; } echo ''; } echo ''; } echo ''; echo '
' . htmlspecialchars($option) . '
' . htmlspecialchars($participant->getName()) . '' . htmlspecialchars($value) . '
';

The Versions

30/11 2017

dev-master

9999999-dev https://github.com/xperseguers/doodle_client

A small, lightweight library to interact with Doodle (http://doodle.com)

  Sources   Download

GPL-3.0+

The Requires

  • php ^7.0

 

The Development Requires

doodle

30/11 2017

0.5.0

0.5.0.0 https://github.com/xperseguers/doodle_client

A small, lightweight library to interact with Doodle (http://doodle.com)

  Sources   Download

GPL-3.0+

The Requires

  • php ^7.0

 

The Development Requires

doodle

18/01 2017

0.4.0

0.4.0.0 https://github.com/xperseguers/doodle_client

A small, lightweight library to interact with Doodle (http://doodle.com)

  Sources   Download

GPL-3.0+

The Requires

  • php >=5.3,<8.0-DEV

 

The Development Requires

doodle

01/02 2016

0.3.0

0.3.0.0 https://github.com/xperseguers/doodle_client

A small, lightweight library to interact with Doodle (http://doodle.com)

  Sources   Download

GPL-3.0+

The Requires

  • php >=5.3,<8.0-DEV

 

The Development Requires

doodle

02/10 2015

0.2.1

0.2.1.0 https://github.com/xperseguers/doodle_client

A small, lightweight library to interact with Doodle (http://doodle.com)

  Sources   Download

GPL-3.0+

The Requires

  • php >=5.3,<8.0-DEV

 

The Development Requires

doodle

01/10 2015

0.2.0

0.2.0.0 https://github.com/xperseguers/doodle_client

A small, lightweight library to interact with Doodle (http://doodle.com)

  Sources   Download

GPL-3.0+

The Requires

  • php >=5.3,<8.0-DEV

 

The Development Requires

doodle

01/10 2015

0.1.2

0.1.2.0 https://github.com/xperseguers/doodle_client

A small, lightweight library to interact with Doodle (http://doodle.com)

  Sources   Download

GPL-3.0+

The Requires

  • php >=5.3,<8.0-DEV

 

The Development Requires

doodle

28/09 2015

0.1.1

0.1.1.0 https://github.com/xperseguers/doodle_client

A small, lightweight library to interact with Doodle (http://doodle.com)

  Sources   Download

GPL-3.0+

The Requires

  • php >=5.3,<8.0-DEV

 

The Development Requires

doodle

28/09 2015

0.1.0

0.1.0.0 https://github.com/xperseguers/doodle_client

A small, lightweight library to interact with Doodle (http://doodle.com)

  Sources   Download

GPL-3.0+

The Requires

  • php >=5.3,<8.0-DEV

 

The Development Requires

doodle