Skip to content

Commit

Permalink
Add additional fields for webspace (based on Etmolf work)
Browse files Browse the repository at this point in the history
  • Loading branch information
sibprogrammer committed Mar 28, 2021
1 parent f4aa65e commit 859c16f
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 2 deletions.
39 changes: 37 additions & 2 deletions src/Api/Struct/Webspace/GeneralInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,56 @@

class GeneralInfo extends \PleskX\Api\Struct
{
/** @var string */
public $creationDate;

/** @var string */
public $name;

/** @var string */
public $guid;
public $asciiName;

/** @var string */
public $status;

/** @var int */
public $realSize;

/** @var int */
public $ownerId;

/** @var array */
public $ipAddresses = [];

/** @var string */
public $guid;

/** @var string */
public $vendorGuid;

/** @var string */
public $description;

/** @var string */
public $adminDescription;

public function __construct($apiResponse)
{
$this->_initScalarProperties($apiResponse, [
['cr_date' => 'creationDate'],
'name',
'guid',
'ascii-name',
'status',
'real_size',
'owner-id',
'guid',
'vendor-guid',
'description',
'admin-description',
]);

foreach ($apiResponse->dns_ip_address as $ip) {
$this->ipAddresses[] = (string) $ip;
}
}
}
3 changes: 3 additions & 0 deletions tests/WebspaceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,9 @@ public function testGet()

$this->assertNotEmpty($webspaceInfo->name);
$this->assertEquals(0, $webspaceInfo->realSize);
$this->assertEquals($webspaceInfo->name, $webspaceInfo->asciiName);
$this->assertIsArray($webspaceInfo->ipAddresses);
$this->assertEquals(36, strlen($webspaceInfo->guid));

static::$_client->webspace()->delete('id', $webspace->id);
}
Expand Down

0 comments on commit 859c16f

Please sign in to comment.