From 4d88204546013166f72ad7039c6dd08277a3be84 Mon Sep 17 00:00:00 2001 From: rgazelot Date: Tue, 1 Dec 2015 17:13:45 +0100 Subject: [PATCH 1/2] Add raw property in Event model --- src/Model/Event.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Model/Event.php b/src/Model/Event.php index e9f9d8c..8056ec8 100644 --- a/src/Model/Event.php +++ b/src/Model/Event.php @@ -86,6 +86,9 @@ class Event extends AbstractEvent /** @var Recurrence */ private $recurrence; + /** @var array */ + private $raw; + public function __construct(Calendar $calendar = null) { $this->calendar = $calendar; @@ -232,6 +235,11 @@ public function addParticipation(BaseEventParticipation $participation) return parent::addParticipation($participation); } + public function getRaw() + { + return $this->raw; + } + /** * Hydrate a new Event object with data received from Office365 api * @@ -248,6 +256,7 @@ public static function hydrate(array $data, Calendar $calendar = null) $event->id = $data['Id']; $event->etag = $data['ChangeKey']; + $event->raw = $data; // if subject is not set or is null, we use null as name $event->name = isset($data['Subject']) ? $data['Subject'] : null; From 3539c1c9bfbc7b9f6307e6ddf688ed4ea66d1bb4 Mon Sep 17 00:00:00 2001 From: rgazelot Date: Tue, 1 Dec 2015 17:14:08 +0100 Subject: [PATCH 2/2] Fetch single event --- src/Api/EventApi.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Api/EventApi.php b/src/Api/EventApi.php index 2f9e65d..07f0372 100644 --- a/src/Api/EventApi.php +++ b/src/Api/EventApi.php @@ -145,6 +145,14 @@ public function getCalendarView( /** {@inheritDoc} */ public function get($identifier) { + $request = $this->guzzle->createRequest('GET', sprintf('events/%s', $identifier), []); + $response = $this->guzzle->send($request); + + if (200 > $response->getStatusCode() || 300 <= $response->getStatusCode()) { + throw new ApiErrorException($response); + } + + return Event::hydrate($response->json()); } /** {@inheritDoc} */