@@ 82-91 (lines=10) @@ | ||
79 | /** |
|
80 | * @return UpgradeEntity[] |
|
81 | */ |
|
82 | public function getUpgrades() |
|
83 | { |
|
84 | $upgrades = $this->adapter->get(\sprintf('%s/droplet_upgrades', $this->endpoint)); |
|
85 | ||
86 | $upgrades = \json_decode($upgrades); |
|
87 | ||
88 | return \array_map(function ($upgrade) { |
|
89 | return new UpgradeEntity($upgrade); |
|
90 | }, $upgrades); |
|
91 | } |
|
92 | ||
93 | /** |
|
94 | * @param int $id |
|
@@ 100-107 (lines=8) @@ | ||
97 | * |
|
98 | * @return DropletEntity |
|
99 | */ |
|
100 | public function getById($id) |
|
101 | { |
|
102 | $droplet = $this->adapter->get(\sprintf('%s/droplets/%d', $this->endpoint, $id)); |
|
103 | ||
104 | $droplet = \json_decode($droplet); |
|
105 | ||
106 | return new DropletEntity($droplet->droplet); |
|
107 | } |
|
108 | ||
109 | /** |
|
110 | * @param int $dcId |
|
@@ 255-262 (lines=8) @@ | ||
252 | * |
|
253 | * @return ActionEntity |
|
254 | */ |
|
255 | public function getActionById($id, $actionId) |
|
256 | { |
|
257 | $action = $this->adapter->get(\sprintf('%s/droplets/%d/actions/%d', $this->endpoint, $id, $actionId)); |
|
258 | ||
259 | $action = \json_decode($action); |
|
260 | ||
261 | return new ActionEntity($action->action); |
|
262 | } |
|
263 | ||
264 | /** |
|
265 | * @param int $id |
|
@@ 471-478 (lines=8) @@ | ||
468 | * |
|
469 | * @return ActionEntity |
|
470 | */ |
|
471 | private function executeAction($id, array $options) |
|
472 | { |
|
473 | $action = $this->adapter->post(\sprintf('%s/droplets/%d/actions', $this->endpoint, $id), $options); |
|
474 | ||
475 | $action = \json_decode($action); |
|
476 | ||
477 | return new ActionEntity($action->action); |
|
478 | } |
|
479 | } |
|
480 |