Skip to content

Commit

Permalink
Bump version, regenerate documentation, cosmetic fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sraka1 committed Nov 27, 2014
1 parent ce3555d commit deb3f56
Show file tree
Hide file tree
Showing 77 changed files with 10,662 additions and 2,077 deletions.
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
The MIT License
===============

Copyright (c) 2013 OnlineCity ApS
Copyright (c) 2014 Jakob Murko

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
42 changes: 16 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,20 @@ The PHP SDK for interacting with the Databox Push API.
## Autoloading

`databox-php-sdk` uses [Composer](http://getcomposer.org).
The first step to use `databox-php-sdk` is to download composer:
The first step to use `databox-php-sdk` is to download composer, if we don't have it already:

```bash
$ curl -s http://getcomposer.org/installer | php
```

Then we have to install our dependencies using:
Then we can add `databox-php-sdk` as a dependency:
```bash
$ php composer.phar install
```
Now we can use autoloader from Composer by:

```yaml
{
"require": {
"databox/databox-php-sdk": "*"
},
"minimum-stability": "dev"
}
$ composer.phar require databox/databox-php-sdk:1.*
```

> `databox-php-sdk` follows the PSR-0 convention names for its classes, which means you can easily integrate `databox-php-sdk` classes loading in your own autoloader.
> `databox-php-sdk` follows the PSR-0 convention for file structuring and class naming, which means you can easily integrate `databox-php-sdk` classloading in your own autoloader.
## Basic usage of the `databox-php-sdk client
## Basic usage

```php
<?php
Expand Down Expand Up @@ -104,17 +94,17 @@ $pie->addSlice("Salami", 50, -10);
$pie->addSlice("Tuna", 70, -30);
$builder->addWidget($pie);

$pie = new Widget\Funnel("testfunnel");
$pie->addSlice("Cheese", 5);
$pie->addSlice("Meat", 90, -10);
$pie->addSlice("Apples", 10, -30);
$builder->addWidget($pie);

$pie = new Widget\Pipeline("testpipeline");
$pie->addSlice("Mac", 20, 24);
$pie->addSlice("PC", 30, -10);
$pie->addSlice("Amiga", 10, -10);
$builder->addWidget($pie);
$funnel = new Widget\Funnel("testfunnel");
$funnel->addSlice("Cheese", 5);
$funnel->addSlice("Meat", 90, -10);
$funnel->addSlice("Apples", 10, -30);
$builder->addWidget($funnel);

$pipeline = new Widget\Pipeline("testpipeline");
$pipeline->addSlice("Mac", 20, 24);
$pipeline->addSlice("PC", 30, -10);
$pipeline->addSlice("Amiga", 10, -10);
$builder->addWidget($pipeline);

//You must provide uniqueURL and payload parameters. Payload can be any JSON string, but we reccommend you use our builder class.
try {
Expand Down
5 changes: 5 additions & 0 deletions doc/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Fixes a vulnerability in CentOS: http://stackoverflow.com/questions/20533279/prevent-php-from-parsing-non-php-files-such-as-somefile-php-txt
<FilesMatch \.php\.txt$>
RemoveHandler .php
ForceType text/plain
</FilesMatch>
73 changes: 34 additions & 39 deletions doc/classes/Databox.Client.DataboxClientInterface.html

Large diffs are not rendered by default.

271 changes: 149 additions & 122 deletions doc/classes/Databox.DataboxBuilder.html

Large diffs are not rendered by default.

293 changes: 177 additions & 116 deletions doc/classes/Databox.DataboxClient.html

Large diffs are not rendered by default.

149 changes: 56 additions & 93 deletions doc/classes/Databox.DataboxException.html

Large diffs are not rendered by default.

137 changes: 54 additions & 83 deletions doc/classes/Databox.Event.AuthListener.html

Large diffs are not rendered by default.

92 changes: 42 additions & 50 deletions doc/classes/Databox.Event.ExceptionListener.html

Large diffs are not rendered by default.

278 changes: 155 additions & 123 deletions doc/classes/Databox.KPI.html

Large diffs are not rendered by default.

108 changes: 43 additions & 65 deletions doc/classes/Databox.Widget.Base.html

Large diffs are not rendered by default.

151 changes: 53 additions & 98 deletions doc/classes/Databox.Widget.Funnel.html

Large diffs are not rendered by default.

277 changes: 133 additions & 144 deletions doc/classes/Databox.Widget.Messages.html

Large diffs are not rendered by default.

258 changes: 105 additions & 153 deletions doc/classes/Databox.Widget.Pie.html

Large diffs are not rendered by default.

151 changes: 53 additions & 98 deletions doc/classes/Databox.Widget.Pipeline.html

Large diffs are not rendered by default.

306 changes: 124 additions & 182 deletions doc/classes/Databox.Widget.Progress.html

Large diffs are not rendered by default.

225 changes: 124 additions & 101 deletions doc/classes/Databox.Widget.Table.ColumnData.html

Large diffs are not rendered by default.

377 changes: 161 additions & 216 deletions doc/classes/Databox.Widget.Table.html

Large diffs are not rendered by default.

732 changes: 732 additions & 0 deletions doc/css/bootstrap-combined.no-icons.min.css

Large diffs are not rendered by default.

403 changes: 403 additions & 0 deletions doc/css/font-awesome.min.css

Large diffs are not rendered by default.

13 changes: 12 additions & 1 deletion doc/css/template.css
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,12 @@ body .modal {
margin-right:auto;
}

.side-nav.nav-list li a {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}

@media (min-width: 767px) {
.sidebar {
position: fixed;
Expand Down Expand Up @@ -390,15 +396,20 @@ body .modal {
background-color: white;
}

.footer-sections h1 {
.footer-sections .span4 h1 {
color: #ccccd9;
margin-top: 0;
}

.detailsbar {
background-color: white;
color: #333;
border: none;
}

.row-fluid .span2 {
width: 100%;
}
}

@media (min-width: 767px) {
Expand Down
23 changes: 23 additions & 0 deletions doc/files/Client%2FDataboxClientInterface.php.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php
namespace Databox\Client;

use Databox\DataboxBuilder;
/**
* This interface should go in Databox-PHP-SDK.
* DataboxClient should implement this interface (setPushData() should be refactored to pushData).
*
* @author Uroš Majerič
*
*/
interface DataboxClientInterface
{

/**
*
* @param DataboxBuilder $dataProvider Data to be pushed
*
* @return array The server response.
*/
public function pushData(DataboxBuilder $dataProvider);

}
361 changes: 361 additions & 0 deletions doc/files/Client.DataboxClientInterface.html

Large diffs are not rendered by default.

361 changes: 361 additions & 0 deletions doc/files/DataboxBuilder.html

Large diffs are not rendered by default.

36 changes: 35 additions & 1 deletion doc/files/DataboxBuilder.php.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ use \DateTimeZone;
class DataboxBuilder
{


/**
* Maximum size of payload
* @var integer
*/
private $maxPayloadSize = 1000000;

/**
*
* @var string APIKey required for authenticationg to custom connection
Expand Down Expand Up @@ -67,7 +74,7 @@ class DataboxBuilder
/**
* Add widget object to current payload.
*
* @param DataboxWidgetBase $widget
* @param \Databox\Widget\Base $widget
* Widget object.
*/
public function addWidget(\Databox\Widget\Base $widget)
Expand All @@ -87,6 +94,33 @@ class DataboxBuilder
return $payload;
}

/**
* Checks if payload is too big for pushing in one request.
* @return boolean Yes or no.
*/
public function isPayloadTooBig()
{
if (strlen(json_encode($this->JSON)) > $this->maxPayloadSize) {
return true;
} else {
return false;
}
}

/**
* Split payload into smaller chunks
* @return array All payloads.
*/
public function getSplittedPayloads()
{
$sizeOfChunk = round(count($this->JSON['data'])/ceil(strlen(json_encode($this->JSON))/$this->maxPayloadSize));
$payloads = array_chunk($this->JSON['data'], $sizeOfChunk);
foreach ($payloads as $key => $payload) {
$payloads[$key] = json_encode(['data' => $payload]);
}
return $payloads;
}

/**
* Returns the current payload as a PHP array.
*
Expand Down
Loading

0 comments on commit deb3f56

Please sign in to comment.