1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +01:00

Remove Twilio-PHP API external

Summary:
Ref T920. D19937 provides about 100 lines of code which can do essentially everything here; throw out the trillion lines of full external API stuff.

(I am generally not sure why everyone writes API libraries like this instead of like D19937.)

Test Plan: Send SMS messages with D19937, so I don't think we need any of this code anymore. This code is techncially reachable through some pathways like `bin/sms`, but won't be for long.

Reviewers: amckinley

Reviewed By: amckinley

Subscribers: aurelijus

Maniphest Tasks: T920

Differential Revision: https://secure.phabricator.com/D19938
This commit is contained in:
epriestley 2019-01-01 19:05:31 -08:00
parent 05a9474138
commit e856e791f3
151 changed files with 0 additions and 14914 deletions

View file

@ -1,35 +0,0 @@
Authors
=======
A huge thanks to all of our contributors:
- =noloh
- Adam Ballai
- Alex Chan
- Alex Rowley
- Brett Gerry
- Bulat Shakirzyanov
- Chris Barr
- D Keith Casey Jr
- D. Keith Casey, Jr.
- Doug Black
- John Britton
- Jordi Boggiano
- Keith Casey
- Kevin Burke
- Kyle
- Kyle Conroy
- Luke Waite
- Neuman
- Neuman Vong
- Peter Meth
- Ryan Brideau
- Sam Kimbrel
- Shawn Parker
- Stuart Langley
- Taichiro Yoshida
- Trenton McManus
- aaronfoss
- sashalaundy
- till

View file

