HEAD ======= >>>>>>> release-0.2.0
1 <?php
2 /**
3 * Copyright 2012 Native5. All Rights Reserved
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * You may not use this file except in compliance with the License.
7 *
8 * Unless required by applicable law or agreed to in writing, software
9 * distributed under the License is distributed on an "AS IS" BASIS,
10 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 * See the License for the specific language governing permissions and
12 * limitations under the License.
13 * PHP version 5.3+
14 *
15 * @category Messaging
16 * @package Native5\Services\Messaging
17 * @author Barada Sahu <barry@native5.com>
18 * @copyright 2012 Native5. All Rights Reserved
19 * @license See attached LICENSE for details
20 * @version GIT: $gitid$
21 * @link http://www.docs.native5.com
22 */
23
24 namespace Native5\Services\Messaging;
25
26 use Native5\Services\Messaging\MessagingException;
<<<<<<< HEAD
27 use Native5\Api\ApiClient;
=======
27 use Native5\Services\Common\ApiClient;
>>>>>>> release-0.2.0
28 use Native5\Services\Messaging\Notifier;
29 use Native5\Services\Messaging\Message;
30
31 /**
32 * RemoteVoiceNotifier
33 *
34 * @category Messaging
35 * @package Native5\Services\Messaging
36 * @author Barada Sahu <barry@native5.com>
37 * @copyright 2012 Native5. All Rights Reserved
38 * @license See attached NOTICE.md for details
39 * @version Release: 1.0
40 * @link http://www.docs.native5.com
41 * Created : 27-11-2012
42 * Last Modified : Fri Dec 21 09:11:53 2012
43 */
44 class RemoteVoiceNotifier extends ApiClient implements Notifier
45 {
46
47
48 /**
49 * notify
50 *
51 * @param Message $message Message to send
52 *
53 * @access public
54 * @return NotificationStatus
55 * @throws MessagingException
56 */
<<<<<<< HEAD
57 public function notify(Message $message)
=======
57 public function notify(Message $message, $options=array())
>>>>>>> release-0.2.0
58 {
59 $logger = $GLOBALS['logger'];
60 $logger->debug(
61 'Sending Voice Message ',
62 array(
63 $message->getFrom(),
64 $message->getBody(),
65 )
66 );
67 $path = 'notifications/voice/send';
68 $request = $this->_remoteServer->post($path);
69 $request->setPostField('type', 'sms');
70 $request->setPostField('from', $message->getFrom());
71 $request->setPostField('to', implode(';', $message->getRecipients()));
72 $request->setPostField('content', $message->getBody());
73
74 try {
75 $response = $request->send();
76 if ($response->getStatusCode() !== 200) {
77 throw new MessagingException();
78 }
79
80 $rawResponse = $response->getBody('true');
81
82 return $rawResponse;
83 } catch (\Exception $e) {
84 throw new MessagingException();
85 }
86
87 }//end notify()
88
89
90 }//end class
91
92 ?>
93