Skip to content

Commit

Permalink
Merge pull request #65 from nixonsam/fix_subaccount_create_response
Browse files Browse the repository at this point in the history
Fix subaccount create response
  • Loading branch information
Ajay-KG authored Jul 5, 2018
2 parents 96bc753 + 6de145e commit 51a29ca
Show file tree
Hide file tree
Showing 22 changed files with 132 additions and 59 deletions.
5 changes: 4 additions & 1 deletion src/Plivo/Resources/Account/AccountInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ public function update($name, $city, $address) {

$responseContents = $response->getContent();

return new ResponseUpdate($responseContents['message']);
return new ResponseUpdate(
$responseContents['api_id'],
$responseContents['message']
);
}
}
4 changes: 2 additions & 2 deletions src/Plivo/Resources/Application/ApplicationCreateResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ class ApplicationCreateResponse extends ResponseUpdate
* @param $message
* @param $appId
*/
public function __construct($message, $appId)
public function __construct($apiId, $appId, $message)
{
parent::__construct($message);
parent::__construct($apiId, $message);
$this->appId = $appId;
}

Expand Down
9 changes: 5 additions & 4 deletions src/Plivo/Resources/Application/ApplicationInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,8 @@ public function create(

return new ApplicationCreateResponse(
$responseContents['api_id'],
$responseContents['message'],
$responseContents['app_id']
);
$responseContents['app_id'],
$responseContents['message']);
}

/**
Expand Down Expand Up @@ -105,7 +104,9 @@ public function update($appId, array $optionalArgs = [])
$responseContents = $response->getContent();

return new ResponseUpdate(
$responseContents['message']);
$responseContents['api_id'],
$responseContents['message']
);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Plivo/Resources/Call/CallCreateResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ class CallCreateResponse extends ResponseUpdate
* @param $message
* @param $requestUuid
*/
public function __construct($message, $requestUuid)
public function __construct($apiId, $message, $requestUuid )
{
parent::__construct($message);
parent::__construct($apiId, $message);
$this->requestUuid = $requestUuid;
}

Expand Down
26 changes: 19 additions & 7 deletions src/Plivo/Resources/Call/CallInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,10 @@ public function create($from, array $to, $answerUrl, $answerMethod,
$responseContents = $response->getContent();

return new CallCreateResponse(
$responseContents['api_id'],
$responseContents['message'],
$responseContents['request_uuid']);
$responseContents['request_uuid']
);
}

/**
Expand Down Expand Up @@ -301,7 +303,9 @@ public function transfer($liveCallUuid, array $optionalArgs = [])
$responseContents = $response->getContent();

return new ResponseUpdate(
$responseContents['message']);
$responseContents['api_id'],
$responseContents['message']
);
}

/**
Expand Down Expand Up @@ -378,9 +382,11 @@ public function startRecording($liveCallUuid, array $optionalArgs = [])
$responseContents = $response->getContent();

return new CallRecording(
$responseContents['message'],
$responseContents['url'],
$responseContents['recording_id']);
$responseContents['api_id'],
$responseContents['recording_id'],
$responseContents['message']
);
}

/**
Expand Down Expand Up @@ -460,7 +466,9 @@ public function startPlaying($liveCallUuid, array $urls, array $optionalArgs = [
$responseContents = $response->getContent();

return new ResponseUpdate(
$responseContents['message']);
$responseContents['api_id'],
$responseContents['message']
);
}

/**
Expand Down Expand Up @@ -536,7 +544,9 @@ public function startSpeaking($liveCallUuid, $text, array $optionalArgs = [])
$responseContents = $response->getContent();

return new ResponseUpdate(
$responseContents['message']);
$responseContents['api_id'],
$responseContents['message']
);
}

/**
Expand Down Expand Up @@ -590,7 +600,9 @@ public function dtmf($liveCallUuid, $digits, $leg = null)
$responseContents = $response->getContent();

return new ResponseUpdate(
$responseContents['message']);
$responseContents['api_id'],
$responseContents['message']
);
}

/**
Expand Down
14 changes: 12 additions & 2 deletions src/Plivo/Resources/Call/CallRecording.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,21 @@ class CallRecording extends ResponseUpdate
* @param string $url
* @param string $recordingId
*/
public function __construct($message, $url, $recordingId)
public function __construct($url, $apiID, $recordingId, $message)
{
parent::__construct($message);
parent::__construct($apiID, $message);

$this->url = $url;
$this->recordingId = $recordingId;
}

public function getUrl()
{
return $this->url;
}

public function getRecordingId()
{
return $this->recordingId;
}
}
26 changes: 19 additions & 7 deletions src/Plivo/Resources/Conference/ConferenceInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ public function kickMember($conferenceName, $memberId)

$responseContents = $response->getContent();

return new ResponseUpdate($responseContents['message']);
return new ResponseUpdate(
$responseContents['api_id'],
$responseContents['message']);
}

