Skip to content

Commit 7b61a55

Browse files
committed
Merge pull request #8 from databox/update-dependencies
Update dependencies
2 parents 2e888c7 + f54bae7 commit 7b61a55

File tree

6 files changed

+39
-37
lines changed

6 files changed

+39
-37
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ language: php
33
sudo: false
44

55
php:
6-
- 5.4
76
- 5.5
87
- 5.6
98
- 7.0

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ The PHP SDK for interacting with the [Databox](http://databox.com) Push API.
1212

1313
## Requirements
1414

15-
* PHP >= 5.4 with [cURL](http://php.net/manual/en/book.curl.php) extension,
15+
* PHP >= 5.5.0 with [cURL](http://php.net/manual/en/book.curl.php) extension,
1616
* [Guzzle](https://github.com/guzzle/guzzle) library,
1717
* (optional) [PHPUnit](https://phpunit.de/) to run tests.
1818

@@ -34,7 +34,7 @@ Use autoloader from Composer by:
3434
```json
3535
{
3636
"require": {
37-
"databox/databox-php": "@stable"
37+
"databox/databox": "@stable"
3838
}
3939
}
4040
```

composer.json

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,40 @@
11
{
2-
"name": "databox/databox-php",
3-
"description": "Databox bindings for PHP",
2+
"name": "databox/databox",
43
"type": "library",
4+
"description": "Official PHP client for Databox",
5+
"keywords": ["databox", "sdk", "client"],
6+
"homepage": "http://github.com/databox/databox-php",
7+
"license": "MIT",
58
"authors": [
69
{
710
"name": "Jakob Murko",
8-
"email": "jakob@databox.com",
9-
"homepage": "http://databox.com"
11+
"email": "jakob.murko@gmail.com",
12+
"homepage": "https://github.com/sraka1"
1013
},
1114
{
1215
"name": "Uros Majeric",
13-
"email": "[email protected]"
16+
"email": "[email protected]",
17+
"homepage": "https://github.com/umajeric"
1418
},
1519
{
1620
"name": "Oto Brglez",
17-
"email": "[email protected]"
21+
"email": "[email protected]",
22+
"homepage": "https://github.com/otobrglez"
1823
},
1924
{
2025
"name": "Vlada Petrovic",
21-
"email": "[email protected]"
26+
"email": "[email protected]",
27+
"homepage": "https://github.com/vladapetrovic"
2228
}
2329
],
24-
"homepage": "http://github.com/databox/databox-php",
25-
"license": [
26-
"MIT"
27-
],
2830
"require": {
29-
"guzzlehttp/guzzle": "5.x",
30-
"php": ">=5.4"
31+
"guzzlehttp/guzzle": "^6.1",
32+
"php": ">=5.5.0"
3133
},
3234
"require-dev": {
33-
"phpunit/phpunit": "4.x",
34-
"phpdocumentor/phpdocumentor": "2.*",
35-
"codeclimate/php-test-reporter": "dev-master"
35+
"phpunit/phpunit": "^4",
36+
"phpdocumentor/phpdocumentor": "^2.8",
37+
"codeclimate/php-test-reporter": "^0.2.0"
3638
},
3739
"autoload": {
3840
"psr-4": {

example.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313

1414
$c->insertAll([
1515
['sales', 203],
16-
['sales', 103, '2015-01-01 17:00:00'],
17-
16+
['sales', 103, '2015-01-01 17:00:00']
1817
]);
1918

2019
print_r(

src/Databox/Client.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@ class Client extends GuzzleClient
99
public function __construct($pushToken = null)
1010
{
1111
parent::__construct([
12-
'base_url' => 'https://push2new.databox.com',
13-
'defaults' => [
14-
'headers' => [
15-
'Content-Type' => 'application/json'
16-
],
17-
'auth' => [$pushToken, '', 'Basic']
12+
'base_uri' => 'https://push2new.databox.com',
13+
'headers' => [
14+
'User-Agent' => 'databox-php/1.2',
15+
'Content-Type' => 'application/json',
16+
'Accept' => 'application/json'
1817
],
18+
'auth' => [$pushToken, '', 'Basic']
1919
]);
2020
}
2121

2222
public function rawPush($path = '/', $data = [])
2323
{
24-
return $this->post($path, $data)->json();
24+
return json_decode($this->post($path, $data)->getBody(), true);
2525
}
2626

2727
private function processKPI($key, $value, $date = null, $attributes = null)

tests/Databox/Tests/ClientTest.php

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
namespace Databox\Tests;
44

55
use Databox\Client;
6-
use GuzzleHttp\Message\Response;
7-
use GuzzleHttp\Stream\Stream;
6+
use GuzzleHttp\Psr7\Response;
87

98
class ClientTest extends \PHPUnit_Framework_TestCase
109
{
@@ -17,14 +16,17 @@ public function __construct()
1716

1817
public function testClientCorrectOptions()
1918
{
20-
$contentType = 'application/json';
21-
$token = 'test-token';
22-
$baseUrl = 'https://push2new.databox.com';
19+
$mimeType = 'application/json';
20+
$userAgent = 'databox-php';
21+
$token = 'test-token';
22+
$baseUrl = 'https://push2new.databox.com';
2323

2424
$client = new Client($token);
25-
$this->assertEquals($contentType, $client->getDefaultOption('headers/Content-Type'));
26-
$this->assertEquals($token, $client->getDefaultOption('auth/0'));
27-
$this->assertEquals($baseUrl, $client->getBaseUrl());
25+
$this->assertEquals($mimeType, $client->getConfig('headers')['Content-Type']);
26+
$this->assertEquals($userAgent, substr($client->getConfig('headers')['User-Agent'], 0, 11));
27+
$this->assertEquals($mimeType, $client->getConfig('headers')['Accept']);
28+
$this->assertEquals($baseUrl, (string) $client->getConfig('base_uri'));
29+
$this->assertEquals($token, $client->getConfig('auth')[0]);
2830
}
2931

3032
public function testRawPush()
@@ -34,7 +36,7 @@ public function testRawPush()
3436
->getMock();
3537

3638
$json = '{"status":"ok"}';
37-
$response = new Response(200, [], Stream::factory($json));
39+
$response = new Response(200, [], $json);
3840
$client->method('post')->willReturn($response);
3941

4042
$this->assertEquals($json, json_encode($client->rawPush()));

0 commit comments

Comments
 (0)