Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

change return format for postMessage/postMessages; bump version

  • Loading branch information...
commit 5113ba31e717a6bbf3de8862e81aacd03fb9c1af 1 parent 5fdc141
@thousandsofthem thousandsofthem authored
View
14 IronMQ.class.php
@@ -6,7 +6,7 @@
* @link https://github.com/iron-io/iron_mq_php
* @link http://www.iron.io/products/mq
* @link http://dev.iron.io/
- * @version 1.3.0
+ * @version 1.3.1
* @package IronMQPHP
* @copyright Feel free to copy, steal, take credit for, or whatever you feel like doing with this code. ;)
*/
@@ -117,7 +117,7 @@ public function asArray() {
class IronMQ extends IronCore {
- protected $client_version = '1.3.0';
+ protected $client_version = '1.3.1';
protected $client_name = 'iron_mq_php';
protected $product_name = 'iron_mq';
protected $default_values = array(
@@ -230,7 +230,7 @@ public function clearQueue($queue_name) {
* @param string $queue_name Name of the queue.
* @param string $message
* @param array $properties
- * @return mixed
+ * @return string id
*/
public function postMessage($queue_name, $message, $properties = array()) {
$msg = new IronMQ_Message($message, $properties);
@@ -241,7 +241,8 @@ public function postMessage($queue_name, $message, $properties = array()) {
$queue = rawurlencode($queue_name);
$url = "projects/{$this->project_id}/queues/$queue/messages";
$res = $this->apiCall(self::POST, $url, $req);
- return self::json_decode($res);
+ $decoded = self::json_decode($res);
+ return $decoded->ids[0];
}
/**
@@ -259,7 +260,7 @@ public function postMessage($queue_name, $message, $properties = array()) {
* @param string $queue_name Name of the queue.
* @param array $messages array of messages, each message same as for postMessage() method
* @param array $properties array of message properties, applied to each message in $messages
- * @return mixed
+ * @return array $ids
*/
public function postMessages($queue_name, $messages, $properties = array()) {
$req = array(
@@ -273,7 +274,8 @@ public function postMessages($queue_name, $messages, $properties = array()) {
$queue = rawurlencode($queue_name);
$url = "projects/{$this->project_id}/queues/$queue/messages";
$res = $this->apiCall(self::POST, $url, $req);
- return self::json_decode($res);
+ $decoded = self::json_decode($res);
+ return $decoded->ids;
}
/**
View
BIN  iron_mq.phar
Binary file not shown
View
8 simpleTest.php
@@ -9,9 +9,13 @@
$ironmq->ssl_verifypeer = false;
for ($i = 0; $i < 10; $i++){
- echo "Post message..\n";
+ echo "Post message:\n";
$res = $ironmq->postMessage("test_queue", "Test Message $i");
- print_r($res);
+ var_dump($res);
+
+ echo "Post messages:\n";
+ $res = $ironmq->postMessages("test-queue-multi", array("Test Message $i", "Test Message $i-2"));
+ var_dump($res);
echo "Get message..\n";
$message = $ironmq->getMessage("test_queue");
Please sign in to comment.
Something went wrong with that request. Please try again.