Add delivery form feature for development

This commit is contained in:
Javier Hernández Gil
2014-04-08 21:45:45 +02:00
parent 734e4f61a8
commit e4eb388074
4 changed files with 26 additions and 3 deletions

View File

@@ -26,16 +26,23 @@ class NexmoClient {
*/
protected $api_method;
/**
* @var string
*/
protected $delivery_phone;
/**
* @param $api_key
* @param $api_secret
* @param string $api_method GET|POST configured in Nexmo API preferences
* @param $delivery_phone
*/
public function __construct($api_key,$api_secret,$api_method='GET') {
public function __construct($api_key,$api_secret,$api_method='GET',$delivery_phone) {
$this->rest_url = 'https://rest.nexmo.com';
$this->api_key = $api_key;
$this->api_secret = $api_secret;
$this->api_method = $api_method;
$this->delivery_phone = $delivery_phone;
}
/**
@@ -93,6 +100,11 @@ class NexmoClient {
* @throws \Exception
*/
public function sendTextMessage($fromName,$toNumber,$text,$status_report_req=0) {
// delivery phone for development
if($this->delivery_phone) {
$toNumber = $this->delivery_phone;
}
$params = array(
'from'=>$fromName,
'to'=>$toNumber,