Skip to content

Minor Updates #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ $server = new Server([
]);

// Fluent API
$component = new Component($server)
$component = (new Component($server))
->setName('Name Here')
->setStatus(Component::OPERATIONAL)
->create();
Expand Down
8 changes: 7 additions & 1 deletion src/BaseApiComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,15 @@ public function toApi()
*/
public function create()
{
return $this->_server
$object = $this->_server
->request()
->post($this->getApiCreateUrl(), $this->toApi());

if(isset($object->data, $object->data->id)) {
$this->setId($object->data->id);
}

return $object;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/ComponentGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
class ComponentGroup extends BaseApiComponent
{
/**
* Dictates the server that the Component relates to.
* Dictates the server that the ComponentGroup relates to.
*
* @param \CheckItOnUs\Cachet\Server $server The server
*/
Expand Down
4 changes: 2 additions & 2 deletions src/Incident.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Incident extends BaseApiComponent
const FIXED = 4;

/**
* Dictates the server that the Component relates to.
* Dictates the server that the Incident relates to.
*
* @param \CheckItOnUs\Cachet\Server $server The server
*/
Expand All @@ -28,7 +28,7 @@ public static function on(Server $server)
}

/**
* Hydrates a new instance of a Component
* Hydrates a new instance of an Incident
*
* @param array $metadata The metadata
*/
Expand Down
4 changes: 2 additions & 2 deletions src/IncidentUpdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class IncidentUpdate extends BaseApiComponent
const FIXED = 4;

/**
* Dictates the server that the Component relates to.
* Dictates the server that the Incident Update relates to.
*
* @param \CheckItOnUs\Cachet\Server $server The server
*/
Expand All @@ -32,7 +32,7 @@ public static function on(Server $server)
}

/**
* Hydrates a new instance of a Component
* Hydrates a new instance of an Incident Update
*
* @param array $metadata The metadata
*/
Expand Down