Skip to content

Commit

Permalink
Merge pull request #503 from ecloud-jay2/master
Browse files Browse the repository at this point in the history
Surfaces SoftwareClient
  • Loading branch information
ecloud-jay2 authored Sep 15, 2022
2 parents 7b91bac + a21d7bd commit 6bff2a1
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/eCloud/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -375,4 +375,12 @@ public function resourceTiers()
{
return (new ResourceTierClient($this->httpClient))->auth($this->token);
}

/**
* @return BaseClient
*/
public function software()
{
return (new SoftwareClient($this->httpClient))->auth($this->token);
}
}
23 changes: 23 additions & 0 deletions src/eCloud/Entities/Software.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

namespace UKFast\SDK\eCloud\Entities;

use UKFast\SDK\Entity;

/**
* @property int $id
* @property string $name
* @property string $platform
* @property string $license
*/
class Software extends Entity
{
protected $dates = ['createdAt', 'updatedAt'];

public static $entityMap = [
'id' => 'id',
'name' => 'name',
'platform' => 'platform',
'license' => 'license',
];
}
26 changes: 26 additions & 0 deletions src/eCloud/SoftwareClient.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

namespace UKFast\SDK\eCloud;

use UKFast\SDK\eCloud\Entities\Software;
use UKFast\SDK\Entities\ClientEntityInterface;
use UKFast\SDK\Traits\PageItems;

class SoftwareClient extends Client implements ClientEntityInterface
{
use PageItems;

protected $collectionPath = 'v2/software';

public function loadEntity($data)
{
return new Software(
$this->apiToFriendly($data, $this->getEntityMap())
);
}

public function getEntityMap()
{
return Software::$entityMap;
}
}

0 comments on commit 6bff2a1

Please sign in to comment.