Skip to content

Commit 4909cc6

Browse files
committed
Simple TTS Support:
- No callback URLs - No response
1 parent cdfc64b commit 4909cc6

File tree

2 files changed

+46
-1
lines changed

2 files changed

+46
-1
lines changed

src/Nexmo/Client.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public function clearSecret()
8484
*/
8585
public function send(RequestInterface $request)
8686
{
87-
$httpRequest = $this->getClient()->post(implode('/', array($this->base, $request->getURI())));
87+
$httpRequest = $this->getClient()->post(implode('/', array(trim($this->base, '/'), trim($request->getURI(), '/'))));
8888
$this->authRequest($httpRequest);
8989

9090
$params = $request->getParams();
@@ -105,6 +105,7 @@ public function send(RequestInterface $request)
105105
throw new \RuntimeException('http request error: ' . $response->getStatusCode());
106106
}
107107

108+
108109
$response = new \Nexmo\Client\Response\Response($response->json());
109110

110111
if($request instanceof WrapResponseInterface){
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
/**
3+
* @author Tim Lytle <tim@timlytle.net>
4+
*/
5+
6+
namespace Nexmo\Voice\Message;
7+
use Nexmo\Client\Request\AbstractRequest;
8+
use Nexmo\Client\Request\RequestInterface;
9+
10+
class Message extends AbstractRequest implements RequestInterface
11+
{
12+
protected $params = array();
13+
14+
public function __construct($text, $to, $from = null)
15+
{
16+
$this->params['text'] = $text;
17+
$this->params['to'] = $to;
18+
$this->params['from'] = $from;
19+
}
20+
21+
public function setLanguage($lang)
22+
{
23+
$this->params['lg'] = $lang;
24+
}
25+
26+
public function setVoice($voice)
27+
{
28+
$this->params['voice'] = $voice;
29+
}
30+
31+
public function setRepeat($count)
32+
{
33+
$this->params['repeat'] = (int) $count;
34+
}
35+
36+
/**
37+
* @return string
38+
*/
39+
public function getURI()
40+
{
41+
return '/tts/json';
42+
}
43+
44+
}

0 commit comments

Comments
 (0)