diff --git a/composer.json b/composer.json index 48e21cd..06ea71e 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ ], "require": { "php": ">=5.3.0", - "guzzle/guzzle": "*" + "guzzle/guzzle": "3.*" }, "require-dev": { "phpunit/phpunit": "3.7.*" diff --git a/src/Duellsy/Pockpack/Pockpack.php b/src/Duellsy/Pockpack/Pockpack.php index 9ca0519..33864a1 100644 --- a/src/Duellsy/Pockpack/Pockpack.php +++ b/src/Duellsy/Pockpack/Pockpack.php @@ -39,17 +39,14 @@ public function send(PockpackQueue $queue = null) throw new NoPockpackQueueException(); } - $actions = json_encode($queue->getActions()); - $actions = urlencode($actions); - $params = array( - 'actions' => $actions, + 'actions' => json_encode($queue->getActions()), 'consumer_key' => $this->consumer_key, 'access_token' => $this->access_token ); $request = $this->getClient()->get('/v3/send'); - $request->setBody(json_encode($params)); + $request->getQuery()->merge($params); $response = $request->send(); diff --git a/tests/PockpackTest.php b/tests/PockpackTest.php index 79d3639..612219e 100644 --- a/tests/PockpackTest.php +++ b/tests/PockpackTest.php @@ -12,6 +12,26 @@ public function setUp() $this->pockpack = new Duellsy\Pockpack\Pockpack('fake_consumer_key', 'fake_access_token'); } + public function testSending() + { + $response = new Response(200); + $response->setBody(json_encode(array( + 'action_results' => array(true), + 'status' => 1, + ))); + $this->setPocketResponse($response); + + $pockpack_q = new Duellsy\Pockpack\PockpackQueue(); + $pockpack_q->add(array( + 'url' => 'http://www.example.com' + )); + + $response = $this->pockpack->send($pockpack_q); + $this->assertEquals(1, $response->status); + $this->assertCount(1, $response->action_results); + $this->assertTrue($response->action_results[0]); + } + public function testRetrieving() { $response = new Response(200);