Skip to content

Commit

Permalink
change api response to not auto decode json
Browse files Browse the repository at this point in the history
  • Loading branch information
vmitchell85 committed Apr 6, 2017
1 parent 3d575cc commit 45c7569
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/alforge/Deploy.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,11 @@ public function execute($command)

if($this->confirm("Are you sure you want to deploy the site `$site->name` on `$server->name`?")){
$response = $this->apiRequest("https://forge.laravel.com/api/v1/servers/$cmdParts[0]/sites/$cmdParts[1]/deployment/deploy");

$data = json_decode($response);

$this->respond(
"Status: ".$response->site->deployment_status,
"Status: ".$data->site->deployment_status,
["push_title" => "Deploying `$site->name` on `$server->name`"]
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/alforge/Forge.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function apiRequest($url, $method = 'POST', $data = '')
die();
}

return json_decode($result);
return $result;
}

public function requestHasError($result, $code)
Expand Down
3 changes: 3 additions & 0 deletions src/alforge/Mysql.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ public function execute($server_id)

if($this->confirm("Are you sure you want to restart MYSQL on `$server->name`?")){
$response = $this->apiRequest("https://forge.laravel.com/api/v1/servers/$server->id/mysql/reboot");

$data = json_decode($response);

$this->respond(
"Command sent to Forge",
["push_title" => "Restarting MYSQL on `$server->name`"]
Expand Down
3 changes: 3 additions & 0 deletions src/alforge/Nginx.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ public function execute($server_id)

if($this->confirm("Are you sure you want to restart Nginx on `$server->name`?")){
$response = $this->apiRequest("https://forge.laravel.com/api/v1/servers/$server->id/nginx/reboot");

$data = json_decode($response);

$this->respond(
"Command sent to Forge",
["push_title" => "Restarting Nginx on `$server->name`"]
Expand Down
3 changes: 3 additions & 0 deletions src/alforge/Postgres.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ public function execute($server_id)

if($this->confirm("Are you sure you want to restart Postgres on `$server->name`?")){
$response = $this->apiRequest("https://forge.laravel.com/api/v1/servers/$server->id/postgres/reboot");

$data = json_decode($response);

$this->respond(
"Command sent to Forge",
["push_title" => "Restarting Postgres on `$server->name`"]
Expand Down
3 changes: 3 additions & 0 deletions src/alforge/Reboot.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ public function execute($server_id)

if($this->confirm("Are you sure you want to reboot the server `$server->name`?")){
$response = $this->apiRequest("https://forge.laravel.com/api/v1/servers/$server->id/reboot");

$data = json_decode($response);

$this->respond(
"Command sent to Forge",
["push_title" => "Rebooting `$server->name`"]
Expand Down

0 comments on commit 45c7569

Please sign in to comment.