Skip to content

Commit 6bff2a1

Browse files
authored
Merge pull request #503 from ecloud-jay2/master
Surfaces SoftwareClient
2 parents 7b91bac + a21d7bd commit 6bff2a1

File tree

3 files changed

+57
-0
lines changed

3 files changed

+57
-0
lines changed

src/eCloud/Client.php

+8
Original file line numberDiff line numberDiff line change
@@ -375,4 +375,12 @@ public function resourceTiers()
375375
{
376376
return (new ResourceTierClient($this->httpClient))->auth($this->token);
377377
}
378+
379+
/**
380+
* @return BaseClient
381+
*/
382+
public function software()
383+
{
384+
return (new SoftwareClient($this->httpClient))->auth($this->token);
385+
}
378386
}

src/eCloud/Entities/Software.php

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
namespace UKFast\SDK\eCloud\Entities;
4+
5+
use UKFast\SDK\Entity;
6+
7+
/**
8+
* @property int $id
9+
* @property string $name
10+
* @property string $platform
11+
* @property string $license
12+
*/
13+
class Software extends Entity
14+
{
15+
protected $dates = ['createdAt', 'updatedAt'];
16+
17+
public static $entityMap = [
18+
'id' => 'id',
19+
'name' => 'name',
20+
'platform' => 'platform',
21+
'license' => 'license',
22+
];
23+
}

src/eCloud/SoftwareClient.php

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
namespace UKFast\SDK\eCloud;
4+
5+
use UKFast\SDK\eCloud\Entities\Software;
6+
use UKFast\SDK\Entities\ClientEntityInterface;
7+
use UKFast\SDK\Traits\PageItems;
8+
9+
class SoftwareClient extends Client implements ClientEntityInterface
10+
{
11+
use PageItems;
12+
13+
protected $collectionPath = 'v2/software';
14+
15+
public function loadEntity($data)
16+
{
17+
return new Software(
18+
$this->apiToFriendly($data, $this->getEntityMap())
19+
);
20+
}
21+
22+
public function getEntityMap()
23+
{
24+
return Software::$entityMap;
25+
}
26+
}

0 commit comments

Comments
 (0)