@ -1,261 +0,0 @@
twilio-php Changelog
====================
Version 3.12.4
--------------
Released on January 30, 2014
- Fix incorrect use of static:: which broke compatibility with PHP 5.2.
Version 3.12.3
--------------
Released on January 28, 2014
- Add link from recordings to associated transcriptions.
- Document how to debug requests, improve TwiML generation docs.
Version 3.12.2
--------------
Released on January 5, 2014
- Fixes string representation of resources
- Support PHP 5.5
Version 3.12.1
--------------
Released on October 21, 2013
- Add support for filtering by type for IncomingPhoneNumbers.
- Add support for searching for mobile numbers for both
IncomingPhoneNumbers and AvailablePhoneNumbers.
Version 3.12.0
--------------
Released on September 18, 2013
- Support MMS
- Support SIP In
- $params arrays will now turn lists into multiple HTTP keys with the same name,
array("Twilio" => array('foo', 'bar'))
will turn into Twilio=foo&Twilio=bar when sent to the API.
- Update the documentation to use php-autodoc and Sphinx.
Version 3.11.0
--------------
Released on June 13
- Support Streams when curl is not available for PHP installations
Version 3.10.0
--------------
Released on February 2, 2013
- Uses the [HTTP status code for error reporting][http], instead of the
`status` attribute of the JSON response. (Reporter: [Ruud Kamphuis](/ruudk))
[http]: https://github.com/twilio/twilio-php/pull/116
Version 3.9.1
-------------
Released on December 30, 2012
- Adds a `$last_response` parameter to the `$client` object that can be
used to [retrieve the raw API response][last-response]. (Reporter: [David
Jones](/dxjones))
[last-response]: https://github.com/twilio/twilio-php/pull/112/files
Version 3.9.0
-------------
Released on December 20, 2012
- [Fixes TwiML generation to handle non-ASCII characters properly][utf-8]. Note
that as of version 3.9.0, **the library requires PHP version 5.2.3, at least
for TwiML generation**. (Reporter: [Walker Hamilton](/walker))
[utf-8]: https://github.com/twilio/twilio-php/pull/111
Version 3.8.3
-------------
Released on December 15, 2012
- [Fixes the ShortCode resource][shortcode] so it is queryable via the PHP library.
[shortcode]: https://github.com/twilio/twilio-php/pull/108
Version 3.8.2
-------------
Released on November 26, 2012
- Fixes an issue where you [could not iterate over the members in a
queue][queue-members]. (Reporter: [Alex Chan](/alexcchan))
[queue-members]: https://github.com/twilio/twilio-php/pull/107
Version 3.8.1
-------------
Released on November 23, 2012
- [Implements the Countable interface on the ListResource][countable], so you
can call count() on any resource.
- [Adds a convenience method for retrieving a phone number object][get-number],
so you can retrieve all of a number's properties by its E.164 representation.
Internally:
- Adds [unit tests for url encoding of Unicode characters][unicode-tests].
- Updates [Travis CI configuration to use Composer][travis-composer],
shortening build time from 83 seconds to 21 seconds.
[countable]: https://twilio-php.readthedocs.org/en/latest/usage/rest.html#retrieving-the-total-number-of-resources
[get-number]: https://twilio-php.readthedocs.org/en/latest/usage/rest/phonenumbers.html#retrieving-all-of-a-number-s-properties
[unicode-tests]: https://github.com/twilio/twilio-php/commit/6f8aa57885796691858e460c8cea748e241c47e3
[travis-composer]: https://github.com/twilio/twilio-php/commit/a732358e90e1ae9a5a3348ad77dda8cc8b5ec6bc
Version 3.8.0
-------------
Released on October 17, 2012
- Support the new Usage API, with Usage Records and Usage Triggers. Read the
PHP documentation for [usage records][records] or [usage triggers][triggers]
[records]: https://twilio-php.readthedocs.org/en/latest/usage/rest/usage-records.html
[triggers]: https://twilio-php.readthedocs.org/en/latest/usage/rest/usage-triggers.html
Version 3.7.2
-------------
- The library will now [use a standard CA cert whitelist][whitelist] for SSL
validation, replacing a file that contained only Twilio's SSL certificate.
(Reporter: [Andrew Benton](/andrewmbenton))
[whitelist]: https://github.com/twilio/twilio-php/issues/88
Version 3.7.1
-------------
Released on August 16, 2012
- Fix a bug in the 3.5.0 release where [updating an instance
resource would cause subsequent updates to request an incorrect
URI](/twilio/twilio-php/pull/82).
(Reporter: [Dan Bowen](/crucialwebstudio))
Version 3.7.0
-------------
Released on August 6, 2012
- Add retry support for idempotent HTTP requests that result in a 500 server
error (default is 1 attempt, however this can be configured).
- Throw a Services_Twilio_RestException instead of a DomainException if the
response content cannot be parsed as JSON (usually indicates a 500 error)
Version 3.6.0
-------------
Released on August 5, 2012
- Add support for Queues and Members. Includes tests and documentation for the
new functionality.
Version 3.5.2
-------------
Released on July 23, 2012
- Fix an issue introduced in the 3.5.0 release where updating or muting
a participant would [throw an exception instead of muting the
participant][mute-request].
(Reporter: [Alex Chan](/alexcchan))
- Fix an issue introduced in the 3.5.0 release where [filtering an iterator
with parameters would not work properly][paging-request] on subsequent HTTP
requests. (Reporters: [Alex Chan](/alexcchan), Ivor O'Connor)
[mute-request]: /twilio/twilio-php/pull/74
[paging-request]: /twilio/twilio-php/pull/75
Version 3.5.1
-------------
Released on July 2, 2012
- Fix an issue introduced in the 3.5.0 release that would cause a second HTTP
request for an instance resource [to request an incorrect URI][issue-71].
[issue-71]: https://github.com/twilio/twilio-php/pull/71
Version 3.5.0
-------------
Released on June 30, 2012
- Support paging through resources using the `next_page_uri` parameter instead
of manually constructing parameters using the `Page` and `PageSize` parameters.
Specifically, this allows the library to use the `AfterSid` parameter, which
leads to improved performance when paging deep into your resource list.
This involved a major refactor of the library. The documented interface to
twilio-php will not change. However, some undocumented public methods are no
longer supported. Specifically, the following classes are no longer available:
- `Services/Twilio/ArrayDataProxy.php`
- `Services/Twilio/CachingDataProxy.php`
- `Services/Twilio/DataProxy.php`
In addition, the following public methods have been removed:
- `setProxy`, in `Services/Twilio/InstanceResource.php`
- `getSchema`, in `Services/Twilio/ListResource.php`,
`Services/Twilio/Rest/AvailablePhoneNumbers.php`,
`Services/Twilio/Rest/SMSMessages.php`
- `retrieveData`, in `Services/Twilio/Resource.php`
- `deleteData`, in `Services/Twilio/Resource.php`
- `addSubresource`, in `Services/Twilio/Resource.php`
Please check your own code for compatibility before upgrading.
Version 3.3.2
-------------
Released on May 3, 2012
- If you pass booleans in as TwiML (ex transcribe="true"), convert them to
the strings "true" and "false" instead of outputting the incorrect values
1 and "".
Version 3.3.1
-------------
Released on May 1, 2012
- Use the 'Accept-Charset' header to specify we want to receive UTF-8 encoded
data from the Twilio API. Remove unused XML parsing logic, as the library never
requests XML data.
Version 3.2.4
-------------
Released on March 14, 2012
- If no version is passed to the Services_Twilio constructor, the library will
default to the most recent API version.

View file

@ -1,22 +0,0 @@
MIT License
Copyright (C) 2011, Twilio, Inc. <help at twilio dot com>
Copyright (C) 2011, Neuman Vong <neuman at twilio dot com>
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -1,72 +0,0 @@
# Twilio API helper library.
# See LICENSE file for copyright and license details.
define LICENSE
<?php
/**
* Twilio API helper library.
*
* @category Services
* @package Services_Twilio
* @author Neuman Vong <neuman@twilio.com>
* @license http://creativecommons.org/licenses/MIT/ MIT
* @link http://pear.php.net/package/Services_Twilio
*/
endef
export LICENSE
COMPOSER = $(shell which composer)
ifeq ($(strip $(COMPOSER)),)
COMPOSER = php composer.phar
endif
all: test
clean:
@rm -rf dist venv
PHP_FILES = `find dist -name \*.php`
dist: clean
@mkdir dist
@git archive master | (cd dist; tar xf -)
@for php in $(PHP_FILES); do\
echo "$$LICENSE" > $$php.new; \
tail -n+2 $$php >> $$php.new; \
mv $$php.new $$php; \
done
test-install:
# Composer: http://getcomposer.org/download/
$(COMPOSER) install
install:
pear channel-discover twilio.github.com/pear
pear install twilio/Services_Twilio
# if these fail, you may need to install the helper library - run "make
# test-install"
test:
@PATH=vendor/bin:$(PATH) phpunit --strict --colors --configuration tests/phpunit.xml;
venv:
virtualenv venv
docs-install: venv
. venv/bin/activate; pip install -r docs/requirements.txt
docs:
. venv/bin/activate; cd docs && make html
release-install:
pear channel-discover twilio.github.com/pear || true
pear channel-discover pear.pirum-project.org || true
pear install pirum/Pirum || true
pear install XML_Serializer-0.20.2 || true
pear install PEAR_PackageFileManager2 || true
authors:
echo "Authors\n=======\n\nA huge thanks to all of our contributors:\n\n" > AUTHORS.md
git log --raw | grep "^Author: " | cut -d ' ' -f2- | cut -d '<' -f1 | sed 's/^/- /' | sort | uniq >> AUTHORS.md
.PHONY: all clean dist test docs docs-install test-install authors

View file

@ -1,136 +0,0 @@
[![Build Status](https://secure.travis-ci.org/twilio/twilio-php.png?branch=master)](http://travis-ci.org/twilio/twilio-php)
## Installation
You can install **twilio-php** via PEAR or by downloading the source.
#### Via PEAR (>= 1.9.3):
PEAR is a package manager for PHP. Open a command line and use these PEAR
commands to download the helper library:
$ pear channel-discover twilio-pear.herokuapp.com/pear
$ pear install twilio/Services_Twilio
If you get the following message:
$ -bash: pear: command not found
you can install PEAR from their website, or download the source directly.
#### Via Composer:
**twilio-php** is available on Packagist as the
[`twilio/sdk`](http://packagist.org/packages/twilio/sdk) package.
#### Via ZIP file:
[Click here to download the source
(.zip)](https://github.com/twilio/twilio-php/zipball/master) which includes all
dependencies.
Once you download the library, move the twilio-php folder to your project
directory and then include the library file:
require '/path/to/twilio-php/Services/Twilio.php';
and you're good to go!
## A Brief Introduction
With the twilio-php library, we've simplified interaction with the
Twilio REST API. No need to manually create URLS or parse XML/JSON.
You now interact with resources directly. Follow the [Quickstart
Guide](http://readthedocs.org/docs/twilio-php/en/latest/#quickstart)
to get up and running right now. The [User
Guide](http://readthedocs.org/docs/twilio-php/en/latest/#user-guide) shows you
how to get the most out of **twilio-php**.
## Quickstart
### Send an SMS
```php
<?php
// Install the library via PEAR or download the .zip file to your project folder.
// This line loads the library
require('/path/to/twilio-php/Services/Twilio.php');
$sid = "ACXXXXXX"; // Your Account SID from www.twilio.com/user/account
$token = "YYYYYY"; // Your Auth Token from www.twilio.com/user/account
$client = new Services_Twilio($sid, $token);
$message = $client->account->messages->sendMessage(
'9991231234', // From a valid Twilio number
'8881231234', // Text this number
"Hello monkey!"
);
print $message->sid;
```
### Make a Call
```php
<?php
// Install the library via PEAR or download the .zip file to your project folder.
// This line loads the library
require('/path/to/twilio-php/Services/Twilio.php');
$sid = "ACXXXXXX"; // Your Account SID from www.twilio.com/user/account
$token = "YYYYYY"; // Your Auth Token from www.twilio.com/user/account
$client = new Services_Twilio($sid, $token);
$call = $client->account->calls->create(
'9991231234', // From a valid Twilio number
'8881231234', // Call this number
// Read TwiML at this URL when a call connects (hold music)
'http://twimlets.com/holdmusic?Bucket=com.twilio.music.ambient'
);
```
### Generating TwiML
To control phone calls, your application needs to output
[TwiML](http://www.twilio.com/docs/api/twiml/ "Twilio Markup Language"). Use
`Services_Twilio_Twiml` to easily create such responses.
```php
<?php
require('/path/to/twilio-php/Services/Twilio.php');
$response = new Services_Twilio_Twiml();
$response->say('Hello');
$response->play('https://api.twilio.com/cowbell.mp3', array("loop" => 5));
print $response;
```
That will output XML that looks like this:
```xml
<?xml version="1.0" encoding="utf-8"?>
<Response>
<Say>Hello</Say>
<Play loop="5">https://api.twilio.com/cowbell.mp3</Play>
<Response>
```
## [Full Documentation](http://readthedocs.org/docs/twilio-php/en/latest/ "Twilio PHP Library Documentation")
The documentation for **twilio-php** is hosted
at Read the Docs. [Click here to read our full
documentation.](http://readthedocs.org/docs/twilio-php/en/latest/ "Twilio PHP
Library Documentation")
## Prerequisites
* PHP >= 5.2.3
* The PHP JSON extension
## Reporting Issues
We would love to hear your feedback. Report issues using the [Github
Issue Tracker](https://github.com/twilio/twilio-php/issues) or email
[help@twilio.com](mailto:help@twilio.com).

View file

@ -1,313 +0,0 @@
<?php
/*
* Author: Neuman Vong neuman@twilio.com
* License: http://creativecommons.org/licenses/MIT/ MIT
* Link: https://twilio-php.readthedocs.org/en/latest/
*/
function Services_Twilio_autoload($className) {
if (substr($className, 0, 15) != 'Services_Twilio') {
return false;
}
$file = str_replace('_', '/', $className);
$file = str_replace('Services/', '', $file);
return include dirname(__FILE__) . "/$file.php";
}
spl_autoload_register('Services_Twilio_autoload');
/**
* Create a client to talk to the Twilio API.
*
*
* :param string $sid: Your Account SID
* :param string $token: Your Auth Token from `your dashboard
* <https://www.twilio.com/user/account>`_
* :param string $version: API version to use
* :param $_http: A HTTP client for making requests.
* :type $_http: :php:class:`Services_Twilio_TinyHttp`
* :param int $retryAttempts:
* Number of times to retry failed requests. Currently only idempotent
* requests (GET's and DELETE's) are retried.
*
* Here's an example:
*
* .. code-block:: php
*
* require('Services/Twilio.php');
* $client = new Services_Twilio('AC123', '456bef', null, null, 3);
* // Take some action with the client, etc.
*/
class Services_Twilio extends Services_Twilio_Resource
{
const USER_AGENT = 'twilio-php/3.12.4';
protected $http;
protected $retryAttempts;
protected $last_response;
protected $version;
protected $versions = array('2008-08-01', '2010-04-01');
public function __construct(
$sid,
$token,
$version = null,
Services_Twilio_TinyHttp $_http = null,
$retryAttempts = 1
) {
$this->version = in_array($version, $this->versions) ?
$version : end($this->versions);
if (null === $_http) {
if (!in_array('openssl', get_loaded_extensions())) {
throw new Services_Twilio_HttpException("The OpenSSL extension is required but not currently enabled. For more information, see http://php.net/manual/en/book.openssl.php");
}
if (in_array('curl', get_loaded_extensions())) {
$_http = new Services_Twilio_TinyHttp(
"https://api.twilio.com",
array(
"curlopts" => array(
CURLOPT_USERAGENT => self::qualifiedUserAgent(phpversion()),
CURLOPT_HTTPHEADER => array('Accept-Charset: utf-8'),
CURLOPT_CAINFO => dirname(__FILE__) . '/cacert.pem',
),
)
);
} else {
$_http = new Services_Twilio_HttpStream(
"https://api.twilio.com",
array(
"http_options" => array(
"http" => array(
"user_agent" => self::qualifiedUserAgent(phpversion()),
"header" => "Accept-Charset: utf-8\r\n",
),
"ssl" => array(
'verify_peer' => true,
'cafile' => dirname(__FILE__) . '/cacert.pem',
'verify_depth' => 5,
),
),
)
);
}
}
$_http->authenticate($sid, $token);
$this->http = $_http;
$this->accounts = new Services_Twilio_Rest_Accounts($this, "/{$this->version}/Accounts");
$this->account = $this->accounts->get($sid);
$this->retryAttempts = $retryAttempts;
}
/**
* Fully qualified user agent with the current PHP Version.
*
* :return: the user agent
* :rtype: string
*/
public static function qualifiedUserAgent($php_version) {
return self::USER_AGENT . " (php $php_version)";
}
/**
* Get the api version used by the rest client
*
* :return: the API version in use
* :returntype: string
*/
public function getVersion() {
return $this->version;
}
/**
* Get the retry attempt limit used by the rest client
*
* :return: the number of retry attempts
* :rtype: int
*/
public function getRetryAttempts() {
return $this->retryAttempts;
}
/**
* Construct a URI based on initial path, query params, and paging
* information
*
* We want to use the query params, unless we have a next_page_uri from the
* API.
*
* :param string $path: The request path (may contain query params if it's
* a next_page_uri)
* :param array $params: Query parameters to use with the request
* :param boolean $full_uri: Whether the $path contains the full uri
*
* :return: the URI that should be requested by the library
* :returntype: string
*/
public static function getRequestUri($path, $params, $full_uri = false) {
$json_path = $full_uri ? $path : "$path.json";
if (!$full_uri && !empty($params)) {
$query_path = $json_path . '?' . http_build_query($params, '', '&');
} else {
$query_path = $json_path;
}
return $query_path;
}
/**
* Helper method for implementing request retry logic
*
* :param array $callable: The function that makes an HTTP request
* :param string $uri: The URI to request
* :param int $retriesLeft: Number of times to retry
*
* :return: The object representation of the resource
* :rtype: object
*/
protected function _makeIdempotentRequest($callable, $uri, $retriesLeft) {
$response = call_user_func_array($callable, array($uri));
list($status, $headers, $body) = $response;
if ($status >= 500 && $retriesLeft > 0) {
return $this->_makeIdempotentRequest($callable, $uri, $retriesLeft - 1);
} else {
return $this->_processResponse($response);
}
}
/**
* GET the resource at the specified path.
*
* :param string $path: Path to the resource
* :param array $params: Query string parameters
* :param boolean $full_uri: Whether the full URI has been passed as an
* argument
*
* :return: The object representation of the resource
* :rtype: object
*/
public function retrieveData($path, $params = array(),
$full_uri = false
) {
$uri = self::getRequestUri($path, $params, $full_uri);
return $this->_makeIdempotentRequest(array($this->http, 'get'),
$uri, $this->retryAttempts);
}
/**
* DELETE the resource at the specified path.
*
* :param string $path: Path to the resource
* :param array $params: Query string parameters
*
* :return: The object representation of the resource
* :rtype: object
*/
public function deleteData($path, $params = array())
{
$uri = self::getRequestUri($path, $params);
return $this->_makeIdempotentRequest(array($this->http, 'delete'),
$uri, $this->retryAttempts);
}
/**
* POST to the resource at the specified path.
*
* :param string $path: Path to the resource
* :param array $params: Query string parameters
*
* :return: The object representation of the resource
* :rtype: object
*/
public function createData($path, $params = array())
{
$path = "$path.json";
$headers = array('Content-Type' => 'application/x-www-form-urlencoded');
$response = $this->http->post(
$path, $headers, self::buildQuery($params, '')
);
return $this->_processResponse($response);
}
/**
* Build a query string from query data
*
* :param array $queryData: An associative array of keys and values. The
* values can be a simple type or a list, in which case the list is
* converted to multiple query parameters with the same key.
* :param string $numericPrefix:
* :param string $queryStringStyle: Determine how to build the url
* - strict: Build a standards compliant query string without braces (can be hacked by using braces in key)
* - php: Build a PHP compatible query string with nested array syntax
* :return: The encoded query string
* :rtype: string
*/
public static function buildQuery($queryData, $numericPrefix = '') {
$query = '';
// Loop through all of the $query_data
foreach ($queryData as $key => $value) {
// If the key is an int, add the numeric_prefix to the beginning
if (is_int($key)) {
$key = $numericPrefix . $key;
}
// If the value is an array, we will end up recursing
if (is_array($value)) {
// Loop through the values
foreach ($value as $value2) {
// Add an arg_separator if needed
if ($query !== '') {
$query .= '&';
}
// Recurse
$query .= self::buildQuery(array($key => $value2), $numericPrefix);
}
} else {
// Add an arg_separator if needed
if ($query !== '') {
$query .= '&';
}
// Add the key and the urlencoded value (as a string)
$query .= $key . '=' . urlencode((string)$value);
}
}
return $query;
}
/**
* Convert the JSON encoded resource into a PHP object.
*
* :param array $response: 3-tuple containing status, headers, and body
*
* :return: PHP object decoded from JSON
* :rtype: object
* :throws: A :php:class:`Services_Twilio_RestException` if the Response is
* in the 300-500 range of status codes.
*/
private function _processResponse($response)
{
list($status, $headers, $body) = $response;
if ($status === 204) {
return true;
}
$decoded = json_decode($body);
if ($decoded === null) {
throw new Services_Twilio_RestException(
$status,
'Could not decode response body as JSON. ' .
'This likely indicates a 500 server error'
);
}
if (200 <= $status && $status < 300) {
$this->last_response = $decoded;
return $decoded;
}
throw new Services_Twilio_RestException(
$status,
isset($decoded->message) ? $decoded->message : '',
isset($decoded->code) ? $decoded->code : null,
isset($decoded->more_info) ? $decoded->more_info : null
);
}
}

View file

@ -1,109 +0,0 @@
<?php
class Services_Twilio_AutoPagingIterator
implements Iterator
{
protected $generator;
protected $args;
protected $items;
private $_args;
public function __construct($generator, $page, $size, $filters) {
$this->generator = $generator;
$this->page = $page;
$this->size = $size;
$this->filters = $filters;
$this->items = array();
// Save a backup for rewind()
$this->_args = array(
'page' => $page,
'size' => $size,
'filters' => $filters,
);
}
public function current()
{
return current($this->items);
}
public function key()
{
return key($this->items);
}
/*
* Return the next item in the list, making another HTTP call to the next
* page of resources if necessary.
*/
public function next()
{
try {
$this->loadIfNecessary();
return next($this->items);
}
catch (Services_Twilio_RestException $e) {
// 20006 is an out of range paging error, everything else is valid
if ($e->getCode() != 20006) {
throw $e;
}
}
}
/*
* Restore everything to the way it was before we began paging. This gets
* called at the beginning of any foreach() loop
*/
public function rewind()
{
foreach ($this->_args as $arg => $val) {
$this->$arg = $val;
}
$this->items = array();
$this->next_page_uri = null;
}
public function count()
{
throw new BadMethodCallException('Not allowed');
}
public function valid()
{
try {
$this->loadIfNecessary();
return key($this->items) !== null;
}
catch (Services_Twilio_RestException $e) {
// 20006 is an out of range paging error, everything else is valid
if ($e->getCode() != 20006) {
throw $e;
}
}
return false;
}
/*
* Fill $this->items with a new page from the API, if necessary.
*/
protected function loadIfNecessary()
{
if (// Empty because it's the first time or last page was empty
empty($this->items)
// null key when the items list is iterated over completely
|| key($this->items) === null
) {
$page = call_user_func_array($this->generator, array(
$this->page,
$this->size,
$this->filters,
$this->next_page_uri,
));
$this->next_page_uri = $page->next_page_uri;
$this->items = $page->getItems();
$this->page = $this->page + 1;
}
}
}

View file

@ -1,346 +0,0 @@
<?php
/**
* Twilio Capability Token generator
*
* @category Services
* @package Services_Twilio
* @author Jeff Lindsay <jeff.lindsay@twilio.com>
* @license http://creativecommons.org/licenses/MIT/ MIT
*/
class Services_Twilio_Capability
{
public $accountSid;
public $authToken;
public $scopes;
/**
* Create a new TwilioCapability with zero permissions. Next steps are to
* grant access to resources by configuring this token through the
* functions allowXXXX.
*
* @param $accountSid the account sid to which this token is granted access
* @param $authToken the secret key used to sign the token. Note, this auth
* token is not visible to the user of the token.
*/
public function __construct($accountSid, $authToken)
{
$this->accountSid = $accountSid;
$this->authToken = $authToken;
$this->scopes = array();
$this->clientName = false;
}
/**
* If the user of this token should be allowed to accept incoming
* connections then configure the TwilioCapability through this method and
* specify the client name.
*
* @param $clientName
*/
public function allowClientIncoming($clientName)
{
// clientName must be a non-zero length alphanumeric string
if (preg_match('/\W/', $clientName)) {
throw new InvalidArgumentException(
'Only alphanumeric characters allowed in client name.');
}
if (strlen($clientName) == 0) {
throw new InvalidArgumentException(
'Client name must not be a zero length string.');
}
$this->clientName = $clientName;
$this->allow('client', 'incoming',
array('clientName' => $clientName));
}
/**
* Allow the user of this token to make outgoing connections.
*
* @param $appSid the application to which this token grants access
* @param $appParams signed parameters that the user of this token cannot
* overwrite.
*/
public function allowClientOutgoing($appSid, array $appParams=array())
{
$this->allow('client', 'outgoing', array(
'appSid' => $appSid,
'appParams' => http_build_query($appParams, '', '&')));
}
/**
* Allow the user of this token to access their event stream.
*
* @param $filters key/value filters to apply to the event stream
*/
public function allowEventStream(array $filters=array())
{
$this->allow('stream', 'subscribe', array(
'path' => '/2010-04-01/Events',
'params' => http_build_query($filters, '', '&'),
));
}
/**
* Generates a new token based on the credentials and permissions that
* previously has been granted to this token.
*
* @param $ttl the expiration time of the token (in seconds). Default
* value is 3600 (1hr)
* @return the newly generated token that is valid for $ttl seconds
*/
public function generateToken($ttl = 3600)
{
$payload = array(
'scope' => array(),
'iss' => $this->accountSid,
'exp' => time() + $ttl,
);
$scopeStrings = array();
foreach ($this->scopes as $scope) {
if ($scope->privilege == "outgoing" && $this->clientName)
$scope->params["clientName"] = $this->clientName;
$scopeStrings[] = $scope->toString();
}
$payload['scope'] = implode(' ', $scopeStrings);
return JWT::encode($payload, $this->authToken, 'HS256');
}
protected function allow($service, $privilege, $params) {
$this->scopes[] = new ScopeURI($service, $privilege, $params);
}
}
/**
* Scope URI implementation
*
* Simple way to represent configurable privileges in an OAuth
* friendly way. For our case, they look like this:
*
* scope:<service>:<privilege>?<params>
*
* For example:
* scope:client:incoming?name=jonas
*
* @author Jeff Lindsay <jeff.lindsay@twilio.com>
*/
class ScopeURI
{
public $service;
public $privilege;
public $params;
public function __construct($service, $privilege, $params = array())
{
$this->service = $service;
$this->privilege = $privilege;
$this->params = $params;
}
public function toString()
{
$uri = "scope:{$this->service}:{$this->privilege}";
if (count($this->params)) {
$uri .= "?".http_build_query($this->params, '', '&');
}
return $uri;
}
/**
* Parse a scope URI into a ScopeURI object
*
* @param string $uri The scope URI
* @return ScopeURI The parsed scope uri
*/
public static function parse($uri)
{
if (strpos($uri, 'scope:') !== 0) {
throw new UnexpectedValueException(
'Not a scope URI according to scheme');
}
$parts = explode('?', $uri, 1);
$params = null;
if (count($parts) > 1) {
parse_str($parts[1], $params);
}
$parts = explode(':', $parts[0], 2);
if (count($parts) != 3) {
throw new UnexpectedValueException(
'Not enough parts for scope URI');
}
list($scheme, $service, $privilege) = $parts;
return new ScopeURI($service, $privilege, $params);
}
}
/**
* JSON Web Token implementation
*
* Minimum implementation used by Realtime auth, based on this spec:
* http://self-issued.info/docs/draft-jones-json-web-token-01.html.
*
* @author Neuman Vong <neuman@twilio.com>
*/
class JWT
{
/**
* @param string $jwt The JWT
* @param string|null $key The secret key
* @param bool $verify Don't skip verification process
*
* @return object The JWT's payload as a PHP object
*/
public static function decode($jwt, $key = null, $verify = true)
{
$tks = explode('.', $jwt);
if (count($tks) != 3) {
throw new UnexpectedValueException('Wrong number of segments');
}
list($headb64, $payloadb64, $cryptob64) = $tks;
if (null === ($header = JWT::jsonDecode(JWT::urlsafeB64Decode($headb64)))
) {
throw new UnexpectedValueException('Invalid segment encoding');
}
if (null === $payload = JWT::jsonDecode(JWT::urlsafeB64Decode($payloadb64))
) {
throw new UnexpectedValueException('Invalid segment encoding');
}
$sig = JWT::urlsafeB64Decode($cryptob64);
if ($verify) {
if (empty($header->alg)) {
throw new DomainException('Empty algorithm');
}
if ($sig != JWT::sign("$headb64.$payloadb64", $key, $header->alg)) {
throw new UnexpectedValueException('Signature verification failed');
}
}
return $payload;
}
/**
* @param object|array $payload PHP object or array
* @param string $key The secret key
* @param string $algo The signing algorithm
*
* @return string A JWT
*/
public static function encode($payload, $key, $algo = 'HS256')
{
$header = array('typ' => 'JWT', 'alg' => $algo);
$segments = array();
$segments[] = JWT::urlsafeB64Encode(JWT::jsonEncode($header));
$segments[] = JWT::urlsafeB64Encode(JWT::jsonEncode($payload));
$signing_input = implode('.', $segments);
$signature = JWT::sign($signing_input, $key, $algo);
$segments[] = JWT::urlsafeB64Encode($signature);
return implode('.', $segments);
}
/**
* @param string $msg The message to sign
* @param string $key The secret key
* @param string $method The signing algorithm
*
* @return string An encrypted message
*/
public static function sign($msg, $key, $method = 'HS256')
{
$methods = array(
'HS256' => 'sha256',
'HS384' => 'sha384',
'HS512' => 'sha512',
);
if (empty($methods[$method])) {
throw new DomainException('Algorithm not supported');
}
return hash_hmac($methods[$method], $msg, $key, true);
}
/**
* @param string $input JSON string
*
* @return object Object representation of JSON string
*/
public static function jsonDecode($input)
{
$obj = json_decode($input);
if (function_exists('json_last_error') && $errno = json_last_error()) {
JWT::handleJsonError($errno);
}
else if ($obj === null && $input !== 'null') {
throw new DomainException('Null result with non-null input');
}
return $obj;
}
/**
* @param object|array $input A PHP object or array
*
* @return string JSON representation of the PHP object or array
*/
public static function jsonEncode($input)
{
$json = json_encode($input);
if (function_exists('json_last_error') && $errno = json_last_error()) {
JWT::handleJsonError($errno);
}
else if ($json === 'null' && $input !== null) {
throw new DomainException('Null result with non-null input');
}
return $json;
}
/**
* @param string $input A base64 encoded string
*
* @return string A decoded string
*/
public static function urlsafeB64Decode($input)
{
$padlen = 4 - strlen($input) % 4;
$input .= str_repeat('=', $padlen);
return base64_decode(strtr($input, '-_', '+/'));
}
/**
* @param string $input Anything really
*
* @return string The base64 encode of what you passed in
*/
public static function urlsafeB64Encode($input)
{
return str_replace('=', '', strtr(base64_encode($input), '+/', '-_'));
}
/**
* @param int $errno An error number from json_last_error()
*
* @return void
*/
private static function handleJsonError($errno)
{
$messages = array(
JSON_ERROR_DEPTH => 'Maximum stack depth exceeded',
JSON_ERROR_CTRL_CHAR => 'Unexpected control character found',
JSON_ERROR_SYNTAX => 'Syntax error, malformed JSON'
);
throw new DomainException(isset($messages[$errno])
? $messages[$errno]
: 'Unknown JSON error: ' . $errno
);
}
}

View file

@ -1,3 +0,0 @@
<?php
class Services_Twilio_HttpException extends ErrorException {}

View file

@ -1,94 +0,0 @@
<?php
/**
* HTTP Stream version of the TinyHttp Client used to connect to Twilio
* services.
*/
class Services_Twilio_HttpStreamException extends ErrorException {}
class Services_Twilio_HttpStream {
private $auth_header = null;
private $uri = null;
private $debug = false;
private static $default_options = array(
"http" => array(
"headers" => "",
"timeout" => 60,
"follow_location" => true,
"ignore_errors" => true,
),
"ssl" => array(),
);
private $options = array();
public function __construct($uri = '', $kwargs = array()) {
$this->uri = $uri;
if (isset($kwargs['debug'])) {
$this->debug = true;
}
if (isset($kwargs['http_options'])) {
$this->options = $kwargs['http_options'] + self::$default_options;
} else {
$this->options = self::$default_options;
}
}
public function __call($name, $args) {
list($res, $req_headers, $req_body) = $args + array(0, array(), '');
$request_options = $this->options;
$url = $this->uri . $res;
if (isset($req_body) && strlen($req_body) > 0) {
$request_options['http']['content'] = $req_body;
}
foreach($req_headers as $key => $value) {
$request_options['http']['header'] .= sprintf("%s: %s\r\n", $key, $value);
}
if (isset($this->auth_header)) {
$request_options['http']['header'] .= $this->auth_header;
}
$request_options['http']['method'] = strtoupper($name);
$request_options['http']['ignore_errors'] = true;
if ($this->debug) {
error_log(var_export($request_options, true));
}
$ctx = stream_context_create($request_options);
$result = file_get_contents($url, false, $ctx);
if (false === $result) {
throw new Services_Twilio_HttpStreamException(
"Unable to connect to service");
}
$status_header = array_shift($http_response_header);
if (1 !== preg_match('#HTTP/\d+\.\d+ (\d+)#', $status_header, $matches)) {
throw new Services_Twilio_HttpStreamException(
"Unable to detect the status code in the HTTP result.");
}
$status_code = intval($matches[1]);
$response_headers = array();
foreach($http_response_header as $header) {
list($key, $val) = explode(":", $header);
$response_headers[trim($key)] = trim($val);
}
return array($status_code, $response_headers, $result);
}
public function authenticate($user, $pass) {
if (isset($user) && isset($pass)) {
$this->auth_header = sprintf("Authorization: Basic %s",
base64_encode(sprintf("%s:%s", $user, $pass)));
} else {
$this->auth_header = null;
}
}
}

View file

@ -1,84 +0,0 @@
<?php
/**
* @category Services
* @package Services_Twilio
* @author Neuman Vong <neuman@twilio.com>
* @license http://creativecommons.org/licenses/MIT/ MIT
* @link http://pear.php.net/package/Services_Twilio
*/
/**
* Abstraction of an instance resource from the Twilio API.
*/
abstract class Services_Twilio_InstanceResource extends Services_Twilio_Resource {
/**
* Make a request to the API to update an instance resource
*
* :param mixed $params: An array of updates, or a property name
* :param mixed $value: A value with which to update the resource
*
* :rtype: null
* :throws: a :php:class:`RestException <Services_Twilio_RestException>` if
* the update fails.
*/
public function update($params, $value = null)
{
if (!is_array($params)) {
$params = array($params => $value);
}
$decamelizedParams = $this->client->createData($this->uri, $params);
$this->updateAttributes($decamelizedParams);
}
/*
* Add all properties from an associative array (the JSON response body) as
* properties on this instance resource, except the URI
*
* :param stdClass $params: An object containing all of the parameters of
* this instance
* :return: Nothing, this is purely side effecting
* :rtype: null
*/
public function updateAttributes($params) {
unset($params->uri);
foreach ($params as $name => $value) {
$this->$name = $value;
}
}
/**
* Get the value of a property on this resource.
*
* Instead of defining all of the properties of an object directly, we rely
* on the API to tell us which properties an object has. This method will
* query the API to retrieve a property for an object, if it is not already
* set on the object.
*
* If the call is to a subresource, eg ``$client->account->messages``, no
* request is made.
*
* To help with lazy HTTP requests, we don't actually retrieve an object
* from the API unless you really need it. Hence, this function may make API
* requests even if the property you're requesting isn't available on the
* resource.
*
* :param string $key: The property name
*
* :return mixed: Could be anything.
* :throws: a :php:class:`RestException <Services_Twilio_RestException>` if
* the update fails.
*/
public function __get($key)
{
if ($subresource = $this->getSubresources($key)) {
return $subresource;
}
if (!isset($this->$key)) {
$params = $this->client->retrieveData($this->uri);
$this->updateAttributes($params);
}
return $this->$key;
}
}

View file

@ -1,203 +0,0 @@
<?php
/**
* @author Neuman Vong neuman@twilio.com
* @license http://creativecommons.org/licenses/MIT/ MIT
* @link http://pear.php.net/package/Services_Twilio
*/
/**
* Abstraction of a list resource from the Twilio API.
*
* The list resource implements the `IteratorAggregate
* <http://php.net/manual/en/class.iteratoraggregate.php>`_ and the `Countable
* <http://php.net/manual/en/class.countable.php>`_ interfaces.
*
*/
abstract class Services_Twilio_ListResource extends Services_Twilio_Resource
implements IteratorAggregate, Countable
{
public function __construct($client, $uri) {
$name = $this->getResourceName(true);
/*
* By default trim the 's' from the end of the list name to get the
* instance name (ex Accounts -> Account). This behavior can be
* overridden by child classes if the rule doesn't work.
*/
if (!isset($this->instance_name)) {
$this->instance_name = "Services_Twilio_Rest_" . rtrim($name, 's');
}
parent::__construct($client, $uri);
}
/**
* Gets a resource from this list.
*
* :param string $sid: The resource SID
* :return: The resource
* :rtype: :php:class:`InstanceResource <Services_Twilio_InstanceResource>`
*/
public function get($sid) {
$instance = new $this->instance_name(
$this->client, $this->uri . "/$sid"
);
// XXX check if this is actually a sid in all cases.
$instance->sid = $sid;
return $instance;
}
/**
* Construct an :php:class:`InstanceResource
* <Services_Twilio_InstanceResource>` with the specified params.
*
* :param array $params: usually a JSON HTTP response from the API
* :return: An instance with properties
* initialized to the values in the params array.
* :rtype: :php:class:`InstanceResource <Services_Twilio_InstanceResource>`
*/
public function getObjectFromJson($params, $idParam = "sid")
{
if (isset($params->{$idParam})) {
$uri = $this->uri . "/" . $params->{$idParam};
} else {
$uri = $this->uri;
}
return new $this->instance_name($this->client, $uri, $params);
}
/**
* Deletes a resource from this list.
*
* :param string $sid: The resource SID
* :rtype: null
*/
public function delete($sid, $params = array())
{
$this->client->deleteData($this->uri . '/' . $sid, $params);
}
/**
* Create a resource on the list and then return its representation as an
* InstanceResource.
*
* :param array $params: The parameters with which to create the resource
*
* :return: The created resource
* :rtype: :php:class:`InstanceResource <Services_Twilio_InstanceResource>`
*/
protected function _create($params)
{
$params = $this->client->createData($this->uri, $params);
/* Some methods like verified caller ID don't return sids. */
if (isset($params->sid)) {
$resource_uri = $this->uri . '/' . $params->sid;
} else {
$resource_uri = $this->uri;
}
return new $this->instance_name($this->client, $resource_uri, $params);
}
/**
* Returns a page of :php:class:`InstanceResources
* <Services_Twilio_InstanceResource>` from this list.
*
* :param int $page: The start page
* :param int $size: Number of items per page
* :param array $filters: Optional filters
* :param string $deep_paging_uri: if provided, the $page and $size
* parameters will be ignored and this URI will be requested directly.
*
* :return: A page of resources
* :rtype: :php:class:`Services_Twilio_Page`
*/
public function getPage(
$page = 0, $size = 50, $filters = array(), $deep_paging_uri = null
) {
$list_name = $this->getResourceName();
if ($deep_paging_uri !== null) {
$page = $this->client->retrieveData($deep_paging_uri, array(), true);
} else {
$page = $this->client->retrieveData($this->uri, array(
'Page' => $page,
'PageSize' => $size,
) + $filters);
}
/* create a new PHP object for each json obj in the api response. */
$page->$list_name = array_map(
array($this, 'getObjectFromJson'),
$page->$list_name
);
if (isset($page->next_page_uri)) {
$next_page_uri = $page->next_page_uri;
} else {
$next_page_uri = null;
}
return new Services_Twilio_Page($page, $list_name, $next_page_uri);
}
/**
* Get the total number of instances for this list.
*
* This will make one HTTP request to retrieve the total, every time this
* method is called.
*
* If the total is not set, or an Exception was thrown, returns 0
*
* :return: The total number of instance members
* :rtype: integer
*/
public function count() {
try {
$page = $this->getPage(0, 1);
return $page ? (int)$page->total : 0;
} catch (Exception $e) {
return 0;
}
}
/**
* Returns an iterable list of
* :php:class:`instance resources <Services_Twilio_InstanceResource>`.
*
* :param int $page: The start page
* :param int $size: Number of items per page
* :param array $filters: Optional filters.
* The filter array can accept full datetimes when StartTime or DateCreated
* are used. Inequalities should be within the key portion of the array and
* multiple filter parameters can be combined for more specific searches.
*
* .. code-block:: php
*
* array('DateCreated>' => '2011-07-05 08:00:00', 'DateCreated<' => '2011-08-01')
*
* .. code-block:: php
*
* array('StartTime<' => '2011-07-05 08:00:00')
*
* :return: An iterator
* :rtype: :php:class:`Services_Twilio_AutoPagingIterator`
*/
public function getIterator(
$page = 0, $size = 50, $filters = array()
) {
return new Services_Twilio_AutoPagingIterator(
array($this, 'getPageGenerator'), $page, $size, $filters
);
}
/**
* Retrieve a new page of API results, and update iterator parameters. This
* function is called by the paging iterator to retrieve a new page and
* shouldn't be called directly.
*/
public function getPageGenerator(
$page, $size, $filters = array(), $deep_paging_uri = null
) {
return $this->getPage($page, $size, $filters, $deep_paging_uri);
}
}

View file

@ -1,35 +0,0 @@
<?php
class Services_Twilio_NumberType extends Services_Twilio_ListResource
{
public function getResourceName($camelized = false) {
$this->instance_name = 'Services_Twilio_Rest_IncomingPhoneNumber';
return $camelized ? 'IncomingPhoneNumbers' : 'incoming_phone_numbers';
}
/**
* Purchase a new phone number.
*
* Example usage:
*
* .. code-block:: php
*
* $marlosBurner = '+14105551234';
* $client->account->incoming_phone_numbers->local->purchase($marlosBurner);
*
* :param string $phone_number: The phone number to purchase
* :param array $params: An optional array of parameters to pass along with
* the request (to configure the phone number)
*/
public function purchase($phone_number, array $params = array()) {
$postParams = array(
'PhoneNumber' => $phone_number
);
return $this->create($postParams + $params);
}
public function create(array $params = array()) {
return parent::_create($params);
}
}

View file

@ -1,68 +0,0 @@
<?php
/**
* A representation of a page of resources.
*
* @category Services
* @package Services_Twilio
* @author Neuman Vong <neuman@twilio.com>
* @license http://creativecommons.org/licenses/MIT/ MIT
* @link http://pear.php.net/package/Services_Twilio
*/
class Services_Twilio_Page
implements IteratorAggregate
{
/**
* The item list.
*
* @var array $items
*/
protected $items;
/**
* Constructs a page.
*
* @param object $page The page object
* @param string $name The key of the item list
*/
public function __construct($page, $name, $next_page_uri = null)
{
$this->page = $page;
$this->items = $page->{$name};
$this->next_page_uri = $next_page_uri;
}
/**
* The item list of the page.
*
* @return array A list of instance resources
*/
public function getItems()
{
return $this->items;
}
/**
* Magic method to allow retrieving the properties of the wrapped page.
*
* @param string $prop The property name
*
* @return mixed Could be anything
*/
public function __get($prop)
{
return $this->page->$prop;
}
/**
* Implementation of IteratorAggregate::getIterator().
*
* @return Traversable
*/
public function getIterator()
{
return $this->getItems();
}
}

View file

@ -1,41 +0,0 @@
<?php
/**
* Helper class to wrap an object with a modified interface created by
* a partial application of its existing methods.
*
* @category Services
* @package Services_Twilio
* @author Neuman Vong <neuman@twilio.com>
* @license http://creativecommons.org/licenses/MIT/ MIT
* @link http://pear.php.net/package/Services_Twilio
*/
class Services_Twilio_PartialApplicationHelper
{
private $callbacks;
public function __construct()
{
$this->callbacks = array();
}
public function set($method, $callback, array $args)
{
if (!is_callable($callback)) {
return FALSE;
}
$this->callbacks[$method] = array($callback, $args);
}
public function __call($method, $args)
{
if (!isset($this->callbacks[$method])) {
throw new Exception("Method not found: $method");
}
list($callback, $cb_args) = $this->callbacks[$method];
return call_user_func_array(
$callback,
array_merge($cb_args, $args)
);
}
}

View file

@ -1,36 +0,0 @@
<?php
class Services_Twilio_RequestValidator
{
protected $AuthToken;
function __construct($token)
{
$this->AuthToken = $token;
}
public function computeSignature($url, $data = array())
{
// sort the array by keys
ksort($data);
// append them to the data string in order
// with no delimiters
foreach($data as $key => $value)
$url .= "$key$value";
// This function calculates the HMAC hash of the data with the key
// passed in
// Note: hash_hmac requires PHP 5 >= 5.1.2 or PECL hash:1.1-1.5
// Or http://pear.php.net/package/Crypt_HMAC/
return base64_encode(hash_hmac("sha1", $url, $this->AuthToken, true));
}
public function validate($expectedSignature, $url, $data = array())
{
return $this->computeSignature($url, $data)
== $expectedSignature;
}
}

View file

@ -1,134 +0,0 @@
<?php
/**
* Abstraction of a Twilio resource.
*
* @category Services
* @package Services_Twilio
* @author Neuman Vong <neuman@twilio.com>
* @license http://creativecommons.org/licenses/MIT/ MIT
* @link http://pear.php.net/package/Services_Twilio
*/
abstract class Services_Twilio_Resource {
protected $subresources;
public function __construct($client, $uri, $params = array())
{
$this->subresources = array();
$this->client = $client;
foreach ($params as $name => $param) {
$this->$name = $param;
}
$this->uri = $uri;
$this->init($client, $uri);
}
protected function init($client, $uri)
{
// Left empty for derived classes to implement
}
public function getSubresources($name = null) {
if (isset($name)) {
return isset($this->subresources[$name])
? $this->subresources[$name]
: null;
}
return $this->subresources;
}
protected function setupSubresources()
{
foreach (func_get_args() as $name) {
$constantized = ucfirst(self::camelize($name));
$type = "Services_Twilio_Rest_" . $constantized;
$this->subresources[$name] = new $type(
$this->client, $this->uri . "/$constantized"
);
}
}
/*
* Get the resource name from the classname
*
* Ex: Services_Twilio_Rest_Accounts -> Accounts
*
* @param boolean $camelized Whether to return camel case or not
*/
public function getResourceName($camelized = false)
{
$name = get_class($this);
$parts = explode('_', $name);
$basename = end($parts);
if ($camelized) {
return $basename;
} else {
return self::decamelize($basename);
}
}
public static function decamelize($word)
{
$callback = create_function('$matches',
'return strtolower(strlen("$matches[1]") ? "$matches[1]_$matches[2]" : "$matches[2]");');
return preg_replace_callback(
'/(^|[a-z])([A-Z])/',
$callback,
$word
);
}
/**
* Return camelized version of a word
* Examples: sms_messages => SMSMessages, calls => Calls,
* incoming_phone_numbers => IncomingPhoneNumbers
*
* @param string $word The word to camelize
* @return string
*/
public static function camelize($word) {
$callback = create_function('$matches', 'return strtoupper("$matches[2]");');
return preg_replace_callback('/(^|_)([a-z])/',
$callback,
$word);
}
/**
* Get the value of a property on this resource.
*
* @param string $key The property name
* @return mixed Could be anything.
*/
public function __get($key) {
if ($subresource = $this->getSubresources($key)) {
return $subresource;
}
return $this->$key;
}
/**
* Print a JSON representation of this object. Strips the HTTP client
* before returning.
*
* Note, this should mainly be used for debugging, and is not guaranteed
* to correspond 1:1 with the JSON API output.
*
* Note that echoing an object before an HTTP request has been made to
* "fill in" its properties may return an empty object
*/
public function __toString() {
$out = array();
foreach ($this as $key => $value) {
if ($key !== 'client' && $key !== 'subresources') {
$out[$key] = $value;
}
}
return json_encode($out, true);
}
}

View file

@ -1,33 +0,0 @@
<?php
class Services_Twilio_Rest_Account extends Services_Twilio_InstanceResource {
protected function init($client, $uri) {
$this->setupSubresources(
'applications',
'available_phone_numbers',
'outgoing_caller_ids',
'calls',
'conferences',
'incoming_phone_numbers',
'media',
'messages',
'notifications',
'outgoing_callerids',
'recordings',
'sms_messages',
'short_codes',
'transcriptions',
'connect_apps',
'authorized_connect_apps',
'usage_records',
'usage_triggers',
'queues',
'sip'
);
$this->sandbox = new Services_Twilio_Rest_Sandbox(
$client, $uri . '/Sandbox'
);
}
}

View file

@ -1,25 +0,0 @@
<?php
/**
* For more information, see the `Account List Resource
* <http://www.twilio.com/docs/api/rest/account#list>`_ documentation.
*/
class Services_Twilio_Rest_Accounts extends Services_Twilio_ListResource {
/**
* Create a new subaccount.
*
* :param array $params: An array of parameters describing the new
* subaccount. The ``$params`` array can contain the following keys:
*
* *FriendlyName*
* A description of this account, up to 64 characters long
*
* :returns: The new subaccount
* :rtype: :php:class:`Services_Twilio_Rest_Account`
*
*/
public function create($params = array()) {
return parent::_create($params);
}
}

View file

@ -1,6 +0,0 @@
<?php
class Services_Twilio_Rest_Application
extends Services_Twilio_InstanceResource
{
}

View file

@ -1,12 +0,0 @@
<?php
class Services_Twilio_Rest_Applications
extends Services_Twilio_ListResource
{
public function create($name, array $params = array())
{
return parent::_create(array(
'FriendlyName' => $name
) + $params);
}
}

View file

@ -1,6 +0,0 @@
<?php
class Services_Twilio_Rest_AuthorizedConnectApp
extends Services_Twilio_InstanceResource
{
}

View file

@ -1,10 +0,0 @@
<?php
class Services_Twilio_Rest_AuthorizedConnectApps
extends Services_Twilio_ListResource
{
public function create($name, array $params = array())
{
throw new BadMethodCallException('Not allowed');
}
}

View file

@ -1,7 +0,0 @@
<?php
class Services_Twilio_Rest_AvailablePhoneNumber
extends Services_Twilio_InstanceResource
{
}

View file

@ -1,54 +0,0 @@
<?php
class Services_Twilio_Rest_AvailablePhoneNumbers
extends Services_Twilio_ListResource
{
public function getLocal($country) {
$curried = new Services_Twilio_PartialApplicationHelper();
$curried->set(
'getList',
array($this, 'getList'),
array($country, 'Local')
);
return $curried;
}
public function getTollFree($country) {
$curried = new Services_Twilio_PartialApplicationHelper();
$curried->set(
'getList',
array($this, 'getList'),
array($country, 'TollFree')
);
return $curried;
}
public function getMobile($country)
{
$curried = new Services_Twilio_PartialApplicationHelper();
$curried->set(
'getList',
array($this, 'getList'),
array($country, 'Mobile')
);
return $curried;
}
/**
* Get a list of available phone numbers.
*
* @param string $country The 2-digit country code you'd like to search for
* numbers e.g. ('US', 'CA', 'GB')
* @param string $type The type of number ('Local', 'TollFree', or 'Mobile')
* @return object The object representation of the resource
*/
public function getList($country, $type, array $params = array())
{
return $this->client->retrieveData($this->uri . "/$country/$type", $params);
}
public function getResourceName($camelized = false) {
// You can't page through the list of available phone numbers.
$this->instance_name = 'Services_Twilio_Rest_AvailablePhoneNumber';
return $camelized ? 'Countries' : 'countries';
}
}

View file

@ -1,105 +0,0 @@
<?php
/**
* For more information, see the `Call Instance Resource <http://www.twilio.com/docs/api/rest/call#instance>`_ documentation.
*
* .. php:attr:: sid
*
* A 34 character string that uniquely identifies this resource.
*
* .. php:attr:: parent_call_sid
*
* A 34 character string that uniquely identifies the call that created this leg.
*
* .. php:attr:: date_created
*
* The date that this resource was created, given as GMT in RFC 2822 format.
*
* .. php:attr:: date_updated
*
* The date that this resource was last updated, given as GMT in RFC 2822 format.
*
* .. php:attr:: account_sid
*
* The unique id of the Account responsible for creating this call.
*
* .. php:attr:: to
*
* The phone number that received this call. e.g., +16175551212 (E.164 format)
*
* .. php:attr:: from
*
* The phone number that made this call. e.g., +16175551212 (E.164 format)
*
* .. php:attr:: phone_number_sid
*
* If the call was inbound, this is the Sid of the IncomingPhoneNumber that
* received the call. If the call was outbound, it is the Sid of the
* OutgoingCallerId from which the call was placed.
*
* .. php:attr:: status
*
* A string representing the status of the call. May be `QUEUED`, `RINGING`,
* `IN-PROGRESS`, `COMPLETED`, `FAILED`, `BUSY` or `NO_ANSWER`.
*
* .. php:attr:: stat_time
*
* The start time of the call, given as GMT in RFC 2822 format. Empty if the call has not yet been dialed.
*
* .. php:attr:: end_time
*
* The end time of the call, given as GMT in RFC 2822 format. Empty if the call did not complete successfully.
*
* .. php:attr:: duration
*
* The length of the call in seconds. This value is empty for busy, failed, unanswered or ongoing calls.
*
* .. php:attr:: price
*
* The charge for this call in USD. Populated after the call is completed. May not be immediately available.
*
* .. php:attr:: direction
*
* A string describing the direction of the call. inbound for inbound
* calls, outbound-api for calls initiated via the REST API or
* outbound-dial for calls initiated by a <Dial> verb.
*
* .. php:attr:: answered_by
*
* If this call was initiated with answering machine detection, either human or machine. Empty otherwise.
*
* .. php:attr:: forwarded_from
*
* If this call was an incoming call forwarded from another number, the
* forwarding phone number (depends on carrier supporting forwarding).
* Empty otherwise.
*
* .. php:attr:: caller_name
*
* If this call was an incoming call from a phone number with Caller ID Lookup enabled, the caller's name. Empty otherwise.
*/
class Services_Twilio_Rest_Call extends Services_Twilio_InstanceResource {
/**
* Hang up the call
*/
public function hangup() {
$this->update('Status', 'completed');
}
/**
* Redirect the call to a new URL
*
* :param string $url: the new URL to retrieve call flow from.
*/
public function route($url) {
$this->update('Url', $url);
}
protected function init($client, $uri) {
$this->setupSubresources(
'notifications',
'recordings'
);
}
}

View file

@ -1,27 +0,0 @@
<?php
class Services_Twilio_Rest_Calls
extends Services_Twilio_ListResource
{
public static function isApplicationSid($value)
{
return strlen($value) == 34
&& !(strpos($value, "AP") === false);
}
public function create($from, $to, $url, array $params = array())
{
$params["To"] = $to;
$params["From"] = $from;
if (self::isApplicationSid($url)) {
$params["ApplicationSid"] = $url;
} else {
$params["Url"] = $url;
}
return parent::_create($params);
}
}

View file

@ -1,12 +0,0 @@
<?php
class Services_Twilio_Rest_Conference
extends Services_Twilio_InstanceResource
{
protected function init($client, $uri)
{
$this->setupSubresources(
'participants'
);
}
}

View file

@ -1,6 +0,0 @@
<?php
class Services_Twilio_Rest_Conferences
extends Services_Twilio_ListResource
{
}

View file

@ -1,6 +0,0 @@
<?php
class Services_Twilio_Rest_ConnectApp
extends Services_Twilio_InstanceResource
{
}

View file

@ -1,10 +0,0 @@
<?php
class Services_Twilio_Rest_ConnectApps
extends Services_Twilio_ListResource
{
public function create($name, array $params = array())
{
throw new BadMethodCallException('Not allowed');
}
}

View file

@ -1,30 +0,0 @@
<?php
/**
* A single Credential
*
* .. php:attr:: date_created
*
* The date the Credential was created
*
* .. php:attr:: date_updated
*
* The date the Credential was updated
*
* .. php:attr:: sid
*
* A 34 character string that identifies this object
*
* .. php:attr:: account_sid
*
* The account that created this credential
*
* .. php:attr:: username
*
* The username of this Credential object
*
* .. php:attr:: uri
*
* The uri of this Credential object
*/
class Services_Twilio_Rest_Credential extends Services_Twilio_InstanceResource { }

View file

@ -1,42 +0,0 @@
<?php
/**
* A single CredentialList
*
* .. php:attr:: date_created
*
* The date the credential list was created
*
* .. php:attr:: date_updated
*
* The date the credential list was updated
*
* .. php:attr:: sid
*
* A 34 character string that identifies this object
*
* .. php:attr:: account_sid
*
* The account that created the credential list
*
* .. php:attr:: friendly_name
*
* The friendly name of the credential list
*
* .. php:attr:: uri
*
* The uri of the credential list
*
* .. php:attr:: subresource_uris
*
* The subresources associated with this credential list (Credentials)
*/
class Services_Twilio_Rest_CredentialList extends Services_Twilio_InstanceResource {
protected function init($client, $uri) {
$this->setupSubresources(
'credentials'
);
}
}

View file

@ -1,37 +0,0 @@
<?php
/**
* A single CredentialListMapping
*
* .. php:attr:: date_created
*
* The date this mapping was created
*
* .. php:attr:: date_updated
*
* The date this mapping was updated
*
* .. php:attr:: sid
*
* The sid of this mapping
*
* .. php:attr:: friendly_name
*
* The friendly name of this mapping
*
* .. php:attr:: uri
*
* The uri of this mapping
*
* .. php:attr:: subresource_uris
*
* The subresources associated with this mapping (Credentials)
*/
class Services_Twilio_Rest_CredentialListMapping extends Services_Twilio_InstanceResource {
protected function init($client, $uri) {
$this->setupSubresources(
'credentials'
);
}
}

View file

@ -1,24 +0,0 @@
<?php
class Services_Twilio_Rest_CredentialListMappings extends Services_Twilio_SIPListResource {
/**
* Creates a new CredentialListMapping instance
*
* Example usage:
*
* .. code-block:: php
*
* $client->account->sip->domains->get('SDXXX')->credential_list_mappings->create("CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
*
* :param string $credential_list_sid: the sid of the CredentialList you're adding to this domain.
* :param array $params: a single array of parameters which is serialized and
* sent directly to the Twilio API.
*/
public function create($credential_list_sid, $params = array()) {
return parent::_create(array(
'CredentialListSid' => $credential_list_sid,
) + $params);
}
}

View file

@ -1,24 +0,0 @@
<?php
class Services_Twilio_Rest_CredentialLists extends Services_Twilio_SIPListResource {
/**
* Creates a new CredentialList instance
*
* Example usage:
*
* .. code-block:: php
*
* $client->account->sip->credential_lists->create("MyFriendlyName");
*
* :param string $friendly_name: the friendly name of this credential list
* :param array $params: a single array of parameters which is serialized and
* sent directly to the Twilio API.
*/
public function create($friendly_name, $params = array()) {
return parent::_create(array(
'FriendlyName' => $friendly_name,
) + $params);
}
}

View file

@ -1,28 +0,0 @@
<?php
class Services_Twilio_Rest_Credentials extends Services_Twilio_SIPListResource {
/**
* Creates a new Credential instance
*
* Example usage:
*
* .. code-block:: php
*
* $client->account->sip->credential_lists->get('CLXXX')->credentials->create(
* "AwesomeUsername", "SuperSecretPassword",
* );
*
* :param string $username: the username for the new Credential object
* :param string $password: the password for the new Credential object
* :param array $params: a single array of parameters which is serialized and
* sent directly to the Twilio API.
*/
public function create($username, $password, $params = array()) {
return parent::_create(array(
'Username' => $username,
'Password' => $password,
) + $params);
}
}

View file

@ -1,70 +0,0 @@
<?php
/**
* A single Domain
*
* .. php:attr:: date_created
*
* The date the domain was created
*
* .. php:attr:: date_updated
*
* The date the domain was updated
*
* .. php:attr:: sid
*
* A 34 character string that identifies this object
*
* .. php:attr:: account_sid
*
* The account that created the domain
*
* .. php:attr:: friendly_name
*
* The friendly name of the domain
*
* .. php:attr:: domain_name
*
* The *.sip.twilio domain for the domain
*
* .. php:attr:: auth_type
*
* The auth type used for the domain
*
* .. php:attr:: voice_url
*
* The voice url for the domain
*
* .. php:attr:: voice_fallback_url
*
* The voice fallback url for the domain
*
* .. php:attr:: voice_fallback_method
*
* The voice fallback method for the domain
*
* .. php:attr:: voice_status_callback_url
*
* The voice status callback url for the domain
*
* .. php:attr:: voice_status_callback_method
*
* The voice status_callback_method for the domain
*
* .. php:attr:: uri
*
* The uri of the domain
*
* .. php:attr:: subresource_uris
*
* The subresources associated with this domain (IpAccessControlListMappings, CredentialListMappings)
*
*/
class Services_Twilio_Rest_Domain extends Services_Twilio_InstanceResource {
protected function init($client, $uri) {
$this->setupSubresources(
'ip_access_control_list_mappings',
'credential_list_mappings'
);
}
}

View file

@ -1,28 +0,0 @@
<?php
class Services_Twilio_Rest_Domains extends Services_Twilio_SIPListResource {
/**
* Creates a new Domain instance
*
* Example usage:
*
* .. code-block:: php
*
* $client->account->sip->domains->create(
* "MyFriendlyName", "MyDomainName"
* );
*
* :param string $friendly_name: the friendly name of this domain
* :param string $domain_name: the domain name for this domain
* :param array $params: a single array of parameters which is serialized and
* sent directly to the Twilio API.
*/
public function create($friendly_name, $domain_name, $params = array()) {
return parent::_create(array(
'FriendlyName' => $friendly_name,
'DomainName' => $domain_name,
) + $params);
}
}

View file

@ -1,91 +0,0 @@
<?php
/**
* An object representing a single phone number. For more
* information, see the `IncomingPhoneNumber Instance Resource
* <http://www.twilio.com/docs/api/rest/incoming-phone-numbers#instance>`_
* documentation.
*
* .. php:attr:: sid
*
* A 34 character string that uniquely idetifies this resource.
*
* .. php:attr:: date_created
*
* The date that this resource was created, given as GMT RFC 2822 format.
*
* .. php:attr:: date_updated
*
* The date that this resource was last updated, given as GMT RFC 2822 format.
*
* .. php:attr:: friendly_name
*
* A human readable descriptive text for this resource, up to 64
* characters long. By default, the FriendlyName is a nicely formatted
* version of the phone number.
*
* .. php:attr:: account_sid
*
* The unique id of the Account responsible for this phone number.
*
* .. php:attr:: phone_number
*
* The incoming phone number. e.g., +16175551212 (E.164 format)
*
* .. php:attr:: api_version
*
* Calls to this phone number will start a new TwiML session with this
* API version.
*
* .. php:attr:: voice_caller_id_lookup
*
* Look up the caller's caller-ID name from the CNAM database (additional charges apply). Either true or false.
*
* .. php:attr:: voice_url
*
* The URL Twilio will request when this phone number receives a call.
*
* .. php:attr:: voice_method
*
* The HTTP method Twilio will use when requesting the above Url. Either GET or POST.
*
* .. php:attr:: voice_fallback_url
*
* The URL that Twilio will request if an error occurs retrieving or executing the TwiML requested by Url.
*
* .. php:attr:: voice_fallback_method
*
* The HTTP method Twilio will use when requesting the VoiceFallbackUrl. Either GET or POST.
*
* .. php:attr:: status_callback
*
* The URL that Twilio will request to pass status parameters (such as call ended) to your application.
*
* .. php:attr:: status_callback_method
*
* The HTTP method Twilio will use to make requests to the StatusCallback URL. Either GET or POST.
*
* .. php:attr:: sms_url
*
* The URL Twilio will request when receiving an incoming SMS message to this number.
*
* .. php:attr:: sms_method
*
* The HTTP method Twilio will use when making requests to the SmsUrl. Either GET or POST.
*
* .. php:attr:: sms_fallback_url
*
* The URL that Twilio will request if an error occurs retrieving or executing the TwiML from SmsUrl.
*
* .. php:attr:: sms_fallback_method
*
* The HTTP method Twilio will use when requesting the above URL. Either GET or POST.
*
* .. php:attr:: uri
*
* The URI for this resource, relative to https://api.twilio.com.
*/
class Services_Twilio_Rest_IncomingPhoneNumber
extends Services_Twilio_InstanceResource
{
}

View file

@ -1,59 +0,0 @@
<?php
/**
* For more information, see the
* `IncomingPhoneNumbers API Resource
* <http://www.twilio.com/docs/api/rest/incoming-phone-numbers#local>`_
* documentation at twilio.com.
*/
class Services_Twilio_Rest_IncomingPhoneNumbers extends Services_Twilio_ListResource {
function init($client, $uri) {
$this->setupSubresources(
'local',
'toll_free',
'mobile'
);
}
function create(array $params = array()) {
return parent::_create($params);
}
function getList($type, array $params = array())
{
return $this->client->retrieveData($this->uri . "/$type", $params);
}
/**
* Return a phone number instance from its E.164 representation. If more
* than one number matches the search string, returns the first one.
*
* Example usage:
*
* .. code-block:: php
*
* $number = $client->account->incoming_phone_numbers->getNumber('+14105551234');
* echo $number->sid;
*
* :param string $number: The number in E.164 format, eg "+684105551234"
* :return: A :php:class:`Services_Twilio_Rest_IncomingPhoneNumber` object, or null
* :raises: a A :php:class:`Services_Twilio_RestException` if the number is
* invalid, not provided in E.164 format or for any other API exception.
*/
public function getNumber($number) {
$page = $this->getPage(0, 1, array(
'PhoneNumber' => $number
));
$items = $page->getItems();
if (is_null($items) || empty($items)) {
return null;
}
return $items[0];
}
}
class Services_Twilio_Rest_Local extends Services_Twilio_NumberType { }
class Services_Twilio_Rest_Mobile extends Services_Twilio_NumberType { }
class Services_Twilio_Rest_TollFree extends Services_Twilio_NumberType { }

View file

@ -1,40 +0,0 @@
<?php
/**
* A single IpAccessControlList
*
* .. php:attr:: date_created
*
* The date the ip access control list was created
*
* .. php:attr:: date_updated
*
* The date the ip access control list was updated
*
* .. php:attr:: sid
*
* A 34 character string that identifies this object
*
* .. php:attr:: account_sid
*
* The account that created the ip access control list
*
* .. php:attr:: friendly_name
*
* The friendly name of the ip access control list
*
* .. php:attr:: uri
*
* The uri of the ip access control list
*
* .. php:attr:: subresource_uris
*
* The subresources associated with this ip access control list (IpAddresses)
*/
class Services_Twilio_Rest_IpAccessControlList extends Services_Twilio_InstanceResource {
protected function init($client, $uri) {
$this->setupSubresources(
'ip_addresses'
);
}
}

View file

@ -1,37 +0,0 @@
<?php
/**
* A single IpAccessControlListMapping
*
* .. php:attr:: date_created
*
* The date this mapping was created
*
* .. php:attr:: date_updated
*
* The date this mapping was updated
*
* .. php:attr:: sid
*
* The sid of this mapping
*
* .. php:attr:: friendly_name
*
* The friendly name of this mapping
*
* .. php:attr:: uri
*
* The uri of this mapping
*
* .. php:attr:: subresource_uris
*
* The subresources associated with this mapping (IpAddresses)
*/
class Services_Twilio_Rest_IpAccessControlListMapping extends Services_Twilio_InstanceResource {
protected function init($client, $uri) {
$this->setupSubresources(
'ip_addresses'
);
}
}

View file

@ -1,25 +0,0 @@
<?php
class Services_Twilio_Rest_IpAccessControlListMappings extends Services_Twilio_SIPListResource {
/**
* Creates a new IpAccessControlListMapping instance
*
* Example usage:
*
* .. code-block:: php
*
* $client->account->sip->domains->get('SDXXX')->ip_access_control_list_mappings->create("ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
*
* :param string $ip_access_control_list_sid: the sid of the IpAccessControList
* you're adding to this domain.
* :param array $params: a single array of parameters which is serialized and
* sent directly to the Twilio API.
*/
public function create($ip_access_control_list_sid, $params = array()) {
return parent::_create(array(
'IpAccessControlListSid' => $ip_access_control_list_sid,
) + $params);
}
}

View file

@ -1,27 +0,0 @@
<?php
class Services_Twilio_Rest_IpAccessControlLists extends Services_Twilio_SIPListResource {
/**
* Creates a new IpAccessControlLists instance
*
* Example usage:
*
* .. code-block:: php
*
* $client->account->sip->ip_access_control_lists->create("MyFriendlyName");
*
* :param string $friendly_name: the friendly name of this ip access control list
* :param array $params: a single array of parameters which is serialized and
* sent directly to the Twilio API.
* :return: the created list
* :rtype: :class:`Services_Twilio_Rest_IpAccessControlList`
*
*/
public function create($friendly_name, $params = array()) {
return parent::_create(array(
'FriendlyName' => $friendly_name,
) + $params);
}
}

View file

@ -1,34 +0,0 @@
<?php
/**
* A single IpAddress
*
* .. php:attr:: date_created
*
* The date the IpAddress was created
*
* .. php:attr:: date_updated
*
* The date the IpAddress was updated
*
* .. php:attr:: sid
*
* A 34 character string that identifies this object
*
* .. php:attr:: account_sid
*
* The account that created this credential
*
* .. php:attr:: friendly_name
*
* The friendly name of the IpAddress
*
* .. php:attr:: ip_address
*
* The ip address of this IpAddress object
*
* .. php:attr:: uri
*
* The uri of this IpAddress object
*/
class Services_Twilio_Rest_IpAddress extends Services_Twilio_InstanceResource { }

View file

@ -1,33 +0,0 @@
<?php
class Services_Twilio_Rest_IpAddresses extends Services_Twilio_SIPListResource {
public function __construct($client, $uri) {
$this->instance_name = "Services_Twilio_Rest_IpAddress";
parent::__construct($client, $uri);
}
/**
* Creates a new IpAddress instance
*
* Example usage:
*
* .. code-block:: php
*
* $client->account->sip->ip_access_control_lists->get('ALXXX')->ip_addresses->create(
* "FriendlyName", "127.0.0.1"
* );
*
* :param string $friendly_name: the friendly name for the new IpAddress object
* :param string $ip_address: the ip address for the new IpAddress object
* :param array $params: a single array of parameters which is serialized and
* sent directly to the Twilio API.
*/
public function create($friendly_name, $ip_address, $params = array()) {
return parent::_create(array(
'FriendlyName' => $friendly_name,
'IpAddress' => $ip_address,
) + $params);
}
}

View file

@ -1,31 +0,0 @@
<?php
/**
* A list of :class:`Media <Services_Twilio_Rest_MediaInstance>` objects.
* For the definitive reference, see the `Twilio Media List Documentation
* <https://www.twilio.com/docs/api/rest/media>`_.
*/
class Services_Twilio_Rest_Media extends Services_Twilio_ListResource {
// This is overridden because the list key in the Twilio response
// is "media_list", not "media".
public function getResourceName($camelized = false)
{
if ($camelized) {
return "MediaList";
} else {
return "media_list";
}
}
// We manually set the instance name here so that the parent
// constructor doesn't attempt to figure out it. It would do it
// incorrectly because we override getResourceName above.
public function __construct($client, $uri) {
$this->instance_name = "Services_Twilio_Rest_MediaInstance";
parent::__construct($client, $uri);
}
}

View file

@ -1,37 +0,0 @@
<?php
/**
* A single Media object. For the definitive reference, see the `Twilio Media
* Documentation <https://www.twilio.com/docs/api/rest/media>`_.
*
* .. php:attr:: sid
*
* A 34 character string that identifies this object
*
* .. php:attr:: account_sid
*
* A 34 character string representing the account that sent the message
*
* .. php:attr:: parent_sid
*
* The sid of the message that created this media.
*
* .. php:attr:: date_created
*
* The date the message was created
*
* .. php:attr:: date_updated
*
* The date the message was updated
*
* .. php:attr:: content_type
*
* The content-type of the media.
*/
class Services_Twilio_Rest_MediaInstance extends Services_Twilio_InstanceResource {
public function __construct($client, $uri) {
$uri = str_replace('MediaInstance', 'Media', $uri);
parent::__construct($client, $uri);
}
}

View file

@ -1,22 +0,0 @@
<?php
class Services_Twilio_Rest_Member
extends Services_Twilio_InstanceResource
{
/**
* Dequeue this member
*
* @param string $url The Twiml URL to play for this member, after
* dequeueing them
* @param string $method The HTTP method to use when fetching the Twiml
* URL. Defaults to POST.
* @return Services_Twilio_Rest_Member The dequeued member
*/
public function dequeue($url, $method = 'POST') {
return self::update(array(
'Url' => $url,
'Method' => $method,
));
}
}

View file

@ -1,28 +0,0 @@
<?php
class Services_Twilio_Rest_Members
extends Services_Twilio_ListResource
{
/**
* Return the member at the front of the queue. Note that any operations
* performed on the Member returned from this function will use the /Front
* Uri, not the Member's CallSid.
*
* @return Services_Twilio_Rest_Member The member at the front of the queue
*/
public function front() {
return new $this->instance_name($this->client, $this->uri . '/Front');
}
/* Participants are identified by CallSid, not like ME123 */
public function getObjectFromJson($params, $idParam = 'sid') {
return parent::getObjectFromJson($params, 'call_sid');
}
public function getResourceName($camelized = false)
{
// The JSON property name is atypical.
return $camelized ? 'Members' : 'queue_members';
}
}

View file

@ -1,53 +0,0 @@
<?php
/**
* A single Message
*
* .. php:attr:: date_created
*
* The date the message was created
*
* .. php:attr:: date_updated
*
* The date the message was updated
*
* .. php:attr:: sid
*
* A 34 character string that identifies this object
*
* .. php:attr:: account_sid
*
* The account that sent the message
*
* .. php:attr:: body
*
* The body of the message
*
* .. php:attr:: num_segments
*
* The number of sms messages used to deliver the body
*
* .. php:attr:: num_media
*
* The number of media that are associated with the image
*
* .. php:attr:: subresource_uris
*
* The subresources associated with this message (just Media at the moment)
*
* .. php:attr:: from
*
* The number this message was sent from
*
* .. php:attr:: to
*
* The phone number this message was sent to
*/
class Services_Twilio_Rest_Message extends Services_Twilio_InstanceResource {
protected function init($client, $uri) {
$this->setupSubresources(
'media'
);
}
}

View file

@ -1,73 +0,0 @@
<?php
class Services_Twilio_Rest_Messages extends Services_Twilio_ListResource {
/**
* Create a new Message instance
*
* Example usage:
*
* .. code-block:: php
*
* $client->account->messages->create(array(
* "Body" => "foo",
* "From" => "+14105551234",
* "To" => "+14105556789",
* ));
*
* :param array $params: a single array of parameters which is serialized and
* sent directly to the Twilio API. You may find it easier to use the
* sendMessage helper instead of this function.
*
*/
public function create($params = array()) {
return parent::_create($params);
}
/**
* Send a message
*
* .. code-block:: php
*
* $client = new Services_Twilio('AC123', '123');
* $message = $client->account->messages->sendMessage(
* '+14105551234', // From a Twilio number in your account
* '+14105556789', // Text any number
* 'Come at the king, you best not miss.' // Message body (if any)
* array('https://demo.twilio.com/owl.png'), // An array of MediaUrls
* );
*
* :param string $from: the from number for the message, this must be a
* number you purchased from Twilio
* :param string $to: the message recipient's phone number
* :param $mediaUrls: the URLs of images to send in this MMS
* :type $mediaUrls: null (don't include media), a single URL, or an array
* of URLs to send as media with this message
* :param string $body: the text to include along with this MMS
* :param array $params: Any additional params (callback, etc) you'd like to
* send with this request, these are serialized and sent as POST
* parameters
*
* :return: The created :class:`Services_Twilio_Rest_Message`
* :raises: :class:`Services_Twilio_RestException`
* An exception if the parameters are invalid (for example, the from
* number is not a Twilio number registered to your account, or is
* unable to send MMS)
*/
public function sendMessage($from, $to, $body = null, $mediaUrls = null,
$params = array()
) {
$postParams = array(
'From' => $from,
'To' => $to,
);
// When the request is made, this will get serialized into MediaUrl=a&MediaUrl=b
if (!is_null($mediaUrls)) {
$postParams['MediaUrl'] = $mediaUrls;
}
if (!is_null($body)) {
$postParams['Body'] = $body;
}
return self::create($postParams + $params);
}
}

View file

@ -1,6 +0,0 @@
<?php
class Services_Twilio_Rest_Notification
extends Services_Twilio_InstanceResource
{
}

View file

@ -1,6 +0,0 @@
<?php
class Services_Twilio_Rest_Notifications
extends Services_Twilio_ListResource
{
}

View file

@ -1,6 +0,0 @@
<?php
class Services_Twilio_Rest_OutgoingCallerId
extends Services_Twilio_InstanceResource
{
}

View file

@ -1,12 +0,0 @@
<?php
class Services_Twilio_Rest_OutgoingCallerIds
extends Services_Twilio_ListResource
{
public function create($phoneNumber, array $params = array())
{
return parent::_create(array(
'PhoneNumber' => $phoneNumber,
) + $params);
}
}

View file

@ -1,10 +0,0 @@
<?php
class Services_Twilio_Rest_Participant
extends Services_Twilio_InstanceResource
{
public function mute()
{
$this->update('Muted', 'true');
}
}

View file

@ -1,10 +0,0 @@
<?php
class Services_Twilio_Rest_Participants
extends Services_Twilio_ListResource
{
/* Participants are identified by CallSid, not like PI123 */
public function getObjectFromJson($params, $idParam = "sid") {
return parent::getObjectFromJson($params, "call_sid");
}
}

View file

@ -1,10 +0,0 @@
<?php
class Services_Twilio_Rest_Queue
extends Services_Twilio_InstanceResource {
protected function init($client, $uri) {
$this->setupSubresources('members');
}
}

View file

@ -1,19 +0,0 @@
<?php
class Services_Twilio_Rest_Queues
extends Services_Twilio_ListResource
{
/**
* Create a new Queue
*
* @param string $friendly_name The name of this queue
* @param array $params A list of optional parameters, and their values
* @return Services_Twilio_Rest_Queue The created Queue
*/
function create($friendly_name, array $params = array()) {
return parent::_create(array(
'FriendlyName' => $friendly_name,
) + $params);
}
}

View file

@ -1,9 +0,0 @@
<?php
class Services_Twilio_Rest_Recording
extends Services_Twilio_InstanceResource
{
protected function init($client, $uri) {
$this->setupSubresources('transcriptions');
}
}

View file

@ -1,6 +0,0 @@
<?php
class Services_Twilio_Rest_Recordings
extends Services_Twilio_ListResource
{
}

View file

@ -1,6 +0,0 @@
<?php
class Services_Twilio_Rest_Sandbox
extends Services_Twilio_InstanceResource
{
}

View file

@ -1,6 +0,0 @@
<?php
class Services_Twilio_Rest_ShortCode
extends Services_Twilio_InstanceResource
{
}

View file

@ -1,10 +0,0 @@
<?php
class Services_Twilio_Rest_ShortCodes
extends Services_Twilio_ListResource
{
public function __construct($client, $uri) {
$uri = preg_replace("#ShortCodes#", "SMS/ShortCodes", $uri);
parent::__construct($client, $uri);
}
}

View file

@ -1,19 +0,0 @@
<?php
/**
* For Linux filename compatibility, this file needs to be named Sip.php, or
* camelize() needs to be special cased in setupSubresources
*/
class Services_Twilio_Rest_SIP extends Services_Twilio_InstanceResource {
protected function init($client, $uri) {
$this->setupSubresources(
'domains',
'ip_access_control_lists',
'credential_lists'
);
}
public function getResourceName($camelized = false) {
return "SIP";
}
}

View file

@ -1,6 +0,0 @@
<?php
class Services_Twilio_Rest_SmsMessage
extends Services_Twilio_InstanceResource
{
}

View file

@ -1,18 +0,0 @@
<?php
class Services_Twilio_Rest_SmsMessages
extends Services_Twilio_ListResource
{
public function __construct($client, $uri) {
$uri = preg_replace("#SmsMessages#", "SMS/Messages", $uri);
parent::__construct($client, $uri);
}
function create($from, $to, $body, array $params = array()) {
return parent::_create(array(
'From' => $from,
'To' => $to,
'Body' => $body
) + $params);
}
}

View file

@ -1,6 +0,0 @@
<?php
class Services_Twilio_Rest_Transcription
extends Services_Twilio_InstanceResource
{
}

View file

@ -1,6 +0,0 @@
<?php
class Services_Twilio_Rest_Transcriptions
extends Services_Twilio_ListResource
{
}

View file

@ -1,6 +0,0 @@
<?php
class Services_Twilio_Rest_UsageRecord extends Services_Twilio_InstanceResource
{
}

View file

@ -1,33 +0,0 @@
<?php
class Services_Twilio_Rest_UsageRecords extends Services_Twilio_TimeRangeResource {
public function init($client, $uri) {
$this->setupSubresources(
'today',
'yesterday',
'all_time',
'this_month',
'last_month',
'daily',
'monthly',
'yearly'
);
}
}
class Services_Twilio_Rest_Today extends Services_Twilio_TimeRangeResource { }
class Services_Twilio_Rest_Yesterday extends Services_Twilio_TimeRangeResource { }
class Services_Twilio_Rest_LastMonth extends Services_Twilio_TimeRangeResource { }
class Services_Twilio_Rest_ThisMonth extends Services_Twilio_TimeRangeResource { }
class Services_Twilio_Rest_AllTime extends Services_Twilio_TimeRangeResource { }
class Services_Twilio_Rest_Daily extends Services_Twilio_UsageResource { }
class Services_Twilio_Rest_Monthly extends Services_Twilio_UsageResource { }
class Services_Twilio_Rest_Yearly extends Services_Twilio_UsageResource { }

View file

@ -1,5 +0,0 @@
<?php
class Services_Twilio_Rest_UsageTrigger
extends Services_Twilio_InstanceResource { }

View file

@ -1,27 +0,0 @@
<?php
class Services_Twilio_Rest_UsageTriggers extends Services_Twilio_ListResource {
public function __construct($client, $uri) {
$uri = preg_replace("#UsageTriggers#", "Usage/Triggers", $uri);
parent::__construct($client, $uri);
}
/**
* Create a new UsageTrigger
* @param string $category The category of usage to fire a trigger for. A full list of categories can be found in the `Usage Categories documentation <http://www.twilio.com/docs/api/rest/usage-records#usage-categories>`_.
* @param string $value Fire the trigger when usage crosses this value.
* @param string $url The URL to request when the trigger fires.
* @param array $params Optional parameters for this trigger. A full list of parameters can be found in the `Usage Trigger documentation <http://www.twilio.com/docs/api/rest/usage-triggers#list-post-optional-parameters>`_.
* @return Services_Twilio_Rest_UsageTrigger The created trigger
*/
function create($category, $value, $url, array $params = array()) {
return parent::_create(array(
'UsageCategory' => $category,
'TriggerValue' => $value,
'CallbackUrl' => $url,
) + $params);
}
}

View file

@ -1,44 +0,0 @@
<?php
/**
* An exception talking to the Twilio API. This is thrown whenever the Twilio
* API returns a 400 or 500-level exception.
*
* :param int $status: the HTTP status for the exception
* :param string $message: a human-readable error message for the exception
* :param int $code: a Twilio-specific error code for the exception
* :param string $info: a link to more information
*/
class Services_Twilio_RestException extends Exception {
/**
* The HTTP status for the exception.
*/
protected $status;
/**
* A URL to get more information about the error. This is not always
* available
*/
protected $info;
public function __construct($status, $message, $code = 0, $info = '') {
$this->status = $status;
$this->info = $info;
parent::__construct($message, $code);
}
/**
* Get the HTTP status code
*/
public function getStatus() {
return $this->status;
}
/**
* Get a link to more information
*/
public function getInfo() {
return $this->info;
}
}

View file

@ -1,14 +0,0 @@
<?php
/**
* This subclass of ListResource is used solely to update
* the URI for sip resources.
*/
abstract class Services_Twilio_SIPListResource extends Services_Twilio_ListResource {
public function __construct($client, $uri) {
// Rename all /Sip/ uris to /SIP/
$uri = preg_replace("#/Sip#", "/SIP", $uri);
parent::__construct($client, $uri);
}
}

View file

@ -1,31 +0,0 @@
<?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];
}
}

View file

@ -1,126 +0,0 @@
<?php
/**
* Based on TinyHttp from https://gist.github.com/618157.
* Copyright 2011, Neuman Vong. BSD License.
*/
class Services_Twilio_TinyHttpException extends ErrorException {}
/**
* An HTTP client that makes requests
*
* :param string $uri: The base uri to use for requests
* :param array $kwargs: An array of additional arguments to pass to the
* library. Accepted arguments are:
*
* - **debug** - Print the HTTP request before making it to Twilio
* - **curlopts** - An array of keys and values that are passed to
* ``curl_setopt_array``.
*
* Here's an example. This is the default HTTP client used by the library.
*
* .. code-block:: php
*
* $_http = new Services_Twilio_TinyHttp(
* "https://api.twilio.com",
* array("curlopts" => array(
* CURLOPT_USERAGENT => self::USER_AGENT,
* CURLOPT_HTTPHEADER => array('Accept-Charset: utf-8'),
* CURLOPT_CAINFO => dirname(__FILE__) . '/cacert.pem',
* ))
* );
*/
class Services_Twilio_TinyHttp {
var $user, $pass, $scheme, $host, $port, $debug, $curlopts;
public function __construct($uri = '', $kwargs = array()) {
foreach (parse_url($uri) as $name => $value) $this->$name = $value;
$this->debug = isset($kwargs['debug']) ? !!$kwargs['debug'] : NULL;
$this->curlopts = isset($kwargs['curlopts']) ? $kwargs['curlopts'] : array();
}
public function __call($name, $args) {
list($res, $req_headers, $req_body) = $args + array(0, array(), '');
$opts = $this->curlopts + array(
CURLOPT_URL => "$this->scheme://$this->host$res",
CURLOPT_HEADER => TRUE,
CURLOPT_RETURNTRANSFER => TRUE,
CURLOPT_INFILESIZE => -1,
CURLOPT_POSTFIELDS => NULL,
CURLOPT_TIMEOUT => 60,
);
foreach ($req_headers as $k => $v) $opts[CURLOPT_HTTPHEADER][] = "$k: $v";
if ($this->port) $opts[CURLOPT_PORT] = $this->port;
if ($this->debug) $opts[CURLINFO_HEADER_OUT] = TRUE;
if ($this->user && $this->pass) $opts[CURLOPT_USERPWD] = "$this->user:$this->pass";
switch ($name) {
case 'get':
$opts[CURLOPT_HTTPGET] = TRUE;
break;
case 'post':
$opts[CURLOPT_POST] = TRUE;
$opts[CURLOPT_POSTFIELDS] = $req_body;
break;
case 'put':
$opts[CURLOPT_PUT] = TRUE;
if (strlen($req_body)) {
if ($buf = fopen('php://memory', 'w+')) {
fwrite($buf, $req_body);
fseek($buf, 0);
$opts[CURLOPT_INFILE] = $buf;
$opts[CURLOPT_INFILESIZE] = strlen($req_body);
} else throw new Services_Twilio_TinyHttpException('unable to open temporary file');
}
break;
case 'head':
$opts[CURLOPT_NOBODY] = TRUE;
break;
default:
$opts[CURLOPT_CUSTOMREQUEST] = strtoupper($name);
break;
}
try {
if ($curl = curl_init()) {
if (curl_setopt_array($curl, $opts)) {
if ($response = curl_exec($curl)) {
$parts = explode("\r\n\r\n", $response, 3);
list($head, $body) = ($parts[0] == 'HTTP/1.1 100 Continue')
? array($parts[1], $parts[2])
: array($parts[0], $parts[1]);
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if ($this->debug) {
error_log(
curl_getinfo($curl, CURLINFO_HEADER_OUT) .
$req_body
);
}
$header_lines = explode("\r\n", $head);
array_shift($header_lines);
foreach ($header_lines as $line) {
list($key, $value) = explode(":", $line, 2);
$headers[$key] = trim($value);
}
curl_close($curl);
if (isset($buf) && is_resource($buf)) {
fclose($buf);
}
return array($status, $headers, $body);
} else {
throw new Services_Twilio_TinyHttpException(curl_error($curl));
}
} else throw new Services_Twilio_TinyHttpException(curl_error($curl));
} else throw new Services_Twilio_TinyHttpException('unable to initialize cURL');
} catch (ErrorException $e) {
if (is_resource($curl)) curl_close($curl);
if (isset($buf) && is_resource($buf)) fclose($buf);
throw $e;
}
}
public function authenticate($user, $pass) {
$this->user = $user;
$this->pass = $pass;
}
}

View file

@ -1,137 +0,0 @@
<?php
/**
* Exception class for Services_Twilio_Twiml.
*/
class Services_Twilio_TwimlException extends Exception {}
/**
* Twiml response generator.
*
* Author: Neuman Vong <neuman at ashmoremusic dot com>
* License: http://creativecommons.org/licenses/MIT/ MIT
*/
class Services_Twilio_Twiml {
protected $element;
/**
* Constructs a Twiml response.
*
* :param SimpleXmlElement|array $arg: Can be any of
*
* - the element to wrap
* - attributes to add to the element
* - if null, initialize an empty element named 'Response'
*/
public function __construct($arg = null) {
switch (true) {
case $arg instanceof SimpleXmlElement:
$this->element = $arg;
break;
case $arg === null:
$this->element = new SimpleXmlElement('<Response/>');
break;
case is_array($arg):
$this->element = new SimpleXmlElement('<Response/>');
foreach ($arg as $name => $value) {
$this->element->addAttribute($name, $value);
}
break;
default:
throw new TwimlException('Invalid argument');
}
}
/**
* Converts method calls into Twiml verbs.
*
* A basic example:
*
* .. code-block:: php
*
* php> print $this->say('hello');
* <Say>hello</Say>
*
* An example with attributes:
*
* .. code-block:: php
*
* print $this->say('hello', array('voice' => 'woman'));
* <Say voice="woman">hello</Say>
*
* You could even just pass in an attributes array, omitting the noun:
*
* .. code-block:: php
*
* print $this->gather(array('timeout' => '20'));
* <Gather timeout="20"/>
*
* :param string $verb: The Twiml verb.
* :param array $args:
* - (noun string)
* - (noun string, attributes array)
* - (attributes array)
*
* :return: A SimpleXmlElement
* :rtype: SimpleXmlElement
*/
public function __call($verb, array $args)
{
list($noun, $attrs) = $args + array('', array());
if (is_array($noun)) {
list($attrs, $noun) = array($noun, '');
}
/* addChild does not escape XML, while addAttribute does. This means if
* you pass unescaped ampersands ("&") to addChild, you will generate
* an error.
*
* Some inexperienced developers will pass in unescaped ampersands, and
* we want to make their code work, by escaping the ampersands for them
* before passing the string to addChild. (with htmlentities)
*
* However other people will know what to do, and their code
* already escapes ampersands before passing them to addChild. We don't
* want to break their existing code by turning their &amp;'s into
* &amp;amp;
*
* We also want to use numeric entities, not named entities so that we
* are fully compatible with XML
*
* The following lines accomplish the desired behavior.
*/
$decoded = html_entity_decode($noun, ENT_COMPAT, 'UTF-8');
$normalized = htmlspecialchars($decoded, ENT_COMPAT, 'UTF-8', false);
$child = empty($noun)
? $this->element->addChild(ucfirst($verb))
: $this->element->addChild(ucfirst($verb), $normalized);
foreach ($attrs as $name => $value) {
/* Note that addAttribute escapes raw ampersands by default, so we
* haven't touched its implementation. So this is the matrix for
* addAttribute:
*
* & turns into &amp;
* &amp; turns into &amp;amp;
*/
if (is_bool($value)) {
$value = ($value === true) ? 'true' : 'false';
}
$child->addAttribute($name, $value);
}
return new static($child);
}
/**
* Returns the object as XML.
*
* :return: The response as an XML string
* :rtype: string
*/
public function __toString()
{
$xml = $this->element->asXml();
return str_replace(
'<?xml version="1.0"?>',
'<?xml version="1.0" encoding="UTF-8"?>', $xml);
}
}

View file

@ -1,20 +0,0 @@
<?php
/**
* Parent class for all UsageRecord subclasses
* @author Kevin Burke <kevin@twilio.com>
* @license http://creativecommons.org/licenses/MIT/ MIT
* @link http://pear.php.net/package/Services_Twilio
*/
class Services_Twilio_UsageResource extends Services_Twilio_ListResource {
public function getResourceName($camelized = false) {
$this->instance_name = 'Services_Twilio_Rest_UsageRecord';
return $camelized ? 'UsageRecords' : 'usage_records';
}
public function __construct($client, $uri) {
$uri = preg_replace("#UsageRecords#", "Usage/Records", $uri);
parent::__construct($client, $uri);
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,30 +0,0 @@
{
"name": "twilio/sdk",
"type": "library",
"description": "A PHP wrapper for Twilio's API",
"keywords": ["twilio", "sms", "api"],
"homepage": "http://github.com/twilio/twilio-php",
"license": "MIT",
"authors": [
{
"name": "Kevin Burke",
"email": "kevin@twilio.com"
},
{
"name": "Kyle Conroy",
"email": "kyle+pear@twilio.com"
}
],
"require": {
"php": ">=5.2.1"
},
"require-dev": {
"mockery/mockery": ">=0.7.2",
"phpunit/phpunit": "3.7.*"
},
"autoload": {
"psr-0": {
"Services_Twilio": ""
}
}
}

492
externals/twilio-php/composer.lock generated vendored
View file

@ -1,492 +0,0 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file"
],
"hash": "b90999563f52df15b944f8defc454195",
"packages": [
],
"packages-dev": [
{
"name": "mockery/mockery",
"version": "0.8.0",
"source": {
"type": "git",
"url": "https://github.com/padraic/mockery.git",
"reference": "35f0e18022f5538df9df8920a3d96c1761d63220"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/padraic/mockery/zipball/35f0e18022f5538df9df8920a3d96c1761d63220",
"reference": "35f0e18022f5538df9df8920a3d96c1761d63220",
"shasum": ""
},
"require": {
"php": ">=5.3.2"
},
"require-dev": {
"hamcrest/hamcrest": "1.1.0"
},
"type": "library",
"autoload": {
"psr-0": {
"Mockery": "library/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Pádraic Brady",
"email": "padraic.brady@gmail.com",
"homepage": "http://blog.astrumfutura.com"
}
],
"description": "Mockery is a simple yet flexible PHP mock object framework for use in unit testing with PHPUnit, PHPSpec or any other testing framework. Its core goal is to offer a test double framework with a succint API capable of clearly defining all possible object operations and interactions using a human readable Domain Specific Language (DSL). Designed as a drop in alternative to PHPUnit's phpunit-mock-objects library, Mockery is easy to integrate with PHPUnit and can operate alongside phpunit-mock-objects without the World ending.",
"homepage": "http://github.com/padraic/mockery",
"keywords": [
"BDD",
"TDD",
"library",
"mock",
"mock objects",
"mockery",
"stub",
"test",
"test double",
"testing"
],
"time": "2013-04-01 12:13:17"
},
{
"name": "phpunit/php-code-coverage",
"version": "1.2.13",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "466e7cd2554b4e264c9e3f31216d25ac0e5f3d94"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/466e7cd2554b4e264c9e3f31216d25ac0e5f3d94",
"reference": "466e7cd2554b4e264c9e3f31216d25ac0e5f3d94",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"phpunit/php-file-iterator": ">=1.3.0@stable",
"phpunit/php-text-template": ">=1.1.1@stable",
"phpunit/php-token-stream": ">=1.1.3@stable"
},
"require-dev": {
"phpunit/phpunit": "3.7.*@dev"
},
"suggest": {
"ext-dom": "*",
"ext-xdebug": ">=2.0.5"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.2.x-dev"
}
},
"autoload": {
"classmap": [
"PHP/"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
""
],
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.",
"homepage": "https://github.com/sebastianbergmann/php-code-coverage",
"keywords": [
"coverage",
"testing",
"xunit"
],
"time": "2013-09-10 08:14:32"
},
{
"name": "phpunit/php-file-iterator",
"version": "1.3.3",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-file-iterator.git",
"reference": "16a78140ed2fc01b945cfa539665fadc6a038029"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/16a78140ed2fc01b945cfa539665fadc6a038029",
"reference": "16a78140ed2fc01b945cfa539665fadc6a038029",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"autoload": {
"classmap": [
"File/"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
""
],
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "FilterIterator implementation that filters files based on a list of suffixes.",
"homepage": "http://www.phpunit.de/",
"keywords": [
"filesystem",
"iterator"
],
"time": "2012-10-11 11:44:38"
},
{
"name": "phpunit/php-text-template",
"version": "1.1.4",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-text-template.git",
"reference": "5180896f51c5b3648ac946b05f9ec02be78a0b23"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5180896f51c5b3648ac946b05f9ec02be78a0b23",
"reference": "5180896f51c5b3648ac946b05f9ec02be78a0b23",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"autoload": {
"classmap": [
"Text/"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
""
],
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "Simple template engine.",
"homepage": "https://github.com/sebastianbergmann/php-text-template/",
"keywords": [
"template"
],
"time": "2012-10-31 18:15:28"
},
{
"name": "phpunit/php-timer",
"version": "1.0.5",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-timer.git",
"reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/19689d4354b295ee3d8c54b4f42c3efb69cbc17c",
"reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"autoload": {
"classmap": [
"PHP/"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
""
],
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "Utility class for timing",
"homepage": "https://github.com/sebastianbergmann/php-timer/",
"keywords": [
"timer"
],
"time": "2013-08-02 07:42:54"
},
{
"name": "phpunit/php-token-stream",
"version": "1.2.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-token-stream.git",
"reference": "5220af2a7929aa35cf663d97c89ad3d50cf5fa3e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/5220af2a7929aa35cf663d97c89ad3d50cf5fa3e",
"reference": "5220af2a7929aa35cf663d97c89ad3d50cf5fa3e",
"shasum": ""
},
"require": {
"ext-tokenizer": "*",
"php": ">=5.3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.2-dev"
}
},
"autoload": {
"classmap": [
"PHP/"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
""
],
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "Wrapper around PHP's tokenizer extension.",
"homepage": "https://github.com/sebastianbergmann/php-token-stream/",
"keywords": [
"tokenizer"
],
"time": "2013-09-13 04:58:23"
},
{
"name": "phpunit/phpunit",
"version": "3.7.27",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "4b024e753e3421837afbcca962c8724c58b39376"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/4b024e753e3421837afbcca962c8724c58b39376",
"reference": "4b024e753e3421837afbcca962c8724c58b39376",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-pcre": "*",
"ext-reflection": "*",
"ext-spl": "*",
"php": ">=5.3.3",
"phpunit/php-code-coverage": "~1.2.1",
"phpunit/php-file-iterator": ">=1.3.1",
"phpunit/php-text-template": ">=1.1.1",
"phpunit/php-timer": ">=1.0.4",
"phpunit/phpunit-mock-objects": "~1.2.0",
"symfony/yaml": "~2.0"
},
"require-dev": {
"pear-pear/pear": "1.9.4"
},
"suggest": {
"ext-json": "*",
"ext-simplexml": "*",
"ext-tokenizer": "*",
"phpunit/php-invoker": ">=1.1.0,<1.2.0"
},
"bin": [
"composer/bin/phpunit"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.7.x-dev"
}
},
"autoload": {
"classmap": [
"PHPUnit/"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
"",
"../../symfony/yaml/"
],
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "The PHP Unit Testing framework.",
"homepage": "http://www.phpunit.de/",
"keywords": [
"phpunit",
"testing",
"xunit"
],
"time": "2013-09-16 03:09:52"
},
{
"name": "phpunit/phpunit-mock-objects",
"version": "1.2.3",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
"reference": "5794e3c5c5ba0fb037b11d8151add2a07fa82875"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/5794e3c5c5ba0fb037b11d8151add2a07fa82875",
"reference": "5794e3c5c5ba0fb037b11d8151add2a07fa82875",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"phpunit/php-text-template": ">=1.1.1@stable"
},
"suggest": {
"ext-soap": "*"
},
"type": "library",
"autoload": {
"classmap": [
"PHPUnit/"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
""
],
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "Mock Object library for PHPUnit",
"homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/",
"keywords": [
"mock",
"xunit"
],
"time": "2013-01-13 10:24:48"
},
{
"name": "symfony/yaml",
"version": "v2.3.4",
"target-dir": "Symfony/Component/Yaml",
"source": {
"type": "git",
"url": "https://github.com/symfony/Yaml.git",
"reference": "5a279f1b5f5e1045a6c432354d9ea727ff3a9847"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/Yaml/zipball/5a279f1b5f5e1045a6c432354d9ea727ff3a9847",
"reference": "5a279f1b5f5e1045a6c432354d9ea727ff3a9847",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.3-dev"
}
},
"autoload": {
"psr-0": {
"Symfony\\Component\\Yaml\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
}
],
"description": "Symfony Yaml Component",
"homepage": "http://symfony.com",
"time": "2013-08-24 15:26:22"
}
],
"aliases": [
],
"minimum-stability": "stable",
"stability-flags": [
],
"platform": {
"php": ">=5.2.1"
},
"platform-dev": [
]
}

View file

@ -1,130 +0,0 @@
# Makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = _build
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " singlehtml to make a single large HTML file"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " devhelp to make HTML files and a Devhelp project"
@echo " epub to make an epub"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " text to make text files"
@echo " man to make manual pages"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
clean:
-rm -rf $(BUILDDIR)/*
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
singlehtml:
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
@echo
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."
json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."
htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."
qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Services_Twilio.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Services_Twilio.qhc"
devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/Services_Twilio"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/Services_Twilio"
@echo "# devhelp"
epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."
latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
make -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
@echo
@echo "Build finished. The text files are in $(BUILDDIR)/text."
man:
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
@echo
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."
linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."
doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."

View file

@ -1,3 +0,0 @@
*.pyc
*.pyo
.DS_Store

View file

@ -1,45 +0,0 @@
Modifications:
Copyright (c) 2011 Kenneth Reitz.
Original Project:
Copyright (c) 2010 by Armin Ronacher.
Some rights reserved.
Redistribution and use in source and binary forms of the theme, with or
without modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* The names of the contributors may not be used to endorse or
promote products derived from this software without specific
prior written permission.
We kindly ask you to only use these themes in an unmodified manner just
for Flask and Flask-related products, not for unrelated projects. If you
like the visual style and want to use it for your own projects, please
consider making some larger changes to the themes (such as changing
font faces, sizes, colors or margins).
THIS THEME IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS THEME, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

View file

@ -1,25 +0,0 @@
krTheme Sphinx Style
====================
This repository contains sphinx styles Kenneth Reitz uses in most of
his projects. It is a drivative of Mitsuhiko's themes for Flask and Flask related
projects. To use this style in your Sphinx documentation, follow
this guide:
1. put this folder as _themes into your docs folder. Alternatively
you can also use git submodules to check out the contents there.
2. add this to your conf.py: ::
sys.path.append(os.path.abspath('_themes'))
html_theme_path = ['_themes']
html_theme = 'flask'
The following themes exist:
**kr**
the standard flask documentation theme for large projects
**kr_small**
small one-page theme. Intended to be used by very small addon libraries.

View file

@ -1,86 +0,0 @@
# flasky extensions. flasky pygments style based on tango style
from pygments.style import Style
from pygments.token import Keyword, Name, Comment, String, Error, \
Number, Operator, Generic, Whitespace, Punctuation, Other, Literal
class FlaskyStyle(Style):
background_color = "#f8f8f8"
default_style = ""
styles = {
# No corresponding class for the following:
#Text: "", # class: ''
Whitespace: "underline #f8f8f8", # class: 'w'
Error: "#a40000 border:#ef2929", # class: 'err'
Other: "#000000", # class 'x'
Comment: "italic #8f5902", # class: 'c'
Comment.Preproc: "noitalic", # class: 'cp'
Keyword: "bold #004461", # class: 'k'
Keyword.Constant: "bold #004461", # class: 'kc'
Keyword.Declaration: "bold #004461", # class: 'kd'
Keyword.Namespace: "bold #004461", # class: 'kn'
Keyword.Pseudo: "bold #004461", # class: 'kp'
Keyword.Reserved: "bold #004461", # class: 'kr'
Keyword.Type: "bold #004461", # class: 'kt'
Operator: "#582800", # class: 'o'
Operator.Word: "bold #004461", # class: 'ow' - like keywords
Punctuation: "bold #000000", # class: 'p'
# because special names such as Name.Class, Name.Function, etc.
# are not recognized as such later in the parsing, we choose them
# to look the same as ordinary variables.
Name: "#000000", # class: 'n'
Name.Attribute: "#c4a000", # class: 'na' - to be revised
Name.Builtin: "#004461", # class: 'nb'
Name.Builtin.Pseudo: "#3465a4", # class: 'bp'
Name.Class: "#000000", # class: 'nc' - to be revised
Name.Constant: "#000000", # class: 'no' - to be revised
Name.Decorator: "#888", # class: 'nd' - to be revised
Name.Entity: "#ce5c00", # class: 'ni'
Name.Exception: "bold #cc0000", # class: 'ne'
Name.Function: "#000000", # class: 'nf'
Name.Property: "#000000", # class: 'py'
Name.Label: "#f57900", # class: 'nl'
Name.Namespace: "#000000", # class: 'nn' - to be revised
Name.Other: "#000000", # class: 'nx'
Name.Tag: "bold #004461", # class: 'nt' - like a keyword
Name.Variable: "#000000", # class: 'nv' - to be revised
Name.Variable.Class: "#000000", # class: 'vc' - to be revised
Name.Variable.Global: "#000000", # class: 'vg' - to be revised
Name.Variable.Instance: "#000000", # class: 'vi' - to be revised
Number: "#990000", # class: 'm'
Literal: "#000000", # class: 'l'
Literal.Date: "#000000", # class: 'ld'
String: "#4e9a06", # class: 's'
String.Backtick: "#4e9a06", # class: 'sb'
String.Char: "#4e9a06", # class: 'sc'
String.Doc: "italic #8f5902", # class: 'sd' - like a comment
String.Double: "#4e9a06", # class: 's2'
String.Escape: "#4e9a06", # class: 'se'
String.Heredoc: "#4e9a06", # class: 'sh'
String.Interpol: "#4e9a06", # class: 'si'
String.Other: "#4e9a06", # class: 'sx'
String.Regex: "#4e9a06", # class: 'sr'
String.Single: "#4e9a06", # class: 's1'
String.Symbol: "#4e9a06", # class: 'ss'
Generic: "#000000", # class: 'g'
Generic.Deleted: "#a40000", # class: 'gd'
Generic.Emph: "italic #000000", # class: 'ge'
Generic.Error: "#ef2929", # class: 'gr'
Generic.Heading: "bold #000080", # class: 'gh'
Generic.Inserted: "#00A000", # class: 'gi'
Generic.Output: "#888", # class: 'go'
Generic.Prompt: "#745334", # class: 'gp'
Generic.Strong: "bold #000000", # class: 'gs'
Generic.Subheading: "bold #800080", # class: 'gu'
Generic.Traceback: "bold #a40000", # class: 'gt'
}

View file

@ -1,32 +0,0 @@
{%- extends "basic/layout.html" %}
{%- block extrahead %}
{{ super() }}
{% if theme_touch_icon %}
<link rel="apple-touch-icon" href="{{ pathto('_static/' ~ theme_touch_icon, 1) }}" />
{% endif %}
<link media="only screen and (max-device-width: 480px)" href="{{
pathto('_static/small_flask.css', 1) }}" type= "text/css" rel="stylesheet" />
{% endblock %}
{%- block relbar2 %}{% endblock %}
{%- block footer %}
<div class="footer">
&copy; Copyright {{ copyright }}.
</div>
<script type="text/javascript">
try {
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-2900316-11']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
} catch(err) {}
</script>
<a href="https://github.com/twilio/twilio-php">
<img style="position: absolute; top: 0; right: 0; border: 0;" src="http://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub" />
</a>
{%- endblock %}

View file

@ -1,19 +0,0 @@
<h3>Related Topics</h3>
<ul>
<li><a href="{{ pathto(master_doc) }}">Documentation overview</a><ul>
{%- for parent in parents %}
<li><a href="{{ parent.link|e }}">{{ parent.title }}</a><ul>
{%- endfor %}
{%- if prev %}
<li>Previous: <a href="{{ prev.link|e }}" title="{{ _('previous chapter')
}}">{{ prev.title }}</a></li>
{%- endif %}
{%- if next %}
<li>Next: <a href="{{ next.link|e }}" title="{{ _('next chapter')
}}">{{ next.title }}</a></li>
{%- endif %}
{%- for parent in parents %}
</ul></li>
{%- endfor %}
</ul></li>
</ul>

View file

@ -1,469 +0,0 @@
/*
* flasky.css_t
* ~~~~~~~~~~~~
*
* :copyright: Copyright 2010 by Armin Ronacher. Modifications by Kenneth Reitz.
* :license: Flask Design License, see LICENSE for details.
*/
{% set page_width = '940px' %}
{% set sidebar_width = '220px' %}
@import url("basic.css");
/* -- page layout ----------------------------------------------------------- */
body {
font-family: 'goudy old style', 'minion pro', 'bell mt', Georgia, 'Hiragino Mincho Pro';
font-size: 17px;
background-color: white;
color: #000;
margin: 0;
padding: 0;
}
div.document {
width: {{ page_width }};
margin: 30px auto 0 auto;
}
div.documentwrapper {
float: left;
width: 100%;
}
div.bodywrapper {
margin: 0 0 0 {{ sidebar_width }};
}
div.sphinxsidebar {
width: {{ sidebar_width }};
}
hr {
border: 1px solid #B1B4B6;
}
div.body {
background-color: #ffffff;
color: #3E4349;
padding: 0 30px 0 30px;
}
img.floatingflask {
padding: 0 0 10px 10px;
float: right;
}
div.footer {
width: {{ page_width }};
margin: 20px auto 30px auto;
font-size: 14px;
color: #888;
text-align: right;
}
div.footer a {
color: #888;
}
div.related {
display: none;
}
div.sphinxsidebar a {
color: #444;
text-decoration: none;
border-bottom: 1px dotted #999;
}
div.sphinxsidebar a:hover {
border-bottom: 1px solid #999;
}
div.sphinxsidebar {
font-size: 14px;
line-height: 1.5;
}
div.sphinxsidebarwrapper {
padding: 18px 10px;
}
div.sphinxsidebarwrapper p.logo {
padding: 0;
margin: -10px 0 0 -20px;
text-align: center;
}
div.sphinxsidebar h3,
div.sphinxsidebar h4 {
font-family: 'Garamond', 'Georgia', serif;
color: #444;
font-size: 24px;
font-weight: normal;
margin: 0 0 5px 0;
padding: 0;
}
div.sphinxsidebar h4 {
font-size: 20px;
}
div.sphinxsidebar h3 a {
color: #444;
}
div.sphinxsidebar p.logo a,
div.sphinxsidebar h3 a,
div.sphinxsidebar p.logo a:hover,
div.sphinxsidebar h3 a:hover {
border: none;
}
div.sphinxsidebar p {
color: #555;
margin: 10px 0;
}
div.sphinxsidebar ul {
margin: 10px 0;
padding: 0;
color: #000;
}
div.sphinxsidebar input {
border: 1px solid #ccc;
font-family: 'Georgia', serif;
font-size: 1em;
}
/* -- body styles ----------------------------------------------------------- */
a {
color: #004B6B;
text-decoration: underline;
}
a:hover {
color: #6D4100;
text-decoration: underline;
}
div.body h1,
div.body h2,
div.body h3,
div.body h4,
div.body h5,
div.body h6 {
font-family: 'Garamond', 'Georgia', serif;
font-weight: normal;
margin: 30px 0px 10px 0px;
padding: 0;
}
div.body h1 { margin-top: 0; padding-top: 0; font-size: 240%; }
div.body h2 { font-size: 180%; }
div.body h3 { font-size: 150%; }
div.body h4 { font-size: 130%; }
div.body h5 { font-size: 100%; }
div.body h6 { font-size: 100%; }
a.headerlink {
color: #ddd;
padding: 0 4px;
text-decoration: none;
}
a.headerlink:hover {
color: #444;
background: #eaeaea;
}
div.body p, div.body dd, div.body li {
line-height: 1.4em;
}
div.admonition {
background: #fafafa;
margin: 20px -30px;
padding: 10px 30px;
border-top: 1px solid #ccc;
border-bottom: 1px solid #ccc;
}
div.admonition tt.xref, div.admonition a tt {
border-bottom: 1px solid #fafafa;
}
dd div.admonition {
margin-left: -60px;
padding-left: 60px;
}
div.admonition p.admonition-title {
font-family: 'Garamond', 'Georgia', serif;
font-weight: normal;
font-size: 24px;
margin: 0 0 10px 0;
padding: 0;
line-height: 1;
}
div.admonition p.last {
margin-bottom: 0;
}
div.highlight {
background-color: white;
}
dt:target, .highlight {
background: #FAF3E8;
}
div.note {
background-color: #eee;
border: 1px solid #ccc;
}
div.seealso {
background-color: #ffc;
border: 1px solid #ff6;
}
div.topic {
background-color: #eee;
}
p.admonition-title {
display: inline;
}
p.admonition-title:after {
content: ":";
}
pre, tt {
font-family: 'Consolas', 'Menlo', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
font-size: 0.9em;
}
img.screenshot {
}
tt.descname, tt.descclassname {
font-size: 0.95em;
}
tt.descname {
padding-right: 0.08em;
}
img.screenshot {
-moz-box-shadow: 2px 2px 4px #eee;
-webkit-box-shadow: 2px 2px 4px #eee;
box-shadow: 2px 2px 4px #eee;
}
table.docutils {
border: 1px solid #888;
-moz-box-shadow: 2px 2px 4px #eee;
-webkit-box-shadow: 2px 2px 4px #eee;
box-shadow: 2px 2px 4px #eee;
}
table.docutils td, table.docutils th {
border: 1px solid #888;
padding: 0.25em 0.7em;
}
table.field-list, table.footnote {
border: none;
-moz-box-shadow: none;
-webkit-box-shadow: none;
box-shadow: none;
}
table.footnote {
margin: 15px 0;
width: 100%;
border: 1px solid #eee;
background: #fdfdfd;
font-size: 0.9em;
}
table.footnote + table.footnote {
margin-top: -15px;
border-top: none;
}
table.field-list th {
padding: 0 0.8em 0 0;
}
table.field-list td {
padding: 0;
}
table.footnote td.label {
width: 0px;
padding: 0.3em 0 0.3em 0.5em;
}
table.footnote td {
padding: 0.3em 0.5em;
}
dl {
margin: 0;
padding: 0;
}
dl dd {
margin-left: 30px;
}
blockquote {
margin: 0 0 0 30px;
padding: 0;
}
ul, ol {
margin: 10px 0 10px 30px;
padding: 0;
}
pre {
background: #eee;
padding: 7px 30px;
margin: 15px -30px;
line-height: 1.3em;
}
dl pre, blockquote pre, li pre {
margin-left: -60px;
padding-left: 60px;
}
dl dl pre {
margin-left: -90px;
padding-left: 90px;
}
tt {
background-color: #ecf0f3;
color: #222;
/* padding: 1px 2px; */
}
tt.xref, a tt {
background-color: #FBFBFB;
border-bottom: 1px solid white;
}
a.reference {
text-decoration: none;
border-bottom: 1px dotted #004B6B;
}
a.reference:hover {
border-bottom: 1px solid #6D4100;
}
a.footnote-reference {
text-decoration: none;
font-size: 0.7em;
vertical-align: top;
border-bottom: 1px dotted #004B6B;
}
a.footnote-reference:hover {
border-bottom: 1px solid #6D4100;
}
a:hover tt {
background: #EEE;
}
@media screen and (max-width: 600px) {
div.sphinxsidebar {
display: none;
}
div.documentwrapper {
margin-left: 0;
margin-top: 0;
margin-right: 0;
margin-bottom: 0;
}
div.bodywrapper {
margin-top: 0;
margin-right: 0;
margin-bottom: 0;
margin-left: 0;
}
ul {
margin-left: 0;
}
.document {
width: auto;
}
.bodywrapper {
margin: 0;
}
.footer {
width: auto;
}
}
/* scrollbars */
::-webkit-scrollbar {
width: 6px;
height: 6px;
}
::-webkit-scrollbar-button:start:decrement,
::-webkit-scrollbar-button:end:increment {
display: block;
height: 10px;
}
::-webkit-scrollbar-button:vertical:increment {
background-color: #fff;
}
::-webkit-scrollbar-track-piece {
background-color: #eee;
-webkit-border-radius: 3px;
}
::-webkit-scrollbar-thumb:vertical {
height: 50px;
background-color: #ccc;
-webkit-border-radius: 3px;
}
::-webkit-scrollbar-thumb:horizontal {
width: 50px;
background-color: #ccc;
-webkit-border-radius: 3px;
}
/* misc. */
.revsys-inline {
display: none!important;
}

View file

@ -1,70 +0,0 @@
/*
* small_flask.css_t
* ~~~~~~~~~~~~~~~~~
*
* :copyright: Copyright 2010 by Armin Ronacher.
* :license: Flask Design License, see LICENSE for details.
*/
body {
margin: 0;
padding: 20px 30px;
}
div.documentwrapper {
float: none;
background: white;
}
div.sphinxsidebar {
display: block;
float: none;
width: 102.5%;
margin: 50px -30px -20px -30px;
padding: 10px 20px;
background: #333;
color: white;
}
div.sphinxsidebar h3, div.sphinxsidebar h4, div.sphinxsidebar p,
div.sphinxsidebar h3 a {
color: white;
}
div.sphinxsidebar a {
color: #aaa;
}
div.sphinxsidebar p.logo {
display: none;
}
div.document {
width: 100%;
margin: 0;
}
div.related {
display: block;
margin: 0;
padding: 10px 0 20px 0;
}
div.related ul,
div.related ul li {
margin: 0;
padding: 0;
}
div.footer {
display: none;
}
div.bodywrapper {
margin: 0;
}
div.body {
min-height: 0;
padding: 0;
}

View file

@ -1,7 +0,0 @@
[theme]
inherit = basic
stylesheet = flasky.css
pygments_style = flask_theme_support.FlaskyStyle
[options]
touch_icon =

View file

@ -1,22 +0,0 @@
{% extends "basic/layout.html" %}
{% block header %}
{{ super() }}
{% if pagename == 'index' %}
<div class=indexwrapper>
{% endif %}
{% endblock %}
{% block footer %}
{% if pagename == 'index' %}
</div>
{% endif %}
{% endblock %}
{# do not display relbars #}
{% block relbar1 %}{% endblock %}
{% block relbar2 %}
{% if theme_github_fork %}
<a href="http://github.com/{{ theme_github_fork }}"><img style="position: fixed; top: 0; right: 0; border: 0;"
src="http://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub" /></a>
{% endif %}
{% endblock %}
{% block sidebar1 %}{% endblock %}
{% block sidebar2 %}{% endblock %}

View file

@ -1,287 +0,0 @@
/*
* flasky.css_t
* ~~~~~~~~~~~~
*
* Sphinx stylesheet -- flasky theme based on nature theme.
*
* :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
@import url("basic.css");
/* -- page layout ----------------------------------------------------------- */
body {
font-family: 'Georgia', serif;
font-size: 17px;
color: #000;
background: white;
margin: 0;
padding: 0;
}
div.documentwrapper {
float: left;
width: 100%;
}
div.bodywrapper {
margin: 40px auto 0 auto;
width: 700px;
}
hr {
border: 1px solid #B1B4B6;
}
div.body {
background-color: #ffffff;
color: #3E4349;
padding: 0 30px 30px 30px;
}
img.floatingflask {
padding: 0 0 10px 10px;
float: right;
}
div.footer {
text-align: right;
color: #888;
padding: 10px;
font-size: 14px;
width: 650px;
margin: 0 auto 40px auto;
}
div.footer a {
color: #888;
text-decoration: underline;
}
div.related {
line-height: 32px;
color: #888;
}
div.related ul {
padding: 0 0 0 10px;
}
div.related a {
color: #444;
}
/* -- body styles ----------------------------------------------------------- */
a {
color: #004B6B;
text-decoration: underline;
}
a:hover {
color: #6D4100;
text-decoration: underline;
}
div.body {
padding-bottom: 40px; /* saved for footer */
}
div.body h1,
div.body h2,
div.body h3,
div.body h4,
div.body h5,
div.body h6 {
font-family: 'Garamond', 'Georgia', serif;
font-weight: normal;
margin: 30px 0px 10px 0px;
padding: 0;
}
{% if theme_index_logo %}
div.indexwrapper h1 {
text-indent: -999999px;
background: url({{ theme_index_logo }}) no-repeat center center;
height: {{ theme_index_logo_height }};
}
{% endif %}
div.body h2 { font-size: 180%; }
div.body h3 { font-size: 150%; }
div.body h4 { font-size: 130%; }
div.body h5 { font-size: 100%; }
div.body h6 { font-size: 100%; }
a.headerlink {
color: white;
padding: 0 4px;
text-decoration: none;
}
a.headerlink:hover {
color: #444;
background: #eaeaea;
}
div.body p, div.body dd, div.body li {
line-height: 1.4em;
}
div.admonition {
background: #fafafa;
margin: 20px -30px;
padding: 10px 30px;
border-top: 1px solid #ccc;
border-bottom: 1px solid #ccc;
}
div.admonition p.admonition-title {
font-family: 'Garamond', 'Georgia', serif;
font-weight: normal;
font-size: 24px;
margin: 0 0 10px 0;
padding: 0;
line-height: 1;
}
div.admonition p.last {
margin-bottom: 0;
}
div.highlight{
background-color: white;
}
dt:target, .highlight {
background: #FAF3E8;
}
div.note {
background-color: #eee;
border: 1px solid #ccc;
}
div.seealso {
background-color: #ffc;
border: 1px solid #ff6;
}
div.topic {
background-color: #eee;
}
div.warning {
background-color: #ffe4e4;
border: 1px solid #f66;
}
p.admonition-title {
display: inline;
}
p.admonition-title:after {
content: ":";
}
pre, tt {
font-family: 'Consolas', 'Menlo', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
font-size: 0.85em;
}
img.screenshot {
}
tt.descname, tt.descclassname {
font-size: 0.95em;
}
tt.descname {
padding-right: 0.08em;
}
img.screenshot {
-moz-box-shadow: 2px 2px 4px #eee;
-webkit-box-shadow: 2px 2px 4px #eee;
box-shadow: 2px 2px 4px #eee;
}
table.docutils {
border: 1px solid #888;
-moz-box-shadow: 2px 2px 4px #eee;
-webkit-box-shadow: 2px 2px 4px #eee;
box-shadow: 2px 2px 4px #eee;
}
table.docutils td, table.docutils th {
border: 1px solid #888;
padding: 0.25em 0.7em;
}
table.field-list, table.footnote {
border: none;
-moz-box-shadow: none;
-webkit-box-shadow: none;
box-shadow: none;
}
table.footnote {
margin: 15px 0;
width: 100%;
border: 1px solid #eee;
}
table.field-list th {
padding: 0 0.8em 0 0;
}
table.field-list td {
padding: 0;
}
table.footnote td {
padding: 0.5em;
}
dl {
margin: 0;
padding: 0;
}
dl dd {
margin-left: 30px;
}
pre {
padding: 0;
margin: 15px -30px;
padding: 8px;
line-height: 1.3em;
padding: 7px 30px;
background: #eee;
border-radius: 2px;
-moz-border-radius: 2px;
-webkit-border-radius: 2px;
}
dl pre {
margin-left: -60px;
padding-left: 60px;
}
tt {
background-color: #ecf0f3;
color: #222;
/* padding: 1px 2px; */
}
tt.xref, a tt {
background-color: #FBFBFB;
}
a:hover tt {
background: #EEE;
}

View file

@ -1,10 +0,0 @@
[theme]
inherit = basic
stylesheet = flasky.css
nosidebar = true
pygments_style = flask_theme_support.FlaskyStyle
[options]
index_logo = ''
index_logo_height = 120px
github_fork = ''

View file

@ -1,872 +0,0 @@
.. _api-rest:
###############################
Twilio Rest Resources
###############################
**************
List Resources
**************
.. phpautoclass:: Services_Twilio_ListResource
:filename: ../Services/Twilio/ListResource.php
:members:
All of the below classes inherit from the :php:class:`ListResource
<Services_Twilio_ListResource>`.
Accounts
===========
.. phpautoclass:: Services_Twilio_Rest_Accounts
:filename: ../Services/Twilio/Rest/Accounts.php
:members:
AvailablePhoneNumbers
========================
.. php:class:: Services_Twilio_Rest_AvailablePhoneNumbers
For more information, see the `AvailablePhoneNumbers API Resource <http://www.twilio.com/docs/api/rest/available-phone-numbers#local>`_ documentation at twilio.com.
.. php:method:: getList($country, $type)
Get a list of available phone numbers.
:param string country: The 2-digit country code for numbers ('US', 'GB',
'CA')
:param string type: The type of phone number ('TollFree' or 'Local')
:return: An instance of the :php:class:`Services_Twilio_Rest_AvailablePhoneNumbers` resource.
.. php:attr:: available_phone_numbers
A list of :php:class:`Services_Twilio_Rest_AvailablePhoneNumber` instances.
.. php:attr:: uri
The uri representing this resource, relative to https://api.twilio.com.
Calls
=======
.. php:class:: Services_Twilio_Rest_Calls
For more information, see the `Call List Resource <http://www.twilio.com/docs/api/rest/call#list>`_ documentation.
.. php:method:: create($from, $to, $url, params = array())
Make an outgoing call
:param string $from: The phone number to use as the caller id.
:param string $to: The number to call formatted with a '+' and country code
:param string $url: The fully qualified URL that should be consulted when
the call connects. This value can also be an ApplicationSid.
:param array $params: An array of optional parameters for this call
The **$params** array can contain the following keys:
*Method*
The HTTP method Twilio should use when making its request to the above Url parameter's value. Defaults to POST. If an ApplicationSid parameter is present, this parameter is ignored.
*FallbackUrl*
A URL that Twilio will request if an error occurs requesting or executing the TwiML at Url. If an ApplicationSid parameter is present, this parameter is ignored.
*FallbackMethod*
The HTTP method that Twilio should use to request the FallbackUrl. Must be either GET or POST. Defaults to POST. If an ApplicationSid parameter is present, this parameter is ignored.
*StatusCallback*
A URL that Twilio will request when the call ends to notify your app. If an ApplicationSid parameter is present, this parameter is ignored.
*StatusCallbackMethod*
The HTTP method Twilio should use when requesting the above URL. Defaults to POST. If an ApplicationSid parameter is present, this parameter is ignored.
*SendDigits*
A string of keys to dial after connecting to the number. Valid digits in the string include: any digit (0-9), '#' and '*'. For example, if you connected to a company phone number, and wanted to dial extension 1234 and then the pound key, use SendDigits=1234#. Remember to URL-encode this string, since the '#' character has special meaning in a URL.
*IfMachine*
Tell Twilio to try and determine if a machine (like voicemail) or a human has answered the call. Possible values are Continue and Hangup. See the answering machines section below for more info.
*Timeout*
The integer number of seconds that Twilio should allow the phone to ring before assuming there is no answer. Default is 60 seconds, the maximum is 999 seconds. Note, you could set this to a low value, such as 15, to hangup before reaching an answering machine or voicemail.
CredentialListMappings
=========================
.. phpautoclass:: Services_Twilio_Rest_CredentialListMappings
:filename: ../Services/Twilio/Rest/CredentialListMappings.php
:members:
CredentialLists
=================
.. phpautoclass:: Services_Twilio_Rest_CredentialLists
:filename: ../Services/Twilio/Rest/CredentialLists.php
:members:
Credentials
==============
.. phpautoclass:: Services_Twilio_Rest_Credentials
:filename: ../Services/Twilio/Rest/Credentials.php
:members:
Domains
==========
.. phpautoclass:: Services_Twilio_Rest_Domains
:filename: ../Services/Twilio/Rest/Domains.php
:members:
IncomingPhoneNumbers
========================
.. phpautoclass:: Services_Twilio_Rest_IncomingPhoneNumbers,Services_Twilio_Rest_Local,Services_Twilio_Rest_Mobile,Services_Twilio_Rest_TollFree
:filename: ../Services/Twilio/Rest/IncomingPhoneNumbers.php
:members:
IpAccessControlListMappings
==============================
.. phpautoclass:: Services_Twilio_Rest_IpAccessControlListMappings
:filename: ../Services/Twilio/Rest/IpAccessControlListMappings.php
:members:
IpAccessControlLists
=======================
.. phpautoclass:: Services_Twilio_Rest_IpAccessControlLists
:filename: ../Services/Twilio/Rest/IpAccessControlLists.php
:members:
IpAddresses
=======================
.. phpautoclass:: Services_Twilio_Rest_IpAddresses
:filename: ../Services/Twilio/Rest/IpAddresses.php
:members:
Media
======
.. phpautoclass:: Services_Twilio_Rest_Media
:filename: ../Services/Twilio/Rest/Media.php
:members:
Members
===========
.. php:class:: Services_Twilio_Rest_Members
For more information, including a list of filter parameters, see the `Member List Resource <http://www.twilio.com/docs/api/rest/member#list>`_ documentation.
.. php:method:: front()
Return the :php:class:`Services_Twilio_Rest_Member` at the front of the
queue.
Messages
========
.. phpautoclass:: Services_Twilio_Rest_Messages
:filename: ../Services/Twilio/Rest/Messages.php
:members:
Queues
===========
.. php:class:: Services_Twilio_Rest_Queues
For more information, including a list of filter parameters, see the
`Queues List Resource <http://www.twilio.com/docs/api/rest/queues#list>`_
documentation.
.. php:method:: create($friendly_name, $params = array())
Create a new :php:class:`Services_Twilio_Rest_Queue`.
:param string $friendly_name: The name of the new Queue.
:param array $params: An array of optional parameters and their values,
like `MaxSize`.
:returns: A new :php:class:`Services_Twilio_Rest_Queue`
UsageRecords
==============
.. php:class:: Services_Twilio_Rest_UsageRecords
For more information, including a list of filter parameters, see the `UsageRecords List Resource <http://www.twilio.com/docs/api/rest/usage-records#list>`_ documentation.
.. php:method:: getCategory($category)
Return the single UsageRecord corresponding to this category of usage.
Valid only for the `Records`, `Today`, `Yesterday`, `ThisMonth`,
`LastMonth` and `AllTime` resources.
:param string $category: The category to retrieve a usage record for. For a full list of valid categories, see the full `Usage Category documentation <http://www.twilio.com/docs/api/rest/usage-records#usage-all-categories>`_.
:returns: :php:class:`Services_Twilio_Rest_UsageRecord` A single usage record
UsageTriggers
=============
.. php:class:: Services_Twilio_Rest_UsageTriggers
For more information, including a list of filter parameters, see the `UsageTriggers List Resource <http://www.twilio.com/docs/api/rest/usage-triggers#list>`_ documentation.
.. php:method:: create($category, $value, $url, $params = array())
Create a new UsageTrigger.
:param string $category: The category of usage to fire a trigger for. A full list of categories can be found in the `Usage Categories documentation <http://www.twilio.com/docs/api/rest/usage-records#usage-categories>`_.
:param string $value: Fire the trigger when usage crosses this value.
:param string $url: The URL to request when the trigger fires.
:param array $params: Optional parameters for this trigger. A full list of parameters can be found in the `Usage Trigger documentation <http://www.twilio.com/docs/api/rest/usage-triggers#list-post-optional-parameters>`_.
:returns: :php:class:`Services_Twilio_Rest_UsageTrigger` The created trigger.
********************
Instance Resources
********************
.. phpautoclass:: Services_Twilio_InstanceResource
:filename: ../Services/Twilio/InstanceResource.php
:members:
Below you will find a list of objects created by interacting with the Twilio
API, and the methods and properties that can be called on them. These are
derived from the :php:class:`ListResource <Services_Twilio_ListResource>` and
:php:class:`InstanceResource <Services_Twilio_InstanceResource>` above.
Account
========
.. php:class:: Services_Twilio_Rest_Account
For more information, see the `Account Instance Resource <http://www.twilio.com/docs/api/rest/account#instance>`_ documentation.
.. php:method:: update($params)
Update the account
The **$params** array is the same as in :php:meth:`Services_Twilio_Rest_Accounts::create`
.. php:attr:: sid
A 34 character string that uniquely identifies this account.
.. php:attr:: date_created
The date that this account was created, in GMT in RFC 2822 format
.. php:attr:: date_updated
The date that this account was last updated, in GMT in RFC 2822 format.
.. php:attr:: friendly_name
A human readable description of this account, up to 64 characters long. By default the FriendlyName is your email address.
.. php:attr:: status
The status of this account. Usually active, but can be suspended if you've been bad, or closed if you've been horrible.
.. php:attr:: auth_token
The authorization token for this account. This token should be kept a secret, so no sharing.
Application
===========
.. php:class:: Services_Twilio_Rest_Application
For more information, see the `Application Instance Resource <http://www.twilio.com/docs/api/rest/applications#instance>`_ documentation.
.. php:attr:: sid
A 34 character string that uniquely idetifies this resource.
.. php:attr:: date_created
The date that this resource was created, given as GMT RFC 2822 format.
.. php:attr:: date_updated
The date that this resource was last updated, given as GMT RFC 2822 format.
.. php:attr:: friendly_name
A human readable descriptive text for this resource, up to 64 characters long. By default, the FriendlyName is a nicely formatted version of the phone number.
.. php:attr:: account_sid
The unique id of the Account responsible for this phone number.
.. php:attr:: api_version
Calls to this phone number will start a new TwiML session with this API version.
.. php:attr:: voice_caller_id_lookup
Look up the caller's caller-ID name from the CNAM database (additional charges apply). Either true or false.
.. php:attr:: voice_url
The URL Twilio will request when this phone number receives a call.
.. php:attr:: voice_method
The HTTP method Twilio will use when requesting the above Url. Either GET or POST.
.. php:attr:: voice_fallback_url
The URL that Twilio will request if an error occurs retrieving or executing the TwiML requested by Url.
.. php:attr:: voice_fallback_method
The HTTP method Twilio will use when requesting the VoiceFallbackUrl. Either GET or POST.
.. php:attr:: status_callback
The URL that Twilio will request to pass status parameters (such as call ended) to your application.
.. php:attr:: status_callback_method
The HTTP method Twilio will use to make requests to the StatusCallback URL. Either GET or POST.
.. php:attr:: sms_url
The URL Twilio will request when receiving an incoming SMS message to this number.
.. php:attr:: sms_method
The HTTP method Twilio will use when making requests to the SmsUrl. Either GET or POST.
.. php:attr:: sms_fallback_url
The URL that Twilio will request if an error occurs retrieving or executing the TwiML from SmsUrl.
.. php:attr:: sms_fallback_method
The HTTP method Twilio will use when requesting the above URL. Either GET or POST.
.. php:attr:: uri
The URI for this resource, relative to https://api.twilio.com.
AvailablePhoneNumber
========================
.. php:class:: Services_Twilio_Rest_AvailablePhoneNumber
For more information, see the `AvailablePhoneNumber Instance Resource <http://www.twilio.com/docs/api/rest/available-phone-numbers#instance>`_ documentation.
.. php:attr:: friendly_name
A nicely-formatted version of the phone number.
.. php:attr:: phone_number
The phone number, in E.164 (i.e. "+1") format.
.. php:attr:: lata
The LATA of this phone number.
.. php:attr:: rate_center
The rate center of this phone number.
.. php:attr:: latitude
The latitude coordinate of this phone number.
.. php:attr:: longitude
The longitude coordinate of this phone number.
.. php:attr:: region
The two-letter state or province abbreviation of this phone number.
.. php:attr:: postal_code
The postal (zip) code of this phone number.
.. php:attr:: iso_country
Call
====
.. phpautoclass:: Services_Twilio_Rest_Call
:filename: ../Services/Twilio/Rest/Call.php
:members:
CallerId
============
.. php:class:: Services_Twilio_Rest_OutgoingCallerId
For more information, see the `OutgoingCallerId Instance Resource <http://www.twilio.com/docs/api/rest/outgoing-caller-ids#instance>`_ documentation.
.. php:attr:: sid
A 34 character string that uniquely identifies this resource.
.. php:attr:: date_created
The date that this resource was created, given in RFC 2822 format.
.. php:attr:: date_updated
The date that this resource was last updated, given in RFC 2822 format.
.. php:attr:: friendly_name
A human readable descriptive text for this resource, up to 64 characters long. By default, the FriendlyName is a nicely formatted version of the phone number.
.. php:attr:: account_sid
The unique id of the Account responsible for this Caller Id.
.. php:attr:: phone_number
The incoming phone number. Formatted with a '+' and country code e.g., +16175551212 (E.164 format).
.. php:attr:: uri
The URI for this resource, relative to https://api.twilio.com.
Conference
=============
.. php:class:: Services_Twilio_Rest_Conference
For more information, see the `Conference Instance Resource <http://www.twilio.com/docs/api/rest/conference#instance>`_ documentation.
.. php:attr:: sid
A 34 character string that uniquely identifies this conference.
.. php:attr:: friendly_name
A user provided string that identifies this conference room.
.. php:attr:: status
A string representing the status of the conference. May be init, in-progress, or completed.
.. php:attr:: date_created
The date that this conference was created, given as GMT in RFC 2822 format.
.. php:attr:: date_updated
The date that this conference was last updated, given as GMT in RFC 2822 format.
.. php:attr:: account_sid
The unique id of the Account responsible for creating this conference.
.. php:attr:: uri
The URI for this resource, relative to https://api.twilio.com.
.. php:attr:: participants
The :php:class:`Services_Twilio_Rest_Participants` instance, listing people currently in this conference
CredentialListMapping
=========================
.. phpautoclass:: Services_Twilio_Rest_CredentialListMapping
:filename: ../Services/Twilio/Rest/CredentialListMapping.php
:members:
CredentialList
=================
.. phpautoclass:: Services_Twilio_Rest_CredentialList
:filename: ../Services/Twilio/Rest/CredentialList.php
:members:
Credential
==============
.. phpautoclass:: Services_Twilio_Rest_Credential
:filename: ../Services/Twilio/Rest/Credential.php
:members:
Domain
==========
.. phpautoclass:: Services_Twilio_Rest_Domain
:filename: ../Services/Twilio/Rest/Domain.php
:members:
IncomingPhoneNumber
===================
.. phpautoclass:: Services_Twilio_Rest_IncomingPhoneNumber
:filename: ../Services/Twilio/Rest/IncomingPhoneNumber.php
:members:
IpAccessControlListMapping
==============================
.. phpautoclass:: Services_Twilio_Rest_IpAccessControlListMapping
:filename: ../Services/Twilio/Rest/IpAccessControlListMapping.php
:members:
IpAccessControlList
=======================
.. phpautoclass:: Services_Twilio_Rest_IpAccessControlList
:filename: ../Services/Twilio/Rest/IpAccessControlList.php
:members:
IpAddress
==============
.. phpautoclass:: Services_Twilio_Rest_IpAddress
:filename: ../Services/Twilio/Rest/IpAddress.php
:members:
Notification
=============
.. php:class:: Services_Twilio_Rest_Notification
For more information, see the `Notification Instance Resource <http://www.twilio.com/docs/api/rest/notification#instance>`_ documentation.
.. php:attr:: sid
A 34 character string that uniquely identifies this resource.
.. php:attr:: date_created
The date that this resource was created, given in RFC 2822 format.
.. php:attr:: date_updated
The date that this resource was last updated, given in RFC 2822 format.
.. php:attr:: account_sid
The unique id of the Account responsible for this notification.
.. php:attr:: call_sid
CallSid is the unique id of the call during which the notification was generated. Empty if the notification was generated by the REST API without regard to a specific phone call.
.. php:attr:: api_version
The version of the Twilio in use when this notification was generated.
.. php:attr:: log
An integer log level corresponding to the type of notification: 0 is ERROR, 1 is WARNING.
.. php:attr:: error_code
A unique error code for the error condition. You can lookup errors, with possible causes and solutions, in our `Error Dictionary <http://www.twilio.com/docs/errors/reference>`_.
.. php:attr:: more_info
A URL for more information about the error condition. The URL is a page in our `Error Dictionary <http://www.twilio.com/docs/errors/reference>`_.
.. php:attr:: message_text
The text of the notification.
.. php:attr:: message_date
The date the notification was actually generated, given in RFC 2822
format. Due to buffering, this may be slightly different than the
DateCreated date.
.. php:attr:: request_url
The URL of the resource that generated the notification. If the
notification was generated during a phone call: This is the URL of the
resource on YOUR SERVER that caused the notification. If the notification
was generated by your use of the REST API: This is the URL of the REST
resource you were attempting to request on Twilio's servers.
.. php:attr:: request_method
The HTTP method in use for the request that generated the notification. If
the notification was generated during a phone call: The HTTP Method use to
request the resource on your server. If the notification was generated by
your use of the REST API: This is the HTTP method used in your request to
the REST resource on Twilio's servers.
.. php:attr:: request_variables
The Twilio-generated HTTP GET or POST variables sent to your server. Alternatively, if the notification was generated by the REST API, this field will include any HTTP POST or PUT variables you sent to the REST API.
.. php:attr:: response_headers
The HTTP headers returned by your server.
.. php:attr:: response_body
The HTTP body returned by your server.
.. php:attr:: uri
The URI for this resource, relative to https://api.twilio.com
Media
=======
.. phpautoclass:: Services_Twilio_Rest_MediaInstance
:filename: ../Services/Twilio/Rest/MediaInstance.php
:members:
Member
=======
.. php:class:: Services_Twilio_Rest_Member
For more information about available properties, see the `Member Instance Resource <http://www.twilio.com/docs/api/rest/member#instance>`_ documentation.
.. php:method:: dequeue($url, $method = 'POST')
Dequeue this member and immediately play the Twiml at the given ``$url``.
:param string $url: The Twiml URL to play for this member, after dequeuing them
:param string $method: The HTTP method to use when fetching the Twiml URL. Defaults to POST.
:return: The dequeued member
:rtype: :php:class:`Member <Services_Twilio_Rest_Member>`
Participant
=============
.. php:class:: Services_Twilio_Rest_Participant
For more information, see the `Participant Instance Resource <http://www.twilio.com/docs/api/rest/participant#instance>`_ documentation.
.. php:attr:: call_sid
A 34 character string that uniquely identifies the call that is connected to this conference
.. php:attr:: conference_sid
A 34 character string that identifies the conference this participant is in
.. php:attr:: date_created
The date that this resource was created, given in RFC 2822 format.
.. php:attr:: date_updated
The date that this resource was last updated, given in RFC 2822 format.
.. php:attr:: account_sid
The unique id of the Account that created this conference
.. php:attr:: muted
true if this participant is currently muted. false otherwise.
.. php:attr:: start_conference_on_enter
Was the startConferenceOnEnter attribute set on this participant (true or false)?
.. php:attr:: end_conference_on_exit
Was the endConferenceOnExit attribute set on this participant (true or false)?
.. php:attr:: uri
The URI for this resource, relative to https://api.twilio.com.
Queue
============
.. php:class:: Services_Twilio_Rest_Queue
For more information about available properties of a queue, see the `Queue
Instance Resource <http://www.twilio.com/docs/api/rest/queue#instance>`_
documentation. A Queue has one subresource, a list of
:php:class:`Services_Twilio_Rest_Members`.
Recording
=============
.. php:class:: Services_Twilio_Rest_Recording
For more information, see the `Recording Instance Resource <http://www.twilio.com/docs/api/rest/recording#instance>`_ documentation.
.. php:attr:: sid
A 34 character string that uniquely identifies this resource.
.. php:attr:: date_created
The date that this resource was created, given in RFC 2822 format.
.. php:attr:: date_updated
The date that this resource was last updated, given in RFC 2822 format.
.. php:attr:: account_sid
The unique id of the Account responsible for this recording.
.. php:attr:: call_sid
The call during which the recording was made.
.. php:attr:: duration
The length of the recording, in seconds.
.. php:attr:: api_version
The version of the API in use during the recording.
.. php:attr:: uri
The URI for this resource, relative to https://api.twilio.com
.. php:attr:: subresource_uris
The list of subresources under this account
.. php:attr:: formats
A dictionary of the audio formats available for this recording
.. code-block:: php
array(
'wav' => 'https://api.twilio.com/path/to/recording.wav',
'mp3' => 'https://api.twilio.com/path/to/recording.mp3',
)
Message
=======
.. phpautoclass:: Services_Twilio_Rest_Message
:filename: ../Services/Twilio/Rest/Message.php
:members:
SmsMessage
===========
.. php:class:: Services_Twilio_Rest_SmsMessage
For more information, see the `SMS Message Instance Resource <http://www.twilio.com/docs/api/rest/sms#instance>`_ documentation.
.. php:attr:: sid
A 34 character string that uniquely identifies this resource.
.. php:attr:: date_created
The date that this resource was created, given in RFC 2822 format.
.. php:attr:: date_updated
The date that this resource was last updated, given in RFC 2822 format.
.. php:attr:: date_sent
The date that the SMS was sent, given in RFC 2822 format.
.. php:attr:: account_sid
The unique id of the Account that sent this SMS message.
.. php:attr:: from
The phone number that initiated the message in E.164 format. For incoming messages, this will be the remote phone. For outgoing messages, this will be one of your Twilio phone numbers.
.. php:attr:: to
The phone number that received the message in E.164 format. For incoming messages, this will be one of your Twilio phone numbers. For outgoing messages, this will be the remote phone.
.. php:attr:: body
The text body of the SMS message. Up to 160 characters long.
.. php:attr:: status
The status of this SMS message. Either queued, sending, sent, or failed.
.. php:attr:: direction
The direction of this SMS message. ``incoming`` for incoming messages,
``outbound-api`` for messages initiated via the REST API, ``outbound-call`` for
messages initiated during a call or ``outbound-reply`` for messages initiated in
response to an incoming SMS.
.. php:attr:: price
The amount billed for the message.
.. php:attr:: api_version
The version of the Twilio API used to process the SMS message.
.. php:attr:: uri
The URI for this resource, relative to https://api.twilio.com
Transcription
==================
.. php:class:: Services_Twilio_Rest_Transcription
For more information, see the `Transcription Instance Resource <http://www.twilio.com/docs/api/rest/transcription#instance>`_ documentation.
.. php:attr:: sid
A 34 character string that uniquely identifies this resource.
.. php:attr:: date_created
The date that this resource was created, given in RFC 2822 format.
.. php:attr:: date_updated
The date that this resource was last updated, given in RFC 2822 format.
.. php:attr:: account_sid
The unique id of the Account responsible for this transcription.
.. php:attr:: status
A string representing the status of the transcription: ``in-progress``, ``completed`` or ``failed``.
.. php:attr:: recording_sid
The unique id of the Recording this Transcription was made of.
.. php:attr:: duration
The duration of the transcribed audio, in seconds.
.. php:attr:: transcription_text
The text content of the transcription.
.. php:attr:: price
The charge for this transcript in USD. Populated after the transcript is completed. Note, this value may not be immediately available.
.. php:attr:: uri
The URI for this resource, relative to https://api.twilio.com

View file

@ -1,26 +0,0 @@
###############################
HTTP Helper Classes
###############################
**********************
The Twilio Rest Client
**********************
.. phpautoclass:: Services_Twilio
:filename: ../Services/Twilio.php
:members:
***************************
Twilio's Custom HTTP Client
***************************
.. phpautoclass:: Services_Twilio_TinyHttp
:filename: ../Services/Twilio/TinyHttp.php
:members:
***********************
Twilio Rest Exceptions
***********************
.. phpautoclass:: Services_Twilio_RestException
:filename: ../Services/Twilio/RestException.php
:members:

View file

@ -1,7 +0,0 @@
###########################################
API for TwiML Generation
###########################################
.. phpautoclass:: Services_Twilio_Twiml
:filename: ../Services/Twilio/Twiml.php
:members:

Some files were not shown because too many files have changed in this diff Show more