Skip to content

Commit

Permalink
Added call to update multiple extra data objects at once
Browse files Browse the repository at this point in the history
  • Loading branch information
mroloux committed Aug 29, 2018
1 parent 7725c45 commit 23d8775
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/Events/Events.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,21 @@ public function updateExtraData($eventKey, $object, $extraData)
);
}

/**
* @param $eventKey string
* @param $extraDatas object|array
* @return void
*/
public function updateExtraDatas($eventKey, $extraDatas)
{
$request = new \stdClass();
$request->extraData = $extraDatas;
$this->client->post(
\GuzzleHttp\uri_template('/events/{key}/actions/update-extra-data', ["key" => $eventKey]),
['json' => $request]
);
}

/**
* @param $eventKey string
* @param $object string
Expand Down
25 changes: 25 additions & 0 deletions tests/Events/UpdateExtraDatasTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace Seatsio\Events;

use Seatsio\SeatsioClientTest;

class UpdateExtraDatasTest extends SeatsioClientTest
{

public function test()
{
$chartKey = $this->createTestChart();
$event = $this->seatsioClient->events->create($chartKey);
$extraData1 = ["foo1" => "bar1"];
$extraData2 = ["foo2" => "bar2"];

$this->seatsioClient->events->updateExtraDatas($event->key, ["A-1" => $extraData1, "A-2" => $extraData2]);

$objectStatus1 = $this->seatsioClient->events->retrieveObjectStatus($event->key, "A-1");
self::assertEquals((object)$extraData1, $objectStatus1->extraData);
$objectStatus2 = $this->seatsioClient->events->retrieveObjectStatus($event->key, "A-2");
self::assertEquals((object)$extraData2, $objectStatus2->extraData);
}

}

0 comments on commit 23d8775

Please sign in to comment.