Skip to content

Commit

Permalink
Add GetMysqlDatabase command
Browse files Browse the repository at this point in the history
  • Loading branch information
tvlooy committed Jan 22, 2019
1 parent d9e5e97 commit ee29fac
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ array(3) {

## Changelog

**21-01-2019 - v2.0.5**

- Added command to get Mysql database

**21-03-2018 - v2.0.4**

- Added structured representation to LinuxHostings namespace
Expand All @@ -122,4 +126,4 @@ array(3) {

**pre 19-03-2018**

- No changelog has been kept prior to this point. If you really need to know, please see the Git history to get an idead of what changed.
- No changelog has been kept prior to this point. If you really need to know, please see the Git history to get an idead of what changed.
35 changes: 35 additions & 0 deletions src/Command/MysqlDatabases/GetMysqlDatabase.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

namespace TomCan\CombellApi\Command\MysqlDatabases;

use TomCan\CombellApi\Command\AbstractCommand;
use TomCan\CombellApi\Structure\MysqlDatabases\MysqlDatabase;

class GetMysqlDatabase extends AbstractCommand
{
/**
* @var string
*/
private $databaseName;

public function __construct($databaseName)
{
parent::__construct("get", "/v2/mysqldatabases");

$this->databaseName = $databaseName;
}

public function prepare()
{
$this->setEndPoint("/v2/mysqldatabases/" . $this->databaseName);
}

public function processResponse($response)
{
$db = $response['body'];

$response['response'] = new MysqlDatabase($db->account_id, $db->name, $db->hostname, $db->user_count, $db->max_size, $db->actual_size);

return $response;
}
}

0 comments on commit ee29fac

Please sign in to comment.