/**
Expand All @@ -163,7 +165,9 @@ public function muteMember($conferenceName, array $memberId)

$responseContents = $response->getContent();

return new ResponseUpdate($responseContents['message']);
return new ResponseUpdate(
$responseContents['api_id'],
$responseContents['message']);
}

/**
Expand Down Expand Up @@ -204,7 +208,9 @@ public function startPlaying($conferenceName, array $memberId, $url)

$responseContents = $response->getContent();

return new ResponseUpdate($responseContents['message']);
return new ResponseUpdate(
$responseContents['api_id'],
$responseContents['message']);
}

/**
Expand Down Expand Up @@ -249,7 +255,9 @@ public function startSpeaking($conferenceName, array $memberId, $text, array $op

$responseContents = $response->getContent();

return new ResponseUpdate($responseContents['message']);
return new ResponseUpdate(
$responseContents['api_id'],
$responseContents['message']);
}

/**
Expand Down Expand Up @@ -289,7 +297,9 @@ public function makeDeaf($conferenceName, array $memberId)

$responseContents = $response->getContent();

return new ResponseUpdate($responseContents['message']);
return new ResponseUpdate(
$responseContents['api_id'],
$responseContents['message']);
}

/**
Expand Down Expand Up @@ -346,9 +356,11 @@ public function startRecording($conferenceName, $optionalArgs = [])
$responseContents = $response->getContent();

return new ConferenceRecording(
$responseContents['api_id'],
$responseContents['message'],
$responseContents['url'],
$responseContents['recording_id']);
$responseContents['recording_id'],
$responseContents['url']
);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Plivo/Resources/Conference/ConferenceRecording.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ class ConferenceRecording extends ResponseUpdate
* @param $url
* @param $recordingId
*/
public function __construct($message, $url, $recordingId)
public function __construct($apiId, $message, $recordingId, $url)
{
parent::__construct($message);
parent::__construct($apiId, $message);

$this->url = $url;
$this->recordingId = $recordingId;
Expand Down
4 changes: 2 additions & 2 deletions src/Plivo/Resources/Endpoint/EndpointCreateReponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ class EndpointCreateReponse extends ResponseUpdate
* @param string $alias
* @param string $endpointId
*/
public function __construct($message, $username, $alias, $endpointId)
public function __construct($username, $alias, $message, $endpointId, $apiID)
{
parent::__construct($message);
parent::__construct($apiID, $message);
$this->username = $username;
$this->alias = $alias;
$this->endpointId = $endpointId;
Expand Down
9 changes: 6 additions & 3 deletions src/Plivo/Resources/Endpoint/EndpointInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,11 @@ public function create($username, $password, $alias, $appId = null)
$responseContents = $response->getContent();

return new EndpointCreateReponse(
$responseContents['message'],
$responseContents['username'],
$responseContents['alias'],
$responseContents['endpoint_id']);
$responseContents['message'],
$responseContents['endpoint_id'],
$responseContents['api_id']);
}

/**
Expand Down Expand Up @@ -140,7 +141,9 @@ public function update($endpointId, array $optionalArgs = [])

$responseContents = $response->getContent();

return new ResponseUpdate($responseContents['message']);
return new ResponseUpdate(
$responseContents['api_id'],
$responseContents['message']);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Plivo/Resources/Message/MessageCreateResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ class MessageCreateResponse extends ResponseUpdate
* @param $message
* @param array $messageUuid
*/
public function __construct($message, array $messageUuid)
public function __construct($message, array $messageUuid, $apiId)
{
parent::__construct($message);
parent::__construct($apiId, $message);
$this->messageUuid = $messageUuid;
}

Expand Down
4 changes: 3 additions & 1 deletion src/Plivo/Resources/Message/MessageInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,9 @@ public function create($src, array $dst, $text,

return new MessageCreateResponse(
$responseContents['message'],
$responseContents['message_uuid']);
$responseContents['message_uuid'],
$responseContents['api_id']
);
}

}
5 changes: 4 additions & 1 deletion src/Plivo/Resources/Number/NumberInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ public function update($number, $optionalArgs = [])

$responseContents = $response->getContent();

return new ResponseUpdate($responseContents['message']);
return new ResponseUpdate(
$responseContents['api_id'],
$responseContents['message']);
}

/**
Expand Down Expand Up @@ -170,6 +172,7 @@ public function addNumber(
$responseContents = $response->getContent();

return new ResponseUpdate(
$responseContents['api_id'],
$responseContents['message']);
}
}
4 changes: 2 additions & 2 deletions src/Plivo/Resources/PhoneNumber/PhoneNumberBuyResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ class PhoneNumberBuyResponse extends ResponseUpdate
* @param $numberStatus
* @param $status
*/
public function __construct($message, $number, $numberStatus, $status)
public function __construct($apiID, $message, $number, $numberStatus, $status)
{
parent::__construct($message);
parent::__construct($apiID, $message);

$this->number = $number;
$this->numberStatus = $numberStatus;
Expand Down
1 change: 1 addition & 0 deletions src/Plivo/Resources/PhoneNumber/PhoneNumberInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public function buy($phoneNumber, $appId = null)
$responseContents = $response->getContent();

return new PhoneNumberBuyResponse(
$responseContents['api_id'],
$responseContents['message'],
$responseContents['numbers'][0]['number'],
$responseContents['numbers'][0]['status'],
Expand Down
24 changes: 16 additions & 8 deletions src/Plivo/Resources/ResponseUpdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@

namespace Plivo\Resources;


use Plivo\Exceptions\PlivoRestException;


/**
* Class ResponseUpdate
* @package Plivo\Resources
Expand All @@ -15,15 +13,21 @@ class ResponseUpdate
/**
* @var
*/
private $_message;
public $_message;

/**
* @var
*/
public $apiId;

/**
* ResponseUpdate constructor.
* @param $message
*/
public function __construct($message)
public function __construct($apiId, $message)
{
$this->_message = $message;
$this->apiId = $apiId;
}

/**
Expand All @@ -40,15 +44,19 @@ function __get($name)

throw new PlivoRestException('Unknown Response property ' . $name);
}

/**
* Get the API ID
* @return mixed
*/
public function getApiId()
{
return $this->apiId;
}
/**
* @return mixed
*/
public function getMessage()
{
return $this->_message;
}



}
Loading

0 comments on commit 51a29ca

Please sign in to comment.