dav-m85/pebble-api-php

0.0.1 2015-05-12 11:34 UTC

This package is not auto-updated.

Last update: 2024-12-11 09:36:32 UTC


README

Build Status Scrutinizer Code Quality Code Coverage Total Downloads

Library to interact with Pebble Timeline API.

Why should I use it ?

Because you love when ...

  • It's tested code
  • It can be installed with composer
  • It follows semver
  • It's already used in production

Installation

With composer installed

php composer.phar require dav-m85/pebble-api-php:dev-master

Usage

// Define a pin with an Array
$pin = new PebbleApi\Pin("reservation-1395203", new \DateTime("2014-03-07T09:01:10.229Z"), array(
    "layout" => array(
    	...
    )
));

// Or using object oriented approach (still work in progress)
$layout = new PebbleApi\Layout\GenericLayout();
$layout->setForegroundColor(PebbleApi\LayoutInterface::COLOR_BLUE);
$pin = new PebbleApi\Pin("reservation-1395203", new \DateTime("2014-03-07T09:01:10.229Z"), $layout);
$pin->setDuration(120);

// Then spawn a client
$client = new PebbleApi\Client();

// Create (or update) a pin
$user = new PebbleApi\User($userToken);
$client->put($user, $pin);

// Delete a pin
$client->delete($user, $pin);

// Create a pin for all users (shared pin)
$sharedTopic = new PebbleApi\SharedTopic($apiToken, array('baseball', 'giants'));

$client->put($sharedTopic, $pin);