mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-28 16:30:59 +01:00
e96c363eef
Summary: Provides a working SMS implementation with support for Twilio. This version doesn't really retry if we get any gruff at all. Future versions should retry. Test Plan: used bin/sms to send messages and look at them. Reviewers: chad, epriestley Reviewed By: epriestley Subscribers: aurelijus, epriestley, Korvin Maniphest Tasks: T920 Differential Revision: https://secure.phabricator.com/D8930
31 lines
1.1 KiB
PHP
Executable file
31 lines
1.1 KiB
PHP
Executable file
<?php
|
|
|
|
/**
|
|
* Parent class for usage resources that expose a single date, eg 'Today', 'ThisMonth', etc
|
|
* @author Kevin Burke <kevin@twilio.com>
|
|
* @license http://creativecommons.org/licenses/MIT/ MIT
|
|
* @link http://pear.php.net/package/Services_Twilio
|
|
*/
|
|
class Services_Twilio_TimeRangeResource extends Services_Twilio_UsageResource {
|
|
|
|
/**
|
|
* Return a UsageRecord corresponding to the given category.
|
|
*
|
|
* @param string $category The category of usage to retrieve. For a full
|
|
* list of valid categories, please see the documentation at
|
|
* http://www.twilio.com/docs/api/rest/usage-records#usage-all-categories
|
|
* @return Services_Twilio_Rest_UsageRecord
|
|
* @throws Services_Twilio_RestException
|
|
*/
|
|
public function getCategory($category) {
|
|
$page = $this->getPage(0, 1, array(
|
|
'Category' => $category,
|
|
));
|
|
$items = $page->getItems();
|
|
if (!is_array($items) || count($items) === 0) {
|
|
throw new Services_Twilio_RestException(
|
|
400, "Usage record data is unformattable.");
|
|
}
|
|
return $items[0];
|
|
}
|
|
}
|