Skip to content

Commit

Permalink
fix(kobo): Rename KOBO_DEVICE_MODEL to KOBO_DEVICE_MODEL_HEADER
Browse files Browse the repository at this point in the history
  • Loading branch information
ragusa87 committed Nov 21, 2024
1 parent 5a707db commit 94d26ad
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Controller/Kobo/KoboAnalyticsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ public function analyticsEvent(Request $request, KoboDevice $kobo): Response
// Save the device_id and model
if ($request->headers->has(KoboDevice::KOBO_DEVICE_ID_HEADER)) {
$kobo->setDeviceId($request->headers->get(KoboDevice::KOBO_DEVICE_ID_HEADER));
if ($request->headers->has(KoboDevice::KOBO_DEVICE_MODEL)) {
$kobo->setModel($request->headers->get(KoboDevice::KOBO_DEVICE_MODEL));
if ($request->headers->has(KoboDevice::KOBO_DEVICE_MODEL_HEADER)) {
$kobo->setModel($request->headers->get(KoboDevice::KOBO_DEVICE_MODEL_HEADER));
}
$this->koboDeviceRepository->save($kobo);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Entity/KoboDevice.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class KoboDevice
{
use RandomGeneratorTrait;
public const KOBO_DEVICE_ID_HEADER = 'X-Kobo-Deviceid';
public const KOBO_DEVICE_MODEL = 'X-Kobo-Devicemodel';
public const KOBO_DEVICE_MODEL_HEADER = 'X-Kobo-Devicemodel';
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
Expand Down
2 changes: 1 addition & 1 deletion tests/Controller/Kobo/KoboAnalyticsControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ public function testPostEvent(): void
$client?->setServerParameter('HTTP_CONNECTION', 'keep-alive');
$server = [
'HTTP_'.KoboDevice::KOBO_DEVICE_ID_HEADER => self::DEVICE_ID,
'HTTP_'.KoboDevice::KOBO_DEVICE_MODEL => self::MODEL,
'HTTP_'.KoboDevice::KOBO_DEVICE_MODEL_HEADER => self::MODEL,
];
$client?->request('POST', '/kobo/'.$this->accessKey.'/v1/analytics/event', [
'json' => $body,
Expand Down

0 comments on commit 94d26ad

Please sign in to comment.