Skip to content

Commit

Permalink
Add patchData function. Change context for update and edit to 'edit'.
Browse files Browse the repository at this point in the history
  • Loading branch information
drsdre committed Jan 30, 2017
1 parent 73f2207 commit 6ec0bcb
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public function getData(
*/
public function updateData(
$entity_url,
$context = 'view',
$context = 'edit',
array $data
) {
// Set Set query data
Expand All @@ -202,6 +202,35 @@ public function updateData(
return $this;
}

/**
* Update with entity url
*
* @param string $entity_url
* @param string $context view or edit
* @param array $data
*
* @return self
*/
public function patchData(
$entity_url,
$context = 'edit',
array $data
) {
// Set Set query data
$data['context'] = $context;

$this->request =
$this->createAuthenticatedRequest()
->setMethod( 'patch' )
->setUrl( str_replace( $this->endpoint . '/', '', $entity_url ) )// Strip endpoint url from url param
->setData( $data )
;

$this->executeRequest();

return $this;
}

/**
* Add data with entity url
*
Expand Down Expand Up @@ -242,7 +271,7 @@ public function addData(
*/
public function deleteData(
$entity_url,
$context = 'view',
$context = 'edit',
array $data
) {
// Set context
Expand Down

0 comments on commit 6ec0bcb

Please sign in to comment.