2017 © Pedro Peláez
 

library geckoboard-dataset-api

Library that provides client for Geckoboard DataSet API

image

kwk/geckoboard-dataset-api

Library that provides client for Geckoboard DataSet API

  • Tuesday, July 3, 2018
  • by gkawka
  • Repository
  • 2 Watchers
  • 2 Stars
  • 4,534 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 2 Open issues
  • 5 Versions
  • 13 % Grown

The README.md

Geckoboard DataSet API

Library provides client for Geckoboard DataSet API by REST requests, (*1)

SensioLabsInsight Scrutinizer Code Quality Code Coverage, (*2)

Branches - 0.1.x PHP 5.6 support and guzzle 5.* - 0.2.x PHP 7.1+ support and guzzle ^5.3.2, (*3)

How to use

DataSet definition + data row

Create DataSet definition:, (*4)


<?php namespace Preview; use Kwk\Geckoboard\Dataset\DatasetBuilder; use Kwk\Geckoboard\Dataset\DataSetInterface; use Kwk\Geckoboard\Dataset\Type\DateType; use Kwk\Geckoboard\Dataset\Type\NumberType; class TestDataset implements DataSetInterface { /** * {@inheritDoc} */ public function getName() { return 'test'; } /** * {@inheritDoc} */ public function getDefinition() { return (new DatasetBuilder()) ->addField('date_field_id', new DateType('Date')) ->addField('number_field_id', new NumberType('Number')) ->build(); } }

Create implementation of DataRowInterface:, (*5)

<?php

namespace Preview;

use Kwk\Geckoboard\Dataset\DataSetRowInterface;

class TestDatarow implements DataSetRowInterface
{
    /**
     * {@inheritDoc}
     */
    public function getData()
    {
        return [
            'date_field_id' => '2016-12-31',
            'number_field_id' => 1021,
        ];
    }
}

Client usage

Create client:, (*6)


$httpClient = new \Guzzle\Http\Client('https://api.geckoboard.com'); $client = new \Kwk\Geckoboard\Dataset\Client($httpClient, 'YOUR_API_KEY');

Create DataSet at Geckoboard:, (*7)

$client->create(new \Preview\TestDataset());

Append row:, (*8)

With class:, (*9)

<?php

namespace Preview\Dataset;

use Kwk\Geckoboard\Dataset\DataSetRowInterface;

class TestDatarow implements DataSetRowInterface
{
    /**
     * {@inheritDoc}
     */
    public function getData()
    {
        return [
            'param1' => 'val1',
            'param2' => 'val2',
        ];
    }
}

Appending is just one liner:, (*10)

$client->append(new \Preview\TestDataset(), [new \Preview\TestDatarow()]);

The Versions

03/07 2018

dev-master

9999999-dev

Library that provides client for Geckoboard DataSet API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Grzegorz Kawka

03/07 2018

0.1.6

0.1.6.0

Library that provides client for Geckoboard DataSet API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Grzegorz Kawka

13/06 2018

dev-php7

dev-php7

Library that provides client for Geckoboard DataSet API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Grzegorz Kawka

02/01 2017

dev-0.1.x-dev

dev-0.1.x-dev

Library that provides client for Geckoboard DataSet API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Grzegorz Kawka

02/01 2017

0.1.5

0.1.5.0

Library that provides client for Geckoboard DataSet API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Grzegorz Kawka