is one of"
19 | @echo " html to make standalone HTML files"
20 | @echo " dirhtml to make HTML files named index.html in directories"
21 | @echo " singlehtml to make a single large HTML file"
22 | @echo " pickle to make pickle files"
23 | @echo " json to make JSON files"
24 | @echo " htmlhelp to make HTML files and a HTML help project"
25 | @echo " qthelp to make HTML files and a qthelp project"
26 | @echo " devhelp to make HTML files and a Devhelp project"
27 | @echo " epub to make an epub"
28 | @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
29 | @echo " latexpdf to make LaTeX files and run them through pdflatex"
30 | @echo " text to make text files"
31 | @echo " man to make manual pages"
32 | @echo " changes to make an overview of all changed/added/deprecated items"
33 | @echo " linkcheck to check all external links for integrity"
34 | @echo " doctest to run all doctests embedded in the documentation (if enabled)"
35 |
36 | clean:
37 | -rm -rf $(BUILDDIR)/*
38 |
39 | html:
40 | $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
41 | @echo
42 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
43 |
44 | dirhtml:
45 | $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
46 | @echo
47 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
48 |
49 | singlehtml:
50 | $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
51 | @echo
52 | @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
53 |
54 | pickle:
55 | $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
56 | @echo
57 | @echo "Build finished; now you can process the pickle files."
58 |
59 | json:
60 | $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
61 | @echo
62 | @echo "Build finished; now you can process the JSON files."
63 |
64 | htmlhelp:
65 | $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
66 | @echo
67 | @echo "Build finished; now you can run HTML Help Workshop with the" \
68 | ".hhp project file in $(BUILDDIR)/htmlhelp."
69 |
70 | qthelp:
71 | $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
72 | @echo
73 | @echo "Build finished; now you can run "qcollectiongenerator" with the" \
74 | ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
75 | @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Services_Twilio.qhcp"
76 | @echo "To view the help file:"
77 | @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Services_Twilio.qhc"
78 |
79 | devhelp:
80 | $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
81 | @echo
82 | @echo "Build finished."
83 | @echo "To view the help file:"
84 | @echo "# mkdir -p $$HOME/.local/share/devhelp/Services_Twilio"
85 | @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/Services_Twilio"
86 | @echo "# devhelp"
87 |
88 | epub:
89 | $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
90 | @echo
91 | @echo "Build finished. The epub file is in $(BUILDDIR)/epub."
92 |
93 | latex:
94 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
95 | @echo
96 | @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
97 | @echo "Run \`make' in that directory to run these through (pdf)latex" \
98 | "(use \`make latexpdf' here to do that automatically)."
99 |
100 | latexpdf:
101 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
102 | @echo "Running LaTeX files through pdflatex..."
103 | make -C $(BUILDDIR)/latex all-pdf
104 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
105 |
106 | text:
107 | $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
108 | @echo
109 | @echo "Build finished. The text files are in $(BUILDDIR)/text."
110 |
111 | man:
112 | $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
113 | @echo
114 | @echo "Build finished. The manual pages are in $(BUILDDIR)/man."
115 |
116 | changes:
117 | $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
118 | @echo
119 | @echo "The overview file is in $(BUILDDIR)/changes."
120 |
121 | linkcheck:
122 | $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
123 | @echo
124 | @echo "Link check complete; look for any errors in the above output " \
125 | "or in $(BUILDDIR)/linkcheck/output.txt."
126 |
127 | doctest:
128 | $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
129 | @echo "Testing of doctests in the sources finished, look at the " \
130 | "results in $(BUILDDIR)/doctest/output.txt."
131 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/docs/_themes/.gitignore:
--------------------------------------------------------------------------------
1 | *.pyc
2 | *.pyo
3 | .DS_Store
4 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/docs/_themes/LICENSE:
--------------------------------------------------------------------------------
1 | Modifications:
2 |
3 | Copyright (c) 2011 Kenneth Reitz.
4 |
5 |
6 | Original Project:
7 |
8 | Copyright (c) 2010 by Armin Ronacher.
9 |
10 |
11 | Some rights reserved.
12 |
13 | Redistribution and use in source and binary forms of the theme, with or
14 | without modification, are permitted provided that the following conditions
15 | are met:
16 |
17 | * Redistributions of source code must retain the above copyright
18 | notice, this list of conditions and the following disclaimer.
19 |
20 | * Redistributions in binary form must reproduce the above
21 | copyright notice, this list of conditions and the following
22 | disclaimer in the documentation and/or other materials provided
23 | with the distribution.
24 |
25 | * The names of the contributors may not be used to endorse or
26 | promote products derived from this software without specific
27 | prior written permission.
28 |
29 | We kindly ask you to only use these themes in an unmodified manner just
30 | for Flask and Flask-related products, not for unrelated projects. If you
31 | like the visual style and want to use it for your own projects, please
32 | consider making some larger changes to the themes (such as changing
33 | font faces, sizes, colors or margins).
34 |
35 | THIS THEME IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
36 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
37 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
38 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
39 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
40 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
41 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
42 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
43 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
44 | ARISING IN ANY WAY OUT OF THE USE OF THIS THEME, EVEN IF ADVISED OF THE
45 | POSSIBILITY OF SUCH DAMAGE.
46 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/docs/_themes/README.rst:
--------------------------------------------------------------------------------
1 | krTheme Sphinx Style
2 | ====================
3 |
4 | This repository contains sphinx styles Kenneth Reitz uses in most of
5 | his projects. It is a drivative of Mitsuhiko's themes for Flask and Flask related
6 | projects. To use this style in your Sphinx documentation, follow
7 | this guide:
8 |
9 | 1. put this folder as _themes into your docs folder. Alternatively
10 | you can also use git submodules to check out the contents there.
11 |
12 | 2. add this to your conf.py: ::
13 |
14 | sys.path.append(os.path.abspath('_themes'))
15 | html_theme_path = ['_themes']
16 | html_theme = 'flask'
17 |
18 | The following themes exist:
19 |
20 | **kr**
21 | the standard flask documentation theme for large projects
22 |
23 | **kr_small**
24 | small one-page theme. Intended to be used by very small addon libraries.
25 |
26 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/docs/_themes/flask_theme_support.py:
--------------------------------------------------------------------------------
1 | # flasky extensions. flasky pygments style based on tango style
2 | from pygments.style import Style
3 | from pygments.token import Keyword, Name, Comment, String, Error, \
4 | Number, Operator, Generic, Whitespace, Punctuation, Other, Literal
5 |
6 |
7 | class FlaskyStyle(Style):
8 | background_color = "#f8f8f8"
9 | default_style = ""
10 |
11 | styles = {
12 | # No corresponding class for the following:
13 | #Text: "", # class: ''
14 | Whitespace: "underline #f8f8f8", # class: 'w'
15 | Error: "#a40000 border:#ef2929", # class: 'err'
16 | Other: "#000000", # class 'x'
17 |
18 | Comment: "italic #8f5902", # class: 'c'
19 | Comment.Preproc: "noitalic", # class: 'cp'
20 |
21 | Keyword: "bold #004461", # class: 'k'
22 | Keyword.Constant: "bold #004461", # class: 'kc'
23 | Keyword.Declaration: "bold #004461", # class: 'kd'
24 | Keyword.Namespace: "bold #004461", # class: 'kn'
25 | Keyword.Pseudo: "bold #004461", # class: 'kp'
26 | Keyword.Reserved: "bold #004461", # class: 'kr'
27 | Keyword.Type: "bold #004461", # class: 'kt'
28 |
29 | Operator: "#582800", # class: 'o'
30 | Operator.Word: "bold #004461", # class: 'ow' - like keywords
31 |
32 | Punctuation: "bold #000000", # class: 'p'
33 |
34 | # because special names such as Name.Class, Name.Function, etc.
35 | # are not recognized as such later in the parsing, we choose them
36 | # to look the same as ordinary variables.
37 | Name: "#000000", # class: 'n'
38 | Name.Attribute: "#c4a000", # class: 'na' - to be revised
39 | Name.Builtin: "#004461", # class: 'nb'
40 | Name.Builtin.Pseudo: "#3465a4", # class: 'bp'
41 | Name.Class: "#000000", # class: 'nc' - to be revised
42 | Name.Constant: "#000000", # class: 'no' - to be revised
43 | Name.Decorator: "#888", # class: 'nd' - to be revised
44 | Name.Entity: "#ce5c00", # class: 'ni'
45 | Name.Exception: "bold #cc0000", # class: 'ne'
46 | Name.Function: "#000000", # class: 'nf'
47 | Name.Property: "#000000", # class: 'py'
48 | Name.Label: "#f57900", # class: 'nl'
49 | Name.Namespace: "#000000", # class: 'nn' - to be revised
50 | Name.Other: "#000000", # class: 'nx'
51 | Name.Tag: "bold #004461", # class: 'nt' - like a keyword
52 | Name.Variable: "#000000", # class: 'nv' - to be revised
53 | Name.Variable.Class: "#000000", # class: 'vc' - to be revised
54 | Name.Variable.Global: "#000000", # class: 'vg' - to be revised
55 | Name.Variable.Instance: "#000000", # class: 'vi' - to be revised
56 |
57 | Number: "#990000", # class: 'm'
58 |
59 | Literal: "#000000", # class: 'l'
60 | Literal.Date: "#000000", # class: 'ld'
61 |
62 | String: "#4e9a06", # class: 's'
63 | String.Backtick: "#4e9a06", # class: 'sb'
64 | String.Char: "#4e9a06", # class: 'sc'
65 | String.Doc: "italic #8f5902", # class: 'sd' - like a comment
66 | String.Double: "#4e9a06", # class: 's2'
67 | String.Escape: "#4e9a06", # class: 'se'
68 | String.Heredoc: "#4e9a06", # class: 'sh'
69 | String.Interpol: "#4e9a06", # class: 'si'
70 | String.Other: "#4e9a06", # class: 'sx'
71 | String.Regex: "#4e9a06", # class: 'sr'
72 | String.Single: "#4e9a06", # class: 's1'
73 | String.Symbol: "#4e9a06", # class: 'ss'
74 |
75 | Generic: "#000000", # class: 'g'
76 | Generic.Deleted: "#a40000", # class: 'gd'
77 | Generic.Emph: "italic #000000", # class: 'ge'
78 | Generic.Error: "#ef2929", # class: 'gr'
79 | Generic.Heading: "bold #000080", # class: 'gh'
80 | Generic.Inserted: "#00A000", # class: 'gi'
81 | Generic.Output: "#888", # class: 'go'
82 | Generic.Prompt: "#745334", # class: 'gp'
83 | Generic.Strong: "bold #000000", # class: 'gs'
84 | Generic.Subheading: "bold #800080", # class: 'gu'
85 | Generic.Traceback: "bold #a40000", # class: 'gt'
86 | }
87 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/docs/_themes/kr/layout.html:
--------------------------------------------------------------------------------
1 | {%- extends "basic/layout.html" %}
2 | {%- block extrahead %}
3 | {{ super() }}
4 | {% if theme_touch_icon %}
5 |
6 | {% endif %}
7 |
9 | {% endblock %}
10 | {%- block relbar2 %}{% endblock %}
11 | {%- block footer %}
12 |
15 |
28 |
29 |
30 |
31 |
32 | {%- endblock %}
33 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/docs/_themes/kr/relations.html:
--------------------------------------------------------------------------------
1 | Related Topics
2 |
20 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/docs/_themes/kr/static/small_flask.css:
--------------------------------------------------------------------------------
1 | /*
2 | * small_flask.css_t
3 | * ~~~~~~~~~~~~~~~~~
4 | *
5 | * :copyright: Copyright 2010 by Armin Ronacher.
6 | * :license: Flask Design License, see LICENSE for details.
7 | */
8 |
9 | body {
10 | margin: 0;
11 | padding: 20px 30px;
12 | }
13 |
14 | div.documentwrapper {
15 | float: none;
16 | background: white;
17 | }
18 |
19 | div.sphinxsidebar {
20 | display: block;
21 | float: none;
22 | width: 102.5%;
23 | margin: 50px -30px -20px -30px;
24 | padding: 10px 20px;
25 | background: #333;
26 | color: white;
27 | }
28 |
29 | div.sphinxsidebar h3, div.sphinxsidebar h4, div.sphinxsidebar p,
30 | div.sphinxsidebar h3 a {
31 | color: white;
32 | }
33 |
34 | div.sphinxsidebar a {
35 | color: #aaa;
36 | }
37 |
38 | div.sphinxsidebar p.logo {
39 | display: none;
40 | }
41 |
42 | div.document {
43 | width: 100%;
44 | margin: 0;
45 | }
46 |
47 | div.related {
48 | display: block;
49 | margin: 0;
50 | padding: 10px 0 20px 0;
51 | }
52 |
53 | div.related ul,
54 | div.related ul li {
55 | margin: 0;
56 | padding: 0;
57 | }
58 |
59 | div.footer {
60 | display: none;
61 | }
62 |
63 | div.bodywrapper {
64 | margin: 0;
65 | }
66 |
67 | div.body {
68 | min-height: 0;
69 | padding: 0;
70 | }
71 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/docs/_themes/kr/theme.conf:
--------------------------------------------------------------------------------
1 | [theme]
2 | inherit = basic
3 | stylesheet = flasky.css
4 | pygments_style = flask_theme_support.FlaskyStyle
5 |
6 | [options]
7 | touch_icon =
8 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/docs/_themes/kr_small/layout.html:
--------------------------------------------------------------------------------
1 | {% extends "basic/layout.html" %}
2 | {% block header %}
3 | {{ super() }}
4 | {% if pagename == 'index' %}
5 |
6 | {% endif %}
7 | {% endblock %}
8 | {% block footer %}
9 | {% if pagename == 'index' %}
10 |
11 | {% endif %}
12 | {% endblock %}
13 | {# do not display relbars #}
14 | {% block relbar1 %}{% endblock %}
15 | {% block relbar2 %}
16 | {% if theme_github_fork %}
17 |
19 | {% endif %}
20 | {% endblock %}
21 | {% block sidebar1 %}{% endblock %}
22 | {% block sidebar2 %}{% endblock %}
23 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/docs/_themes/kr_small/theme.conf:
--------------------------------------------------------------------------------
1 | [theme]
2 | inherit = basic
3 | stylesheet = flasky.css
4 | nosidebar = true
5 | pygments_style = flask_theme_support.FlaskyStyle
6 |
7 | [options]
8 | index_logo = ''
9 | index_logo_height = 120px
10 | github_fork = ''
11 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/docs/api/services.rst:
--------------------------------------------------------------------------------
1 | ###############################
2 | HTTP Helper Classes
3 | ###############################
4 |
5 | **********************
6 | The Twilio Rest Client
7 | **********************
8 |
9 | .. phpautoclass:: Services_Twilio
10 | :filename: ../Services/Twilio.php
11 | :members:
12 |
13 | ***************************
14 | Twilio's Custom HTTP Client
15 | ***************************
16 |
17 | .. phpautoclass:: Services_Twilio_TinyHttp
18 | :filename: ../Services/Twilio/TinyHttp.php
19 | :members:
20 |
21 | ***********************
22 | Twilio Rest Exceptions
23 | ***********************
24 | .. phpautoclass:: Services_Twilio_RestException
25 | :filename: ../Services/Twilio/RestException.php
26 | :members:
27 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/docs/api/twiml.rst:
--------------------------------------------------------------------------------
1 | ###########################################
2 | API for TwiML Generation
3 | ###########################################
4 |
5 | .. phpautoclass:: Services_Twilio_Twiml
6 | :filename: ../Services/Twilio/Twiml.php
7 | :members:
8 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/docs/index.rst:
--------------------------------------------------------------------------------
1 | .. Services_Twilio documentation master file, created by
2 | sphinx-quickstart on Tue Mar 8 04:02:01 2011.
3 | You can adapt this file completely to your liking, but it should at least
4 | contain the root `toctree` directive.
5 |
6 | =================
7 | **twilio-php**
8 | =================
9 |
10 | Status
11 | =======
12 |
13 | This documentation is for version 3.12.5 of `twilio-php
14 | `_.
15 |
16 | Quickstart
17 | ============
18 |
19 | Send an SMS
20 | >>>>>>>>>>>
21 |
22 | .. code-block:: php
23 |
24 | // Download the library and copy into the folder containing this file.
25 | require('/path/to/twilio-php/Services/Twilio.php');
26 |
27 | $account_sid = "ACXXXXXX"; // Your Twilio account sid
28 | $auth_token = "YYYYYY"; // Your Twilio auth token
29 |
30 | $client = new Services_Twilio($account_sid, $auth_token);
31 | $message = $client->account->messages->sendMessage(
32 | '+14085551234', // From a Twilio number in your account
33 | '+12125551234', // Text any number
34 | "Hello monkey!"
35 | );
36 |
37 | print $message->sid;
38 |
39 | Make a Call
40 | >>>>>>>>>>>>>>
41 |
42 | .. code-block:: php
43 |
44 | // Download the library and copy into the folder containing this file.
45 | require('/path/to/twilio-php/Services/Twilio.php');
46 |
47 | $account_sid = "ACXXXXXX"; // Your Twilio account sid
48 | $auth_token = "YYYYYY"; // Your Twilio auth token
49 |
50 | $client = new Services_Twilio($account_sid, $auth_token);
51 | $call = $client->account->calls->create(
52 | '+14085551234', // From a Twilio number in your account
53 | '+12125551234', // Call any number
54 |
55 | // Read TwiML at this URL when a call connects (hold music)
56 | 'http://twimlets.com/holdmusic?Bucket=com.twilio.music.ambient'
57 | );
58 |
59 | Generating TwiML
60 | >>>>>>>>>>>>>>>>
61 |
62 | To control phone calls, your application needs to output `TwiML
63 | `_. Use :class:`Services_Twilio_Twiml`
64 | to easily create such responses.
65 |
66 | .. code-block:: php
67 |
68 | $response = new Services_Twilio_Twiml();
69 | $response->say('Hello');
70 | $response->play('https://api.twilio.com/cowbell.mp3', array("loop" => 5));
71 | print $response;
72 |
73 | .. code-block:: xml
74 |
75 |
76 |
77 | Hello
78 | https://api.twilio.com/cowbell.mp3
79 |
80 |
81 | View more examples of TwiML generation here: :ref:`usage-twiml`
82 |
83 | Installation
84 | ============
85 |
86 | There are two ways to install **twilio-php**: via the PEAR installer, or by
87 | downloading the source.
88 |
89 | Via PEAR
90 | >>>>>>>>>>>>>
91 |
92 | Use the ``Makefile`` in the repo's top
93 |
94 | .. code-block:: bash
95 |
96 | pear channel-discover twilio.github.com/pear
97 | pear install twilio/Services_Twilio
98 |
99 | From Source
100 | >>>>>>>>>>>>>
101 |
102 | If you aren't using PEAR, download the `source (.zip)
103 | `_, which includes all the
104 | dependencies.
105 |
106 | User Guide
107 | ==================
108 |
109 | REST API
110 | >>>>>>>>>>
111 |
112 | .. toctree::
113 | :maxdepth: 2
114 | :glob:
115 |
116 | usage/rest
117 | usage/rest/*
118 |
119 | TwiML and other utilities
120 | >>>>>>>>>>>>>>>>>>>>>>>>>>
121 |
122 | .. toctree::
123 | :maxdepth: 1
124 |
125 | usage/twiml
126 | usage/validation
127 | usage/token-generation
128 | faq/
129 |
130 | API Documentation
131 | ==================
132 |
133 | .. toctree::
134 | :maxdepth: 3
135 | :glob:
136 |
137 | api/*
138 |
139 |
140 | Support and Development
141 | ===========================
142 |
143 | All development occurs on `Github `_. To
144 | check out the source, run
145 |
146 | .. code-block:: bash
147 |
148 | git clone git@github.com:twilio/twilio-php.git
149 |
150 | Report bugs using the Github `issue tracker `_.
151 |
152 | If you've got questions that aren't answered by this documentation, ask the
153 | Twilio support team at help@twilio.com.
154 |
155 | Running the Tests
156 | >>>>>>>>>>>>>>>>>>>>>>>>>
157 |
158 | The unit tests depend on `Mockery `_ and
159 | `PHPUnit `_. First, 'discover' all
160 | the necessary `PEAR` channels:
161 |
162 | .. code-block:: bash
163 |
164 | make test-install
165 |
166 | After installation, run the tests with :data:`make`.
167 |
168 | .. code-block:: bash
169 |
170 | make test
171 |
172 |
173 | Making the Documentation
174 | >>>>>>>>>>>>>>>>>>>>>>>>>>
175 |
176 | Our documentation is written using `Sphinx `_. You'll
177 | need to install Sphinx and the Sphinx PHP domain before you can build the docs.
178 |
179 | .. code-block:: bash
180 |
181 | make docs-install
182 |
183 | Once you have those installed, making the docs is easy.
184 |
185 | .. code-block:: bash
186 |
187 | make docs
188 |
189 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/docs/quickstart.rst:
--------------------------------------------------------------------------------
1 | =============
2 | Quickstart
3 | =============
4 |
5 | Making a Call
6 | ==============
7 |
8 | .. code-block:: php
9 |
10 | $sid = "ACXXXXXX"; // Your Twilio account sid
11 | $token = "YYYYYY"; // Your Twilio auth token
12 |
13 | $client = new Services_Twilio($sid, $token);
14 | $call = $client->account->calls->create(
15 | '9991231234', // From this number
16 | '8881231234', // Call this number
17 | 'http://foo.com/call.xml'
18 | );
19 |
20 | Generating TwiML
21 | ==================
22 |
23 | To control phone calls, your application need to output TwiML. Use :class:`Services_Twilio_Twiml` to easily create such responses.
24 |
25 | .. code-block:: php
26 |
27 | $response = new Services_Twilio_Twiml();
28 | $response->say('Hello');
29 | print $response;
30 |
31 | .. code-block:: xml
32 |
33 |
34 | monkey.mp3
35 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/docs/requirements.txt:
--------------------------------------------------------------------------------
1 | sphinxcontrib-phpdomain
2 | hg+https://bitbucket.org/tk0miya/tk.phpautodoc
3 |
4 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/docs/usage/rest.rst:
--------------------------------------------------------------------------------
1 | .. _ref-rest:
2 |
3 | ==========================
4 | Using the Twilio REST API
5 | ==========================
6 |
7 | Since version 3.0, we've introduced an updated API for interacting with the
8 | Twilio REST API. Gone are the days of manual URL creation and XML parsing.
9 |
10 | Creating a REST Client
11 | =======================
12 |
13 | Before querying the API, you'll need to create a :php:class:`Services_Twilio`
14 | instance. The constructor takes your Twilio Account Sid and Auth
15 | Token (both available through your `Twilio Account Dashboard
16 | `_).
17 |
18 | .. code-block:: php
19 |
20 | $ACCOUNT_SID = "AC123";
21 | $AUTH_TOKEN = "secret";
22 | $client = new Services_Twilio($ACCOUNT_SID, $AUTH_TOKEN);
23 |
24 | The :attr:`account` attribute
25 | -----------------------------
26 |
27 | You access the Twilio API resources through this :attr:`$client`,
28 | specifically the :attr:`$account` attribute, which is an instance of
29 | :php:class:`Services_Twilio_Rest_Account`. We'll use the `Calls resource
30 | `_ as an example.
31 |
32 | Listing Resources
33 | ====================
34 |
35 | Iterating over the :attr:`calls` attribute will iterate over all of your call
36 | records, handling paging for you. Only use this when you need to get all your
37 | records.
38 |
39 | The :attr:`$call` object is a :php:class:`Services_Twilio_Rest_Call`, which
40 | means you can easily access fields through it's properties. The attribute names
41 | are lowercase and use underscores for sepearators. All the available attributes
42 | are documented in the :doc:`/api/rest` documentation.
43 |
44 | .. code-block:: php
45 |
46 | // If you have many calls, this could take a while
47 | foreach($client->account->calls as $call) {
48 | print $call->price . '\n';
49 | print $call->duration . '\n';
50 | }
51 |
52 | Filtering Resources
53 | -------------------
54 |
55 | Many Twilio list resources allow for filtering via :php:meth:`getIterator`
56 | which takes an optional array of filter parameters. These parameters correspond
57 | directlty to the listed query string parameters in the REST API documentation.
58 |
59 | You can create a filtered iterator like this:
60 |
61 | .. code-block:: php
62 |
63 | $filteredCalls = $client->account->calls->getIterator(
64 | 0, 50, array("Status" => "in-progress"));
65 | foreach($filteredCalls as $call) {
66 | print $call->price . '\n';
67 | print $call->duration . '\n';
68 | }
69 |
70 | Retrieving the Total Number of Resources
71 | ----------------------------------------
72 |
73 | Each of the list resources supports the `Countable` interface, which means you
74 | can retrieve the total number of list items like so:
75 |
76 | .. code-block:: php
77 |
78 | echo count($client->account->calls);
79 |
80 | Getting a Specific Resource
81 | =============================
82 |
83 | If you know the unique identifier for a resource, you can get that resource
84 | using the :php:meth:`get` method on the list resource.
85 |
86 | .. code-block:: php
87 |
88 | $call = $client->account->calls->get("CA123");
89 |
90 | :php:meth:`get` fetches objects lazily, so it will only load a resource when it
91 | is needed. This allows you to get nested objects without making multiple HTTP
92 | requests.
93 |
94 | .. code-block:: php
95 |
96 | $participant = $client->account->conferences
97 | ->get("CO123")->participants->get("PF123");
98 |
99 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/docs/usage/rest/accounts.rst:
--------------------------------------------------------------------------------
1 | ==================
2 | Accounts
3 | ==================
4 |
5 | Updating Account Information
6 | ==============================
7 |
8 | Updating :class:`Account ` information is really easy:
9 |
10 | .. code-block:: php
11 |
12 | $client = new Services_Twilio('AC123', '123');
13 | $account = $client->account;
14 | $account->update(array('FriendlyName' => 'My Awesome Account'));
15 |
16 | Creating a Subaccount
17 | ==============================
18 |
19 | .. code-block:: php
20 |
21 | $client = new Services_Twilio('AC123', '123');
22 | $subaccount = $client->accounts->create(array(
23 | 'FriendlyName' => 'My Awesome SubAccount'
24 | ));
25 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/docs/usage/rest/applications.rst:
--------------------------------------------------------------------------------
1 | ==================
2 | Applications
3 | ==================
4 |
5 | Creating Applications
6 | ==============================
7 |
8 | .. code-block:: php
9 |
10 | $client = new Services_Twilio('AC123', '123');
11 | $application = $client->account->applications->create('Application Friendly Name',
12 | array(
13 | 'FriendlyName' => 'My Application Name',
14 | 'VoiceUrl' => 'http://foo.com/voice/url',
15 | 'VoiceFallbackUrl' => 'http://foo.com/voice/fallback/url',
16 | 'VoiceMethod' => 'POST',
17 | 'SmsUrl' => 'http://foo.com/sms/url',
18 | 'SmsFallbackUrl' => 'http://foo.com/sms/fallback/url',
19 | 'SmsMethod' => 'POST'
20 | )
21 | );
22 |
23 |
24 | Updating An Application
25 | ==============================
26 |
27 | .. code-block:: php
28 |
29 | $client = new Services_Twilio('AC123', '123');
30 | $application = $client->account->applications->get('AP123');
31 | $application->update(array(
32 | 'VoiceUrl' => 'http://foo.com/new/voice/url'
33 | ));
34 |
35 |
36 | Finding an Application by Name
37 | ==============================
38 |
39 | Find an :class:`Application` by its name (full name match).
40 |
41 | .. code-block:: php
42 |
43 | $client = new Services_Twilio('AC123', '123');
44 | $application = false;
45 | $params = array(
46 | 'FriendlyName' => 'My Application Name'
47 | );
48 | foreach($client->account->applications->getIterator(0, 1, $params) as $_application) {
49 | $application = $_application;
50 | }
--------------------------------------------------------------------------------
/vendor/twilio/sdk/docs/usage/rest/callerids.rst:
--------------------------------------------------------------------------------
1 | ============
2 | Caller Ids
3 | ============
4 |
5 | Validate a Phone Number
6 | =======================
7 | Adding a new phone number to your validated numbers is quick and easy:
8 |
9 | .. code-block:: php
10 |
11 | $client = new Services_Twilio('AC123', '123');
12 | $response = $client->account->outgoing_caller_ids->create('+15554441234');
13 | print $response->validation_code;
14 |
15 | Twilio will call the provided number and for the validation code to be entered.
16 |
17 | Listing all Validated Phone Numbers
18 | ===================================
19 |
20 | Show all the current caller_ids:
21 |
22 | .. code-block:: php
23 |
24 | $client = new Services_Twilio('AC123', '123');
25 | foreach ($client->account->outgoing_caller_ids as $caller_id) {
26 | print $caller_id->friendly_name;
27 | }
28 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/docs/usage/rest/calls.rst:
--------------------------------------------------------------------------------
1 | =============
2 | Phone Calls
3 | =============
4 |
5 | Making a Phone Call
6 | ===================
7 |
8 | The :class:`Calls` resource allows you to make outgoing calls:
9 |
10 | .. code-block:: php
11 |
12 | $client = new Services_Twilio('AC123', '123');
13 | $call = $client->account->calls->create(
14 | '9991231234', // From this number
15 | '8881231234', // Call this number
16 | 'http://foo.com/call.xml'
17 | );
18 | print $call->length;
19 | print $call->sid;
20 |
21 | Adding Extra Call Parameters
22 | ============================
23 |
24 | Add extra parameters, like a `StatusCallback` when the call ends, like this:
25 |
26 | .. code-block:: php
27 |
28 | $client = new Services_Twilio('AC123', '123');
29 | $call = $client->account->calls->create(
30 | '9991231234', // From this number
31 | '8881231234', // Call this number
32 | 'http://foo.com/call.xml',
33 | array(
34 | 'StatusCallback' => 'http://foo.com/callback',
35 | 'StatusCallbackMethod' => 'GET'
36 | )
37 | );
38 |
39 | A full list of extra parameters can be found `here
40 | `_.
41 |
42 | Listing Calls
43 | =============
44 |
45 | It's easy to iterate over your list of calls.
46 |
47 | .. code-block:: php
48 |
49 | $client = new Services_Twilio('AC123', '123');
50 | foreach ($client->account->calls as $call) {
51 | echo "From: {$call->from}\nTo: {$call->to}\nSid: {$call->sid}\n\n";
52 | }
53 |
54 | Filtering Calls
55 | ======================
56 |
57 | Let's say you want to find all of the calls that have been sent from
58 | a particular number. You can do so by constructing an iterator explicitly:
59 |
60 | .. code-block:: php
61 |
62 | $client = new Services_Twilio('AC123', '123');
63 | foreach ($client->account->calls->getIterator(0, 50, array(
64 | 'From' => '+14105551234'
65 | )) as $call) {
66 | echo "From: {$call->from}\nTo: {$call->to}\nSid: {$call->sid}\n\n";
67 | }
68 |
69 | Accessing Resources from a Specific Call
70 | ========================================
71 |
72 | The :class:`Call` resource has some subresources you can access, such as
73 | notifications and recordings. If you have already have a :class:`Call`
74 | resource, they are easy to get:
75 |
76 | .. code-block:: php
77 |
78 | $client = new Services_Twilio('AC123', '123');
79 | foreach ($client->account->calls as $call) {
80 | $notifications = $call->notifications;
81 | if (is_array($notifications)) {
82 | foreach ($notifications as $notification) {
83 | print $notification->sid;
84 | }
85 | }
86 |
87 | $transcriptions = $call->transcriptions;
88 | if (is_array($transcriptions)) {
89 | foreach ($transcriptions as $transcription) {
90 | print $transcription->sid;
91 | }
92 | }
93 |
94 | $recordings = $call->recordings;
95 | if (is_array($recordings)) {
96 | foreach ($recordings as $recording) {
97 | print $recording->sid;
98 | }
99 | }
100 | }
101 |
102 | Be careful, as the above code makes quite a few HTTP requests and may display
103 | PHP warnings for unintialized variables.
104 |
105 | Retrieve a Call Record
106 | ======================
107 |
108 | If you already have a :class:`Call` sid, you can use the client to retrieve
109 | that record.:
110 |
111 | .. code-block:: php
112 |
113 | $client = new Services_Twilio('AC123', '123');
114 | $sid = "CA12341234"
115 | $call = $client->account->calls->get($sid)
116 |
117 | Modifying live calls
118 | ====================
119 |
120 | The :class:`Call` resource makes it easy to find current live calls and
121 | redirect them as necessary:
122 |
123 | .. code-block:: php
124 |
125 | $client = new Services_Twilio('AC123', '123');
126 | $calls = $client->account->calls->getIterator(0, 50, array('Status' => 'in-progress'));
127 | foreach ($calls as $call) {
128 | $call->update(array('Url' => 'http://foo.com/new.xml', 'Method' => 'POST'));
129 | }
130 |
131 | Ending all live calls is also possible:
132 |
133 | .. code-block:: php
134 |
135 | $client = new Services_Twilio('AC123', '123');
136 | $calls = $client->account->calls->getIterator(0, 50, array('Status' => 'in-progress'));
137 | foreach ($calls as $call) {
138 | $call->hangup();
139 | }
140 |
141 | Note that :meth:`hangup` will also cancel calls currently queued.
142 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/docs/usage/rest/conferences.rst:
--------------------------------------------------------------------------------
1 | =============
2 | Conferences
3 | =============
4 |
5 | List All Conferences
6 | ====================
7 |
8 | .. code-block:: php
9 |
10 | $client = new Services_Twilio('AC123', '123');
11 | foreach ($client->account->conferences as $conference) {
12 | print $conference->friendly_name;
13 | }
14 |
15 | For a full list of properties available on a conference, as well as a full list
16 | of ways to filter a conference, please see the `Conference API Documentation
17 | `_ on our website.
18 |
19 | Filter Conferences by Status
20 | ============================
21 |
22 | .. code-block:: php
23 |
24 | $client = new Services_Twilio('AC123', '123');
25 | foreach ($client->account->conferences->getIterator(0, 50, array(
26 | 'Status' => 'in-progress'
27 | )) as $conf) {
28 | print $conf->sid;
29 | }
30 |
31 | Mute all participants
32 | =====================
33 |
34 | At the moment, using an iterator directly will cause this method to infinitely
35 | loop. Instead, use the getPage function. As conferences are limited to 40
36 | participants, getPage(0, 50) should return a list of every participant in
37 | a conference.
38 |
39 | .. code-block:: php
40 |
41 | $sid = "CO119231312";
42 | $client = new Services_Twilio('AC123', '123');
43 | $conference = $client->account->conferences->get($sid);
44 | $page = $conference->participants->getPage(0, 50);
45 | $participants = $page->participants;
46 | foreach ($participants as $p) {
47 | $p->mute();
48 | }
49 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/docs/usage/rest/members.rst:
--------------------------------------------------------------------------------
1 | =============
2 | Members
3 | =============
4 |
5 | List All Members in a Queue
6 | ============================
7 |
8 | Each queue instance resource has a list of members.
9 |
10 | .. code-block:: php
11 |
12 | $client = new Services_Twilio('AC123', '123');
13 | $queue_sid = 'QQ123';
14 | $queue = $client->account->queues->get('QQ123');
15 | foreach ($queue->members as $member) {
16 | echo "Call Sid: {$member->call_sid}\nWait Time: {$member->wait_time}\n";
17 | }
18 |
19 | Dequeue a Member
20 | =================
21 |
22 | .. code-block:: php
23 |
24 | $client = new Services_Twilio('AC123', '123');
25 | $queue = $client->account->queues->get('QQ123');
26 | foreach ($queue->members as $member) {
27 | // Dequeue the first member and fetch the Forward twimlet for that
28 | // member.
29 | $member->dequeue('http://twimlets.com/forward', 'GET');
30 | break;
31 | }
32 |
33 | Retrieve the Member at the Front of a Queue
34 | ===========================================
35 |
36 | The Members class has a method called ``front`` which can be used to retrieve
37 | the member at the front of the queue.
38 |
39 | .. code-block:: php
40 |
41 | $client = new Services_Twilio('AC123', '123');
42 | $queue = $client->account->queues->get('QQ123');
43 | $firstMember = $queue->members->front();
44 | echo $firstMember->position;
45 | echo $firstMember->call_sid;
46 |
47 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/docs/usage/rest/messages.rst:
--------------------------------------------------------------------------------
1 | =============
2 | Messages
3 | =============
4 |
5 | Sending a Message
6 | =====================
7 |
8 | The :class:`Messages ` resource allows you to
9 | send outgoing SMS or MMS messages.
10 |
11 | .. code-block:: php
12 |
13 | require('/path/to/twilio-php/Services/Twilio.php');
14 |
15 | $client = new Services_Twilio('AC123', '123');
16 | $message = $client->account->messages->sendMessage(
17 | '+14085551234', // From a Twilio number in your account
18 | '+12125551234', // Text any number
19 | 'Hello monkey!', // Message body (if any)
20 | array('http://example.com/image.jpg'), // An array of MediaUrls
21 | );
22 |
23 | echo $message->sid;
24 |
25 | Listing Messages
26 | ====================
27 |
28 | It's easy to iterate over your messages.
29 |
30 | .. code-block:: php
31 |
32 | $client = new Services_Twilio('AC123', '123');
33 | foreach ($client->account->messages as $message) {
34 | echo "From: {$message->from}\nTo: {$message->to}\nBody: " . $message->body;
35 | }
36 |
37 | Filtering Messages
38 | ======================
39 |
40 | Let's say you want to find all of the messages that have been sent from
41 | a particular number. You can do so by constructing an iterator explicitly:
42 |
43 | .. code-block:: php
44 |
45 | $client = new Services_Twilio('AC123', '123');
46 | foreach ($client->account->messages->getIterator(0, 50, array(
47 | 'From' => '+14105551234',
48 | )) as $message) {
49 | echo "From: {$message->from}\nTo: {$message->to}\nBody: " . $message->body;
50 | }
51 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/docs/usage/rest/notifications.rst:
--------------------------------------------------------------------------------
1 | ===============
2 | Notifications
3 | ===============
4 |
5 | Filter Notifications by Log Level
6 | =================================
7 |
8 | .. code-block:: php
9 |
10 | $client = new Services_Twilio('AC123', '123');
11 | foreach ($client->account->notifications->getIterator(0, 50, array("LogLevel" => 0)) as $n) {
12 | print $n->error_code;
13 | }
14 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/docs/usage/rest/queues.rst:
--------------------------------------------------------------------------------
1 | =============
2 | Queues
3 | =============
4 |
5 | Create a New Queue
6 | =====================
7 |
8 | To create a new queue, make an HTTP POST request to the Queues resource.
9 |
10 | .. code-block:: php
11 |
12 | require('/path/to/twilio-php/Services/Twilio.php');
13 |
14 | $client = new Services_Twilio('AC123', '123');
15 | // Default MaxSize is 100. Or change it by adding a parameter, like so
16 | $queue = $client->account->queues->create('First Queue',
17 | array('MaxSize' => 10));
18 |
19 | print $queue->sid;
20 | print $queue->friendly_name;
21 |
22 | Listing Queues
23 | ====================
24 |
25 | It's easy to iterate over your list of queues.
26 |
27 | .. code-block:: php
28 |
29 | $client = new Services_Twilio('AC123', '123');
30 | foreach ($client->account->queues as $queue) {
31 | echo $queue->sid;
32 | }
33 |
34 | Deleting Queues
35 | ====================
36 |
37 | .. code-block:: php
38 |
39 | $client = new Services_Twilio('AC123', '123');
40 | $queue_sid = 'QQ123';
41 | $client->account->queues->delete('QQ123');
42 |
43 | Retrieve the Member at the Front of a Queue
44 | ===========================================
45 |
46 | The Members class has a method called ``front`` which can be used to retrieve
47 | the member at the front of the queue.
48 |
49 | .. code-block:: php
50 |
51 | $client = new Services_Twilio('AC123', '123');
52 | $queue = $client->account->queues->get('QQ123');
53 | $firstMember = $queue->members->front();
54 | echo $firstMember->position;
55 | echo $firstMember->call_sid;
56 |
57 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/docs/usage/rest/recordings.rst:
--------------------------------------------------------------------------------
1 | ==========
2 | Recordings
3 | ==========
4 |
5 | Listing Recordings
6 | ------------------
7 |
8 | Run the following to get a list of all of your recordings:
9 |
10 | .. code-block:: php
11 |
12 | $accountSid = 'AC1234567890abcdef1234567890a';
13 | $authToken = 'abcdef1234567890abcdefabcde9';
14 | $client = new Services_Twilio($accountSid, $authToken);
15 |
16 | foreach($client->account->recordings as $recording) {
17 | echo "Access recording {$recording->sid} at:" . "\n";
18 | echo $recording->uri;
19 | }
20 |
21 | For more information about which properties are available for a recording
22 | object, please see the `Twilio Recordings API Documentation `_.
23 |
24 | Please note that the ``uri`` returned by default is a JSON dictionary
25 | containing metadata about the recording; you can access the .wav version by
26 | stripping the ``.json`` extension from the ``uri`` returned by the library.
27 |
28 | Filtering Recordings By Call Sid
29 | --------------------------------
30 |
31 | Pass filters as an array to filter your list of recordings, with any of the
32 | filters listed in the `recording list documentation `_.
33 |
34 | .. code-block:: php
35 |
36 | $accountSid = 'AC1234567890abcdef1234567890a';
37 | $authToken = 'abcdef1234567890abcdefabcde9';
38 | $client = new Services_Twilio($accountSid, $authToken);
39 |
40 | foreach($client->account->recordings->getIterator(0, 50, array('DateCreated>' => '2011-01-01')) as $recording) {
41 | echo $recording->uri . "\n";
42 | }
43 |
44 | Deleting a Recording
45 | --------------------
46 |
47 | To delete a recording, get the sid of the recording, and then pass it to the
48 | client.
49 |
50 | .. code-block:: php
51 |
52 | $accountSid = 'AC1234567890abcdef1234567890a';
53 | $authToken = 'abcdef1234567890abcdefabcde9';
54 | $client = new Services_Twilio($accountSid, $authToken);
55 |
56 | foreach($client->account->recordings as $recording) {
57 | $client->account->recordings->delete($recording->sid);
58 | echo "Deleted recording {$recording->sid}, the first one in the list.";
59 | break;
60 | }
61 |
62 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/docs/usage/rest/sip.rst:
--------------------------------------------------------------------------------
1 | =============
2 | Sip In
3 | =============
4 |
5 | Getting started with Sip
6 | ==========================
7 |
8 | If you're unfamiliar with SIP, please see the `SIP API Documentation
9 | `_ on our website.
10 |
11 | Creating a Sip Domain
12 | =========================
13 |
14 | The :class:`Domains ` resource allows you to
15 | create a new domain. To create a new domain, you'll need to choose a unique
16 | domain that lives under sip.twilio.com. For example, doug.sip.twilio.com.
17 |
18 | .. code-block:: php
19 |
20 | require('/path/to/twilio-php/Services/Twilio.php');
21 |
22 | $client = new Services_Twilio('AC123', '123');
23 | $domain = $client->account->sip->domains->create(
24 | "Doug's Domain", // The FriendlyName for your new domain
25 | "doug.sip.twilio.com", // The sip domain for your new domain
26 | array(
27 | 'VoiceUrl' => 'http://example.com/voice',
28 | ));
29 |
30 | echo $domain->sid;
31 |
32 | Creating a new IpAccessControlList
33 | ====================================
34 |
35 | To control access to your new domain, you'll need to explicitly grant access
36 | to individual ip addresses. To do this, you'll first need to create an
37 | :class:`IpAccessControlList ` to hold
38 | the ip addresses you wish to allow.
39 |
40 | .. code-block:: php
41 |
42 | require('/path/to/twilio-php/Services/Twilio.php');
43 |
44 | $client = new Services_Twilio('AC123', '123');
45 | $ip_access_control_list = $client->account->sip->ip_access_control_lists->create(
46 | "Doug's IpAccessControlList", // The FriendlyName for your new ip access control list
47 | );
48 |
49 | echo $ip_access_control_list->sid;
50 |
51 | Adding an IpAddress to an IpAccessControlList
52 | ==============================================
53 |
54 | Now it's time to add an :class:`IpAddress
55 | ` to your new :class:`IpAccessControlList
56 | `.
57 |
58 | .. code-block:: php
59 |
60 | require('/path/to/twilio-php/Services/Twilio.php');
61 |
62 | $client = new Services_Twilio('AC123', '123');
63 | $ip_address = $client->account->sip->ip_access_control_lists->get('AC123')->ip_addresses->create(
64 | "Doug's IpAddress", // The FriendlyName for this IpAddress
65 | '127.0.0.1', // The ip address for this IpAddress
66 | );
67 |
68 | echo $ip_address->sid;
69 |
70 | Adding an IpAccessControlList to a Domain
71 | ===========================================
72 |
73 | Once you've created a :class:`Domain ` and an
74 | :class:`IpAccessControlList `
75 | you need to associate them. To do this,
76 | create an :class:`IpAccessControlListMapping
77 | `.
78 |
79 | .. code-block:: php
80 |
81 | require('/path/to/twilio-php/Services/Twilio.php');
82 |
83 | $client = new Services_Twilio('AC123', '123');
84 | $ip_access_control_list_mapping = $client->account->sip->domains->get('SD123')->ip_access_control_list_mappings->create(
85 | 'AL123', // The sid of your IpAccessControlList
86 | );
87 |
88 | echo $ip_access_control_list_mapping->sid;
89 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/docs/usage/rest/sms-messages.rst:
--------------------------------------------------------------------------------
1 | =============
2 | SMS Messages
3 | =============
4 |
5 | Sending a SMS Message
6 | =====================
7 |
8 |
9 | The :php:class:`Services_Twilio_Rest_SmsMessages` resource allows you to send
10 | outgoing text messages.
11 |
12 | .. code-block:: php
13 |
14 | require('/path/to/twilio-php/Services/Twilio.php');
15 |
16 | $client = new Services_Twilio('AC123', '123');
17 | $message = $client->account->sms_messages->create(
18 | '+14085551234', // From a Twilio number in your account
19 | '+12125551234', // Text any number
20 | "Hello monkey!"
21 | );
22 |
23 | print $message->sid;
24 |
25 | Listing SMS Messages
26 | ====================
27 |
28 | It's easy to iterate over your SMS messages.
29 |
30 | .. code-block:: php
31 |
32 | $client = new Services_Twilio('AC123', '123');
33 | foreach ($client->account->sms_messages as $message) {
34 | echo "From: {$message->from}\nTo: {$message->to}\nBody: " . $message->body;
35 | }
36 |
37 | Filtering SMS Messages
38 | ======================
39 |
40 | Let's say you want to find all of the SMS messages that have been sent from
41 | a particular number. You can do so by constructing an iterator explicitly:
42 |
43 | .. code-block:: php
44 |
45 | $client = new Services_Twilio('AC123', '123');
46 | foreach ($client->account->sms_messages->getIterator(0, 50, array(
47 | 'From' => '+14105551234',
48 | )) as $message) {
49 | echo "From: {$message->from}\nTo: {$message->to}\nBody: " . $message->body;
50 | }
51 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/docs/usage/rest/transcriptions.rst:
--------------------------------------------------------------------------------
1 | ================
2 | Transcriptions
3 | ================
4 |
5 | Show all Transcribed Messages
6 | =============================
7 |
8 | .. code-block:: php
9 |
10 | $client = new Services_Twilio('AC123', '123');
11 | foreach ($client->account->transcriptions as $t) {
12 | print $t->transcription_text;
13 | }
14 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/docs/usage/rest/usage-records.rst:
--------------------------------------------------------------------------------
1 | =============
2 | Usage Records
3 | =============
4 |
5 | Twilio offers a Usage Record API so you can better measure how much you've been
6 | using Twilio. Here are some examples of how you can use PHP to access the usage
7 | API.
8 |
9 | Retrieve All Usage Records
10 | ==========================
11 |
12 | .. code-block:: php
13 |
14 | $client = new Services_Twilio('AC123', '456bef');
15 | foreach ($client->account->usage_records as $record) {
16 | echo "Record: $record";
17 | }
18 |
19 | Retrieve Usage Records For A Time Interval
20 | ==========================================
21 |
22 | UsageRecords support `several convenience subresources
23 | `_ that
24 | can be accessed as properties on the `record` object.
25 |
26 | .. code-block:: php
27 |
28 | $client = new Services_Twilio('AC123', '456bef');
29 | foreach ($client->account->usage_records->last_month as $record) {
30 | echo "Record: $record";
31 | }
32 |
33 | Retrieve All Time Usage for A Usage Category
34 | ============================================
35 |
36 | By default, Twilio will return your all-time usage for a given usage category.
37 |
38 | .. code-block:: php
39 |
40 | $client = new Services_Twilio('AC123', '456bef');
41 | $callRecord = $client->account->usage_records->getCategory('calls');
42 | echo $callRecord->usage;
43 |
44 | Retrieve All Usage for a Given Time Period
45 | ==========================================
46 |
47 | You can filter your UsageRecord list by providing `StartDate` and `EndDate`
48 | parameters.
49 |
50 | .. code-block:: php
51 |
52 | $client = new Services_Twilio('AC123', '456bef');
53 | foreach ($client->account->usage_records->getIterator(0, 50, array(
54 | 'StartDate' => '2012-08-01',
55 | 'EndDate' => '2012-08-31',
56 | )) as $record) {
57 | echo $record->description . "\n";
58 | echo $record->usage . "\n";
59 | }
60 |
61 | Retrieve Today's SMS Usage
62 | ==========================
63 |
64 | You can use the `today` record subresource, and then retrieve the record
65 | directly with the `getCategory` function.
66 |
67 | .. code-block:: php
68 |
69 | $client = new Services_Twilio('AC123', '456bef');
70 | // You can substitute 'yesterday', 'all_time' for 'today' below
71 | $smsRecord = $client->account->usage_records->today->getCategory('sms');
72 | echo $smsRecord->usage;
73 |
74 | Retrieve Daily Usage Over a One-Month Period
75 | =============================================
76 |
77 | The code below will retrieve daily summaries of recordings usage for August
78 | 2012. To retrieve all categories of usage, remove the 'Category' filter from
79 | the `getIterator` array.
80 |
81 | .. code-block:: php
82 |
83 | $client = new Services_Twilio('AC123', '456bef');
84 | foreach ($client->account->usage_records->daily->getIterator(0, 50, array(
85 | 'StartDate' => '2012-08-01',
86 | 'EndDate' => '2012-08-31',
87 | 'Category' => 'recordings',
88 | )) as $record) {
89 | echo $record->usage;
90 | }
91 |
92 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/docs/usage/rest/usage-triggers.rst:
--------------------------------------------------------------------------------
1 | ==============
2 | Usage Triggers
3 | ==============
4 |
5 | Twilio offers a Usage Trigger API so you can get notifications when your Twilio
6 | usage exceeds a given level. Here are some examples of how you can
7 | use PHP to create new usage triggers or modify existing triggers.
8 |
9 | Retrieve A Usage Trigger's Properties
10 | =====================================
11 |
12 | If you know the Sid of your usage trigger, retrieving it is easy.
13 |
14 | .. code-block:: php
15 |
16 | $client = new Services_Twilio('AC123', '456bef');
17 | $usageSid = 'UT123';
18 | $usageTrigger = $client->account->usage_triggers->get($usageSid);
19 | echo $usageTrigger->usage_category;
20 |
21 | Update Properties on a UsageTrigger
22 | ===================================
23 |
24 | .. code-block:: php
25 |
26 | $client = new Services_Twilio('AC123', '456bef');
27 | $usageSid = 'UT123';
28 | $usageTrigger = $client->account->usage_triggers->get($usageSid);
29 | $usageTrigger->update(array(
30 | 'FriendlyName' => 'New usage trigger friendly name',
31 | 'CallbackUrl' => 'http://example.com/new-trigger-url',
32 | ));
33 |
34 | Retrieve All Triggers
35 | =====================
36 |
37 | .. code-block:: php
38 |
39 | $client = new Services_Twilio('AC123', '456bef');
40 | foreach ($client->account->usage_triggers as $trigger) {
41 | echo "Category: {$trigger->usage_category}\nTriggerValue: {$trigger->trigger_value}\n";
42 | }
43 |
44 | Filter Trigger List By Category
45 | ===============================
46 |
47 | Pass filters to the `getIterator` function to create a filtered list.
48 |
49 | .. code-block:: php
50 |
51 | $client = new Services_Twilio('AC123', '456bef');
52 | foreach ($client->account->usage_triggers->getIterator(
53 | 0, 50, array(
54 | 'UsageCategory' => 'sms',
55 | )) as $trigger
56 | ) {
57 | echo "Value: " . $trigger->trigger_value . "\n";
58 | }
59 |
60 | Create a New Trigger
61 | ====================
62 |
63 | Pass a usage category, a value and a callback URL to the `create` method.
64 |
65 | .. code-block:: php
66 |
67 | $client = new Services_Twilio('AC123', '456bef');
68 | $trigger = $client->account->usage_triggers->create(
69 | 'totalprice',
70 | '250.75',
71 | 'http://example.com/usage'
72 | );
73 |
74 | Create a Recurring Trigger
75 | ==========================
76 |
77 | To have your trigger reset once every day, month, or year, pass the
78 | `Recurring` key as part of the params array. A list of optional
79 | trigger parameters can be found in the `Usage Triggers Documentation
80 | `_.
82 |
83 | .. code-block:: php
84 |
85 | $client = new Services_Twilio('AC123', '456bef');
86 | $trigger = $client->account->usage_triggers->create(
87 | 'totalprice',
88 | '250.75',
89 | 'http://example.com/usage',
90 | array('Recurring' => 'monthly', 'TriggerBy' => 'price')
91 | );
92 |
93 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/docs/usage/token-generation.rst:
--------------------------------------------------------------------------------
1 | ===========================
2 | Generate Capability Tokens
3 | ===========================
4 |
5 | `Twilio Client `_ allows you to make and recieve connections in the browser. You can place a call to a phone on the PSTN network, all without leaving your browser. See the `Twilio Client Quickstart `_ to get up and running with Twilio Client.
6 |
7 | Capability tokens are used by `Twilio Client `_ to provide connection security and authorization. The `Capability Token documentation `_ explains indepth the purpose and features of these tokens.
8 |
9 | :php:class:`Services_Twilio_Capability` is responsible for the creation of these capability tokens. You'll need your Twilio AccountSid and AuthToken.
10 |
11 | .. code-block:: php
12 |
13 | require('/path/to/twilio-php/Services/Twilio/Capability.php');
14 |
15 | $accountSid = "AC123123";
16 | $authToken = "secret";
17 |
18 | $capability = new Services_Twilio_Capability($accountSid, $authToken);
19 |
20 |
21 | Allow Incoming Connections
22 | ==============================
23 |
24 | Before a device running `Twilio Client `_ can recieve incoming connections, the instance must first register a name (such as "Alice" or "Bob"). The :php:meth:`allowCclientIncoming` method adds the client name to the capability token.
25 |
26 | .. code-block:: php
27 |
28 | $capability->allowClientIncoming("Alice");
29 |
30 |
31 | Allow Outgoing Connections
32 | ==============================
33 |
34 | To make an outgoing connection from a `Twilio Client `_ device, you'll need to choose a `Twilio Application `_ to handle TwiML URLs. A Twilio Application is a collection of URLs responsible for outputing valid TwiML to control phone calls and SMS.
35 |
36 | .. code-block:: php
37 |
38 | $applicationSid = "AP123123"; // Twilio Application Sid
39 | $capability->allowClientOutgoing($applicationSid);
40 |
41 | :php:meth:`allowClientOutgoing` accepts an optional array of parameters. These parameters will be passed along when Twilio requests TwiML from the application.
42 |
43 | .. code-block:: php
44 |
45 | $applicationSid = "AP123123"; // Twilio Application Sid
46 | $params = array("Foo" => "Bar"); // Parameters to be passed
47 | $capability->allowClientOutgoing($applicationSid, $params);
48 |
49 |
50 | Generate a Token
51 | ==================
52 |
53 | .. code-block:: php
54 |
55 | $token = $capability->generateToken();
56 |
57 | By default, this token will expire in one hour. If you'd like to change the token expiration time, :php:meth:`generateToken` takes an optional argument which specifies `time to live` in seconds.
58 |
59 | .. code-block:: php
60 |
61 | $token = $capability->generateToken(600);
62 |
63 | This token will now expire in 10 minutes.
64 |
65 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/docs/usage/validation.rst:
--------------------------------------------------------------------------------
1 | ===========================
2 | Validate Incoming Requests
3 | ===========================
4 |
5 | Twilio requires that your TwiML-serving web server be open to the public. This is necessary so that Twilio can retrieve TwiML from urls and POST data back to your server.
6 |
7 | However, there may be people out there trying to spoof the Twilio service. Luckily, there's an easy way to validate that incoming requests are from Twilio and Twilio alone.
8 |
9 | An `indepth guide `_ to our security features can be found in our online documentation.
10 |
11 | Before you can validate requests, you'll need four pieces of information
12 |
13 | * your Twilio Auth Token
14 | * the POST data for the request
15 | * the requested URL
16 | * the X-Twilio-Signature header value
17 |
18 | Get your Auth Token from the `Twilio User Dashboard `_.
19 |
20 | Obtaining the other three pieces of information depends on the framework of your choosing. I will assume that you have the POST data as an array and the url and X-Twilio-Signature as strings.
21 |
22 | The below example will print out a confirmation message if the request is actually from Twilio.com
23 |
24 | .. code-block:: php
25 |
26 | // Your auth token from twilio.com/user/account
27 | $authToken = '12345';
28 |
29 | // Download the twilio-php library from twilio.com/docs/php/install, include it
30 | // here
31 | require_once('/path/to/twilio-php/Services/Twilio.php');
32 | $validator = new Services_Twilio_RequestValidator($authToken);
33 |
34 | // The Twilio request URL. You may be able to retrieve this from
35 | // $_SERVER['SCRIPT_URI']
36 | $url = 'https://mycompany.com/myapp.php?foo=1&bar=2';
37 |
38 | // The post variables in the Twilio request. You may be able to use
39 | // $postVars = $_POST
40 | $postVars = array(
41 | 'CallSid' => 'CA1234567890ABCDE',
42 | 'Caller' => '+14158675309',
43 | 'Digits' => '1234',
44 | 'From' => '+14158675309',
45 | 'To' => '+18005551212'
46 | );
47 |
48 | // The X-Twilio-Signature header - in PHP this should be
49 | // $_SERVER["HTTP_X_TWILIO_SIGNATURE"];
50 | $signature = 'RSOYDt4T1cUTdK1PDd93/VVr8B8=';
51 |
52 | if ($validator->validate($signature, $url, $postVars)) {
53 | echo "Confirmed to have come from Twilio.";
54 | } else {
55 | echo "NOT VALID. It might have been spoofed!";
56 | }
57 |
58 | Trailing Slashes
59 | ==================
60 |
61 | If your URL uses an "index" page, such as index.php or index.html to handle the request, such as: https://mycompany.com/twilio where the real page is served from https://mycompany.com/twilio/index.php, then Apache or PHP may rewrite that URL a little bit so it's got a trailing slash... https://mycompany.com/twilio/ for example.
62 |
63 | Using the code above, or similar code in another language, you could end up with an incorrect hash because, Twilio built the hash using https://mycompany.com/twilio and you may have built the hash using https://mycompany.com/twilio/.
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/package.php:
--------------------------------------------------------------------------------
1 |
29 | * @copyright 2014 Twilio
30 | * @license http://creativecommons.org/licenses/MIT/
31 | * @link http://pear.php.net/package/Services_Twilio
32 | */
33 |
34 | ini_set('display_errors', '0');
35 | error_reporting(E_ALL & ~E_DEPRECATED & ~E_STRICT);
36 | require_once 'PEAR/PackageFileManager/File.php';
37 | require_once 'PEAR/PackageFileManager2.php';
38 | PEAR::setErrorHandling(PEAR_ERROR_DIE);
39 |
40 | $api_version = '3.12.5';
41 | $api_state = 'stable';
42 |
43 | $release_version = '3.12.5';
44 | $release_state = 'stable';
45 | $release_notes = 'Make SIP class PSR-0 compliant';
46 |
47 | $description = <<setOptions(
55 | array(
56 | 'filelistgenerator' => 'file',
57 | 'simpleoutput' => true,
58 | 'baseinstalldir' => '/',
59 | 'packagedirectory' => './',
60 | 'dir_roles' => array(
61 | 'Services' => 'php',
62 | 'Services/Twilio' => 'php',
63 | 'tests' => 'test'
64 | ),
65 | 'ignore' => array(
66 | 'package.php',
67 | '*.tgz',
68 | 'scratch/*',
69 | 'vendor/*',
70 | 'composer.*',
71 | 'coverage/*',
72 | '.travis.yml',
73 | 'venv/*',
74 | )
75 | )
76 | );
77 |
78 | $package->setPackage('Services_Twilio');
79 | $package->setSummary('PHP helper library for Twilio');
80 | $package->setDescription($description);
81 | $package->setChannel('twilio.github.com/pear');
82 | $package->setPackageType('php');
83 | $package->setLicense(
84 | 'MIT License',
85 | 'http://creativecommons.org/licenses/MIT/'
86 | );
87 |
88 | $package->setNotes($release_notes);
89 | $package->setReleaseVersion($release_version);
90 | $package->setReleaseStability($release_state);
91 | $package->setAPIVersion($api_version);
92 | $package->setAPIStability($api_state);
93 |
94 | $package->addMaintainer(
95 | 'lead',
96 | 'ihumanable',
97 | 'Matt Nowack',
98 | 'matt@twilio.com'
99 | );
100 |
101 |
102 | $package->setPhpDep('5.2.1');
103 |
104 | $package->addPackageDepWithChannel('optional', 'Mockery', 'pear.survivethedeepend.com');
105 |
106 | $package->setPearInstallerDep('1.9.3');
107 | $package->generateContents();
108 | $package->addRelease();
109 |
110 | if (isset($_GET['make'])
111 | || (isset($_SERVER['argv']) && @$_SERVER['argv'][1] == 'make')
112 | ) {
113 | $package->writePackageFile();
114 | } else {
115 | $package->debugPackageFile();
116 | }
117 |
118 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/tests/Bootstrap.php:
--------------------------------------------------------------------------------
1 | register();
23 |
24 | require_once 'Twilio.php';
25 |
26 | unset($root, $library, $tests, $path);
27 |
28 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/tests/BuildQueryTest.php:
--------------------------------------------------------------------------------
1 | 'bar',
10 | 'baz' => 'bin',
11 | );
12 |
13 | $this->assertEquals(Services_Twilio::buildQuery($data), 'foo=bar&baz=bin');
14 | }
15 |
16 | public function testSameKey() {
17 | $data = array(
18 | 'foo' => array(
19 | 'bar',
20 | 'baz',
21 | 'bin',
22 | ),
23 | 'boo' => 'bah',
24 | );
25 |
26 | $this->assertEquals(Services_Twilio::buildQuery($data),
27 | 'foo=bar&foo=baz&foo=bin&boo=bah');
28 | }
29 |
30 | public function testKeylessData() {
31 | $data = array(
32 | 'bar',
33 | 'baz',
34 | 'bin',
35 | );
36 |
37 | $this->assertEquals(Services_Twilio::buildQuery($data), '0=bar&1=baz&2=bin');
38 | }
39 |
40 | public function testKeylessDataPrefix() {
41 | $data = array(
42 | 'bar',
43 | 'baz',
44 | 'bin',
45 | );
46 |
47 | $this->assertEquals(Services_Twilio::buildQuery($data, 'var'), 'var0=bar&var1=baz&var2=bin');
48 | }
49 |
50 | public function testQualifiedUserAgent() {
51 | $expected = Services_Twilio::USER_AGENT . " (php 5.4)";
52 | $this->assertEquals(Services_Twilio::qualifiedUserAgent("5.4"), $expected);
53 | }
54 |
55 | }
56 |
57 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/tests/CapabilityTest.php:
--------------------------------------------------------------------------------
1 | generateToken(), 'foo');
10 | $this->assertEquals($payload->iss, "AC123");
11 | $this->assertEquals($payload->scope, '');
12 | }
13 |
14 | public function testInboundPermissions() {
15 | $token = new Services_Twilio_Capability('AC123', 'foo');
16 | $token->allowClientIncoming("andy");
17 | $payload = JWT::decode($token->generateToken(), 'foo');
18 |
19 | $eurl = "scope:client:incoming?clientName=andy";
20 | $this->assertEquals($payload->scope, $eurl);
21 | }
22 |
23 | public function testOutboundPermissions() {
24 | $token = new Services_Twilio_Capability('AC123', 'foo');
25 | $token->allowClientOutgoing("AP123");
26 | $payload = JWT::decode($token->generateToken(), 'foo');;
27 | $eurl = "scope:client:outgoing?appSid=AP123";
28 | $this->assertContains($eurl, $payload->scope);
29 | }
30 |
31 | public function testOutboundPermissionsParams() {
32 | $token = new Services_Twilio_Capability('AC123', 'foo');
33 | $token->allowClientOutgoing("AP123", array("foobar" => 3));
34 | $payload = JWT::decode($token->generateToken(), 'foo');
35 |
36 | $eurl = "scope:client:outgoing?appSid=AP123&appParams=foobar%3D3";
37 | $this->assertEquals($payload->scope, $eurl);
38 | }
39 |
40 | public function testEvents() {
41 | $token = new Services_Twilio_Capability('AC123', 'foo');
42 | $token->allowEventStream();
43 | $payload = JWT::decode($token->generateToken(), 'foo');
44 |
45 | $event_uri = "scope:stream:subscribe?path=%2F2010"
46 | . "-04-01%2FEvents¶ms=";
47 | $this->assertEquals($payload->scope, $event_uri);
48 | }
49 |
50 | public function testEventsWithFilters() {
51 | $token = new Services_Twilio_Capability('AC123', 'foo');
52 | $token->allowEventStream(array("foobar" => "hey"));
53 | $payload = JWT::decode($token->generateToken(), 'foo');
54 |
55 | $event_uri = "scope:stream:subscribe?path=%2F2010-"
56 | . "04-01%2FEvents¶ms=foobar%3Dhey";
57 | $this->assertEquals($payload->scope, $event_uri);
58 | }
59 |
60 |
61 | public function testDecode() {
62 | $token = new Services_Twilio_Capability('AC123', 'foo');
63 | $token->allowClientOutgoing("AP123", array("foobar"=> 3));
64 | $token->allowClientIncoming("andy");
65 | $token->allowEventStream();
66 |
67 | $outgoing_uri = "scope:client:outgoing?appSid="
68 | . "AP123&appParams=foobar%3D3&clientName=andy";
69 | $incoming_uri = "scope:client:incoming?clientName=andy";
70 | $event_uri = "scope:stream:subscribe?path=%2F2010-04-01%2FEvents";
71 |
72 | $payload = JWT::decode($token->generateToken(), 'foo');
73 | $scope = $payload->scope;
74 |
75 | $this->assertContains($outgoing_uri, $scope);
76 | $this->assertContains($incoming_uri, $scope);
77 | $this->assertContains($event_uri, $scope);
78 | }
79 |
80 |
81 | function testDecodeWithAuthToken() {
82 | try {
83 | $token = new Services_Twilio_Capability('AC123', 'foo');
84 | $payload = JWT::decode($token->generateToken(), 'foo');
85 | $this->assertSame($payload->iss, 'AC123');
86 | } catch (UnexpectedValueException $e) {
87 | $this->assertTrue(false, "Could not decode with 'foo'");
88 | }
89 | }
90 |
91 | function testClientNameValidation() {
92 | $this->setExpectedException('InvalidArgumentException');
93 | $token = new Services_Twilio_Capability('AC123', 'foo');
94 | $token->allowClientIncoming('@');
95 | $this->fail('exception should have been raised');
96 | }
97 |
98 | function zeroLengthNameInvalid() {
99 | $this->setExpectedException('InvalidArgumentException');
100 | $token = new Services_Twilio_Capability('AC123', 'foo');
101 | $token->allowClientIncoming("");
102 | $this->fail('exception should have been raised');
103 | }
104 |
105 |
106 | }
107 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/tests/README:
--------------------------------------------------------------------------------
1 | # To run the tests, navigate to the twilio-php home directory, then run:
2 |
3 | make test
4 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/tests/RequestValidatorTest.php:
--------------------------------------------------------------------------------
1 | "94612",
14 | "AccountSid" => "AC9a9f9392lad99kla0sklakjs90j092j3",
15 | "ApiVersion" => "2010-04-01",
16 | "CallSid" => "CAd800bb12c0426a7ea4230e492fef2a4f",
17 | "CallStatus" => "ringing",
18 | "Called" => "+15306384866",
19 | "CalledCity" => "OAKLAND",
20 | "CalledCountry" => "US",
21 | "CalledState" => "CA",
22 | "Caller" => "+15306666666",
23 | "CallerCity" => "SOUTH LAKE TAHOE",
24 | "CallerCountry" => "US",
25 | "CallerName" => "CA Wireless Call",
26 | "CallerState" => "CA",
27 | "CallerZip" => "89449",
28 | "Direction" => "inbound",
29 | "From" => "+15306666666",
30 | "FromCity" => "SOUTH LAKE TAHOE",
31 | "FromCountry" => "US",
32 | "FromState" => "CA",
33 | "FromZip" => "89449",
34 | "To" => "+15306384866",
35 | "ToCity" => "OAKLAND",
36 | "ToCountry" => "US",
37 | "ToState" => "CA",
38 | "ToZip" => "94612",
39 | );
40 |
41 | $expected = "fF+xx6dTinOaCdZ0aIeNkHr/ZAA=";
42 |
43 | $this->assertEquals(
44 | $validator->computeSignature($uri, $params), $expected);
45 | $this->assertTrue($validator->validate($expected, $uri, $params));
46 | }
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/tests/phpunit.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | ./
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/tests/resources/AccountsTest.php:
--------------------------------------------------------------------------------
1 | 'application/x-www-form-urlencoded');
8 | function testPost()
9 | {
10 | $http = m::mock(new Services_Twilio_TinyHttp);
11 | $http->shouldReceive('post')->once()
12 | ->with('/2010-04-01/Accounts.json',
13 | $this->formHeaders, 'FriendlyName=foo')
14 | ->andReturn(array(200, array('Content-Type' => 'application/json'),
15 | json_encode(array('sid' => 'AC345'))
16 | ));
17 | $client = new Services_Twilio('AC123', '123', '2010-04-01', $http);
18 | $account = $client->accounts->create(array(
19 | 'FriendlyName' => 'foo',
20 | ));
21 | $this->assertEquals('AC345', $account->sid);
22 | }
23 |
24 | function tearDown()
25 | {
26 | m::close();
27 | }
28 | }
29 |
30 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/tests/resources/ApplicationsTest.php:
--------------------------------------------------------------------------------
1 | 'application/x-www-form-urlencoded');
7 | function testPost()
8 | {
9 | $http = m::mock(new Services_Twilio_TinyHttp);
10 | $http->shouldReceive('post')->once()
11 | ->with('/2010-04-01/Accounts/AC123/Applications.json',
12 | $this->formHeaders, 'FriendlyName=foo&VoiceUrl=bar')
13 | ->andReturn(array(200, array('Content-Type' => 'application/json'),
14 | json_encode(array('sid' => 'AP123'))
15 | ));
16 | $client = new Services_Twilio('AC123', '123', '2010-04-01', $http);
17 | $app = $client->account->applications->create('foo', array(
18 | 'VoiceUrl' => 'bar',
19 | ));
20 | $this->assertEquals('AP123', $app->sid);
21 | }
22 |
23 | function tearDown()
24 | {
25 | m::close();
26 | }
27 | }
28 |
29 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/tests/resources/AvailablePhoneNumbersTest.php:
--------------------------------------------------------------------------------
1 | shouldReceive('get')->once()
9 | ->with('/2010-04-01/Accounts/AC123/AvailablePhoneNumbers/US/Local.json?AreaCode=510')
10 | ->andReturn(array(200, array('Content-Type' => 'application/json'),
11 | json_encode(array('available_phone_numbers' => array(
12 | 'friendly_name' => '(510) 564-7903'
13 | )))
14 | ));
15 | $client = new Services_Twilio('AC123', '123', '2010-04-01', $http);
16 | $nums = $client->account->available_phone_numbers->getLocal('US');
17 | $numsList = $nums->getList(array('AreaCode' => '510'));
18 | foreach ($numsList as $num) {
19 | $this->assertEquals('(510) 564-7903', $num->friendly_name);
20 | }
21 | }
22 |
23 | function testPagePhoneNumberResource() {
24 | $http = m::mock(new Services_Twilio_TinyHttp);
25 | $http->shouldReceive('get')->once()
26 | ->with('/2010-04-01/Accounts/AC123/AvailablePhoneNumbers.json?Page=0&PageSize=50')
27 | ->andReturn(array(200, array('Content-Type' => 'application/json'),
28 | json_encode(array(
29 | 'total' => 1,
30 | 'countries' => array(array('country_code' => 'CA'))
31 | ))
32 | ));
33 | $client = new Services_Twilio('AC123', '123', '2010-04-01', $http);
34 | $page = $client->account->available_phone_numbers->getPage('0');
35 | $this->assertEquals('CA', $page->countries[0]->country_code);
36 | }
37 |
38 | function testGetMobile() {
39 | $http = m::mock(new Services_Twilio_TinyHttp);
40 | $http->shouldReceive('get')->once()
41 | ->with('/2010-04-01/Accounts/AC123/AvailablePhoneNumbers/GB/Mobile.json')
42 | ->andReturn(array(200, array('Content-Type' => 'application/json'),
43 | json_encode(array('available_phone_numbers' => array(
44 | 'friendly_name' => '(510) 564-7903'
45 | )))
46 | ));
47 | $client = new Services_Twilio('AC123', '123', '2010-04-01', $http);
48 | $nums = $client->account->available_phone_numbers->getMobile('GB')->getList();
49 | foreach ($nums as $num) {
50 | $this->assertEquals('(510) 564-7903', $num->friendly_name);
51 | }
52 | }
53 |
54 | function tearDown() {
55 | m::close();
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/tests/resources/CallsTest.php:
--------------------------------------------------------------------------------
1 | assertEquals($expected, $result);
13 | }
14 |
15 | function sidProvider()
16 | {
17 | return array(
18 | array("AP2a0747eba6abf96b7e3c3ff0b4530f6e", true),
19 | array("CA2a0747eba6abf96b7e3c3ff0b4530f6e", false),
20 | array("AP2a0747eba6abf96b7e3c3ff0b4530f", false),
21 | array("http://www.google.com/asdfasdfAP", false),
22 | );
23 | }
24 | }
25 |
26 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/tests/resources/ConnectAppsTest.php:
--------------------------------------------------------------------------------
1 | shouldReceive('get')->once()
10 | ->with('/2010-04-01/Accounts/AC123/ConnectApps/CN123.json')
11 | ->andReturn(array(200, array('Content-Type' => 'application/json'),
12 | json_encode(array('friendly_name' => 'foo'))
13 | ));
14 | $http->shouldReceive('post')->once()
15 | ->with('/2010-04-01/Accounts/AC123/ConnectApps/CN123.json',
16 | array('Content-Type' => 'application/x-www-form-urlencoded'),
17 | 'FriendlyName=Bar')
18 | ->andReturn(array(200, array('Content-Type' => 'application/json'),
19 | json_encode(array('friendly_name' => 'Bar'))
20 | ));
21 | $client = new Services_Twilio('AC123', '123', '2010-04-01', $http);
22 | $cn = $client->account->connect_apps->get('CN123');
23 | $this->assertEquals('foo', $cn->friendly_name);
24 | $cn->update(array('FriendlyName' => 'Bar'));
25 | $this->assertEquals('Bar', $cn->friendly_name);
26 | }
27 |
28 | function testUpdateWithOneParam()
29 | {
30 | $http = m::mock(new Services_Twilio_TinyHttp);
31 | $http->shouldReceive('get')->once()
32 | ->with('/2010-04-01/Accounts/AC123/ConnectApps/CN123.json')
33 | ->andReturn(array(200, array('Content-Type' => 'application/json'),
34 | json_encode(array('friendly_name' => 'foo'))
35 | ));
36 | $http->shouldReceive('post')->once()
37 | ->with('/2010-04-01/Accounts/AC123/ConnectApps/CN123.json',
38 | array('Content-Type' => 'application/x-www-form-urlencoded'),
39 | 'FriendlyName=Bar')
40 | ->andReturn(array(200, array('Content-Type' => 'application/json'),
41 | json_encode(array('friendly_name' => 'Bar'))
42 | ));
43 | $client = new Services_Twilio('AC123', '123', '2010-04-01', $http);
44 | $cn = $client->account->connect_apps->get('CN123');
45 | $this->assertEquals('foo', $cn->friendly_name);
46 | $cn->update('FriendlyName', 'Bar');
47 | $this->assertEquals('Bar', $cn->friendly_name);
48 | }
49 |
50 | function tearDown()
51 | {
52 | m::close();
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/tests/resources/IncomingPhoneNumbersTest.php:
--------------------------------------------------------------------------------
1 | array(
9 | array(
10 | 'sid' => 'PN123',
11 | 'sms_fallback_method' => 'POST',
12 | 'voice_method' => 'POST',
13 | 'friendly_name' => '(510) 564-7903',
14 | )
15 | ),
16 | );
17 |
18 | function testGetNumberWithResult() {
19 | $http = m::mock(new Services_Twilio_TinyHttp);
20 | $http->shouldReceive('get')->once()
21 | ->with('/2010-04-01/Accounts/AC123/IncomingPhoneNumbers.json?Page=0&PageSize=1&PhoneNumber=%2B14105551234')
22 | ->andReturn(array(200, array('Content-Type' => 'application/json'),
23 | json_encode($this->apiResponse)
24 | )
25 | );
26 | $client = new Services_Twilio('AC123', '123', '2010-04-01', $http);
27 | $number = $client->account->incoming_phone_numbers->getNumber('+14105551234');
28 | $this->assertEquals('PN123', $number->sid);
29 | }
30 |
31 | function testGetNumberNoResults() {
32 | $http = m::mock(new Services_Twilio_TinyHttp);
33 | $http->shouldReceive('get')->once()
34 | ->with('/2010-04-01/Accounts/AC123/IncomingPhoneNumbers.json?Page=0&PageSize=1&PhoneNumber=%2B14105551234')
35 | ->andReturn(array(200, array('Content-Type' => 'application/json'),
36 | json_encode(array(
37 | 'incoming_phone_numbers' => array(),
38 | 'page' => 0,
39 | 'page_size' => 1,
40 | ))
41 | )
42 | );
43 | $client = new Services_Twilio('AC123', '123', '2010-04-01', $http);
44 | $number = $client->account->incoming_phone_numbers->getNumber('+14105551234');
45 | $this->assertNull($number);
46 | }
47 |
48 | function testGetMobile() {
49 | $http = m::mock(new Services_Twilio_TinyHttp);
50 | $http->shouldReceive('get')->once()
51 | ->with('/2010-04-01/Accounts/AC123/IncomingPhoneNumbers/Mobile.json?Page=0&PageSize=50')
52 | ->andReturn(array(200, array('Content-Type' => 'application/json'),
53 | json_encode($this->apiResponse)
54 | ));
55 | $http->shouldReceive('get')->once()
56 | ->with('/2010-04-01/Accounts/AC123/IncomingPhoneNumbers/Mobile.json?Page=1&PageSize=50')
57 | ->andReturn(array(400, array('Content-Type' => 'application/json'),
58 | '{"status":400,"message":"foo", "code": "20006"}'
59 | ));
60 | $client = new Services_Twilio('AC123', '123', '2010-04-01', $http);
61 | foreach ($client->account->incoming_phone_numbers->mobile as $num) {
62 | $this->assertEquals('(510) 564-7903', $num->friendly_name);
63 | }
64 | }
65 |
66 | function testGetLocal() {
67 | $http = m::mock(new Services_Twilio_TinyHttp);
68 | $http->shouldReceive('get')->once()
69 | ->with('/2010-04-01/Accounts/AC123/IncomingPhoneNumbers/Local.json?Page=0&PageSize=50')
70 | ->andReturn(array(200, array('Content-Type' => 'application/json'),
71 | json_encode($this->apiResponse)
72 | ));
73 | $http->shouldReceive('get')->once()
74 | ->with('/2010-04-01/Accounts/AC123/IncomingPhoneNumbers/Local.json?Page=1&PageSize=50')
75 | ->andReturn(array(400, array('Content-Type' => 'application/json'),
76 | '{"status":400,"message":"foo", "code": "20006"}'
77 | ));
78 | $client = new Services_Twilio('AC123', '123', '2010-04-01', $http);
79 |
80 | foreach ($client->account->incoming_phone_numbers->local as $num) {
81 | $this->assertEquals('(510) 564-7903', $num->friendly_name);
82 | }
83 | }
84 |
85 | function testGetTollFree() {
86 | $http = m::mock(new Services_Twilio_TinyHttp);
87 | $http->shouldReceive('get')->once()
88 | ->with('/2010-04-01/Accounts/AC123/IncomingPhoneNumbers/TollFree.json?Page=0&PageSize=50')
89 | ->andReturn(array(200, array('Content-Type' => 'application/json'),
90 | json_encode($this->apiResponse)
91 | ));
92 | $http->shouldReceive('get')->once()
93 | ->with('/2010-04-01/Accounts/AC123/IncomingPhoneNumbers/TollFree.json?Page=1&PageSize=50')
94 | ->andReturn(array(400, array('Content-Type' => 'application/json'),
95 | '{"status":400,"message":"foo", "code": "20006"}'
96 | ));
97 | $client = new Services_Twilio('AC123', '123', '2010-04-01', $http);
98 | foreach ($client->account->incoming_phone_numbers->toll_free as $num) {
99 | $this->assertEquals('(510) 564-7903', $num->friendly_name);
100 | }
101 | }
102 |
103 | }
104 |
105 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/tests/resources/MediaTest.php:
--------------------------------------------------------------------------------
1 | shouldReceive('get')->once()
10 | ->with('/2010-04-01/Accounts/AC123/Messages/MM123/Media.json?Page=0&PageSize=50')
11 | ->andReturn(array(200, array('Content-Type' => 'application/json'),
12 | json_encode(array(
13 | 'end' => '0',
14 | 'total' => '2',
15 | 'media_list' => array(
16 | array('sid' => 'ME123'),
17 | array('sid' => 'ME456')
18 | ),
19 | 'next_page_uri' => 'null',
20 | 'start' => 0
21 | ))
22 | ));
23 | $client = new Services_Twilio('AC123', '123', '2010-04-01', $http);
24 | $media_list = $client->account->messages->get('MM123')->media->getPage()->getItems();
25 | $this->assertEquals(count($media_list), 2);
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/tests/resources/MembersTest.php:
--------------------------------------------------------------------------------
1 | 'application/x-www-form-urlencoded');
8 |
9 | function testFront() {
10 | $http = m::mock(new Services_Twilio_TinyHttp);
11 | $http->shouldReceive('get')->once()
12 | ->with('/2010-04-01/Accounts/AC123/Queues/QQ123/Members/Front.json')
13 | ->andReturn(array(200, array('Content-Type' => 'application/json'),
14 | json_encode(array('call_sid' => 'CA123', 'position' => 0))
15 | ));
16 | $client = new Services_Twilio('AC123', '123', '2010-04-01', $http);
17 | $queue = $client->account->queues->get('QQ123');
18 | $firstMember = $queue->members->front();
19 | $this->assertSame($firstMember->call_sid, 'CA123');
20 | }
21 |
22 | function testDequeueFront() {
23 | $http = m::mock(new Services_Twilio_TinyHttp);
24 | $http->shouldReceive('post')->once()
25 | ->with('/2010-04-01/Accounts/AC123/Queues/QQ123/Members/Front.json',
26 | $this->formHeaders, 'Url=http%3A%2F%2Ffoo.com&Method=POST')
27 | ->andReturn(array(200, array('Content-Type' => 'application/json'),
28 | json_encode(array('call_sid' => 'CA123', 'position' => 0))
29 | ));
30 | $client = new Services_Twilio('AC123', '123', '2010-04-01', $http);
31 | $queue = $client->account->queues->get('QQ123');
32 | $firstMember = $queue->members->front();
33 | $firstMember->dequeue('http://foo.com');
34 | }
35 |
36 | function testDequeueSid() {
37 | $http = m::mock(new Services_Twilio_TinyHttp);
38 | $http->shouldReceive('post')->once()
39 | ->with('/2010-04-01/Accounts/AC123/Queues/QQ123/Members/CA123.json',
40 | $this->formHeaders, 'Url=http%3A%2F%2Ffoo.com&Method=GET')
41 | ->andReturn(array(200, array('Content-Type' => 'application/json'),
42 | json_encode(array('call_sid' => 'CA123', 'position' => 0))
43 | ));
44 | $client = new Services_Twilio('AC123', '123', '2010-04-01', $http);
45 | $queue = $client->account->queues->get('QQ123');
46 | $firstMember = $queue->members->get('CA123');
47 | $firstMember->dequeue('http://foo.com', 'GET');
48 | }
49 |
50 | function testMemberIterate() {
51 | $http = m::mock(new Services_Twilio_TinyHttp);
52 | $resp = json_encode(
53 | array(
54 | 'queue_members' => array(
55 | array('call_sid' => 'CA123', 'wait_time' => 30)
56 | ),
57 | 'end' => 1,
58 | )
59 | );
60 | $http->shouldReceive('get')->once()
61 | ->with('/2010-04-01/Accounts/AC123/Queues/QQ123/Members.json?Page=0&PageSize=50')
62 | ->andReturn(array(200, array('Content-Type' => 'application/json'), $resp
63 | ));
64 | $http->shouldReceive('get')->once()
65 | ->with('/2010-04-01/Accounts/AC123/Queues/QQ123/Members.json?Page=1&PageSize=50')
66 | ->andReturn(array(400, array('Content-Type' => 'application/json'),
67 | '{"status":400,"message":"foo", "code": "20006"}'
68 | ));
69 | $client = new Services_Twilio('AC123', '123', '2010-04-01', $http);
70 | $queue = $client->account->queues->get('QQ123');
71 | foreach($queue->members as $member) {
72 | $this->assertSame($member->call_sid, 'CA123');
73 | $this->assertSame($member->wait_time, 30);
74 | }
75 | }
76 |
77 | function tearDown() {
78 | m::close();
79 | }
80 |
81 | }
82 |
83 |
84 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/tests/resources/NotificationTest.php:
--------------------------------------------------------------------------------
1 | shouldReceive('delete')->once()
9 | ->with('/2010-04-01/Accounts/AC123/Notifications/NO123.json')
10 | ->andReturn(array(204, array(), ''));
11 | $client = new Services_Twilio('AC123', '123', '2010-04-01', $http);
12 | $client->account->notifications->delete('NO123');
13 | }
14 |
15 | function tearDown()
16 | {
17 | m::close();
18 | }
19 | }
20 |
21 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/tests/resources/OutgoingCallerIdsTest.php:
--------------------------------------------------------------------------------
1 | 'application/x-www-form-urlencoded');
7 | function testPost() {
8 | $http = m::mock(new Services_Twilio_TinyHttp);
9 | $http->shouldReceive('post')->once()
10 | ->with('/2010-04-01/Accounts/AC123/OutgoingCallerIds.json',
11 | $this->formHeaders, 'PhoneNumber=%2B14158675309&FriendlyName=My+Home+Phone+Number')
12 | ->andReturn(array(200, array('Content-Type' => 'application/json'),
13 | json_encode(array(
14 | 'account_sid' => 'AC123',
15 | 'phone_number' => '+14158675309',
16 | 'friendly_name' => 'My Home Phone Number',
17 | 'validation_code' => 123456,
18 | ))
19 | ));
20 | $client = new Services_Twilio('AC123', '123', '2010-04-01', $http);
21 | $request = $client->account->outgoing_caller_ids->create('+14158675309', array(
22 | 'FriendlyName' => 'My Home Phone Number',
23 | ));
24 | $this->assertEquals(123456, $request->validation_code);
25 | }
26 |
27 | function tearDown() {
28 | m::close();
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/tests/resources/QueuesTest.php:
--------------------------------------------------------------------------------
1 | 'application/x-www-form-urlencoded');
8 |
9 | function testCreate() {
10 | $http = m::mock(new Services_Twilio_TinyHttp);
11 | $http->shouldReceive('post')->once()
12 | ->with('/2010-04-01/Accounts/AC123/Queues.json', $this->formHeaders,
13 | 'FriendlyName=foo&MaxSize=123')
14 | ->andReturn(array(200, array('Content-Type' => 'application/json'),
15 | json_encode(array('sid' => 'QQ123', 'average_wait_time' => 0))
16 | ));
17 | $client = new Services_Twilio('AC123', '123', '2010-04-01', $http);
18 | $queue = $client->account->queues->create('foo',
19 | array('MaxSize' => 123));
20 | $this->assertSame($queue->sid, 'QQ123');
21 | $this->assertSame($queue->average_wait_time, 0);
22 | }
23 |
24 | function tearDown() {
25 | m::close();
26 | }
27 | }
28 |
29 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/tests/resources/SMSMessagesTest.php:
--------------------------------------------------------------------------------
1 | 'application/x-www-form-urlencoded');
7 |
8 | function testCreateMessage() {
9 | $http = m::mock(new Services_Twilio_TinyHttp);
10 | $http->shouldReceive('post')->once()
11 | ->with('/2010-04-01/Accounts/AC123/SMS/Messages.json', $this->formHeaders,
12 | 'From=%2B1222&To=%2B44123&Body=Hi+there')
13 | ->andReturn(array(200, array('Content-Type' => 'application/json'),
14 | json_encode(array('sid' => 'SM123'))
15 | ));
16 | $client = new Services_Twilio('AC123', '123', '2010-04-01', $http);
17 | $sms = $client->account->sms_messages->create('+1222', '+44123', 'Hi there');
18 | $this->assertSame('SM123', $sms->sid);
19 | }
20 |
21 | function testBadMessageThrowsException() {
22 | $this->setExpectedException('Services_Twilio_RestException');
23 | $http = m::mock(new Services_Twilio_TinyHttp);
24 | $http->shouldReceive('post')->once()
25 | ->with('/2010-04-01/Accounts/AC123/SMS/Messages.json', $this->formHeaders,
26 | 'From=%2B1222&To=%2B44123&Body=' . str_repeat('hi', 81))
27 | ->andReturn(array(400, array('Content-Type' => 'application/json'),
28 | json_encode(array(
29 | 'status' => '400',
30 | 'message' => 'Too long',
31 | ))
32 | ));
33 | $client = new Services_Twilio('AC123', '123', null, $http);
34 | $sms = $client->account->sms_messages->create('+1222', '+44123',
35 | str_repeat('hi', 81));
36 | }
37 | }
38 |
39 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/tests/resources/SandboxTest.php:
--------------------------------------------------------------------------------
1 | 'application/x-www-form-urlencoded');
7 | function testUpdateVoiceUrl()
8 | {
9 | $http = m::mock(new Services_Twilio_TinyHttp);
10 | $http->shouldReceive('post')->once()
11 | ->with('/2010-04-01/Accounts/AC123/Sandbox.json', $this->formHeaders, 'VoiceUrl=foo')
12 | ->andReturn(array(200, array('Content-Type' => 'application/json'),
13 | json_encode(array('voice_url' => 'foo'))
14 | ));
15 | $client = new Services_Twilio('AC123', '123', '2010-04-01', $http);
16 | $client->account->sandbox->update('VoiceUrl', 'foo');
17 | $this->assertEquals('foo', $client->account->sandbox->voice_url);
18 | }
19 |
20 | function tearDown() {
21 | m::close();
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/tests/resources/ShortCodesTest.php:
--------------------------------------------------------------------------------
1 | shouldReceive('get')->once()
10 | ->with('/2010-04-01/Accounts/AC123/SMS/ShortCodes/SC123.json')
11 | ->andReturn(array(200, array('Content-Type' => 'application/json'),
12 | json_encode(array('sid' => 'SC123', 'short_code' => '1234'))
13 | ));
14 | $client = new Services_Twilio('AC123', '123', '2010-04-01', $http);
15 | $sms = $client->account->short_codes->get('SC123');
16 | $this->assertSame('1234', $sms->short_code);
17 | }
18 | }
19 |
20 |
--------------------------------------------------------------------------------
/vendor/twilio/sdk/tests/resources/UsageTriggersTest.php:
--------------------------------------------------------------------------------
1 | shouldReceive('get')->once()
9 | ->with('/2010-04-01/Accounts/AC123/Usage/Triggers/UT123.json')
10 | ->andReturn(array(200, array('Content-Type' => 'application/json'),
11 | json_encode(array(
12 | 'sid' => 'UT123',
13 | 'date_created' => 'Tue, 09 Oct 2012 19:27:24 +0000',
14 | 'recurring' => null,
15 | 'usage_category' => 'totalprice',
16 | ))
17 | ));
18 | $client = new Services_Twilio('AC123', '456bef', '2010-04-01', $http);
19 | $usageSid = 'UT123';
20 | $usageTrigger = $client->account->usage_triggers->get($usageSid);
21 | $this->assertSame('totalprice', $usageTrigger->usage_category);
22 | }
23 |
24 | protected $formHeaders = array('Content-Type' => 'application/x-www-form-urlencoded');
25 |
26 | function testUpdateTrigger() {
27 | $http = m::mock(new Services_Twilio_TinyHttp);
28 | $usageSid = 'UT123';
29 | $http->shouldReceive('post')->once()
30 | ->with('/2010-04-01/Accounts/AC123/Usage/Triggers/UT123.json',
31 | $this->formHeaders, 'FriendlyName=new')
32 | ->andReturn(array(200, array('Content-Type' => 'application/json'),
33 | json_encode(array(
34 | 'friendly_name' => 'new',
35 | 'sid' => 'UT123',
36 | 'uri' => '/2010-04-01/Accounts/AC123/Usage/Triggers/UT123.json'
37 | ))
38 | ));
39 | $http->shouldReceive('get')->once()
40 | ->with('/2010-04-01/Accounts/AC123/Usage/Triggers/UT123.json')
41 | ->andReturn(array(200, array('Content-Type' => 'application/json'),
42 | json_encode(array(
43 | 'sid' => 'UT123',
44 | 'friendly_name' => 'new',
45 | ))
46 | ));
47 | $client = new Services_Twilio('AC123', '456bef', '2010-04-01', $http);
48 | $usageTrigger = $client->account->usage_triggers->get($usageSid);
49 | $usageTrigger->update(array(
50 | 'FriendlyName' => 'new',
51 | ));
52 | $usageTrigger2 = $client->account->usage_triggers->get($usageSid);
53 | $this->assertSame('new', $usageTrigger2->friendly_name);
54 | }
55 |
56 | function testFilterTriggerList() {
57 | $http = m::mock(new Services_Twilio_TinyHttp);
58 | $params = 'Page=0&PageSize=50&UsageCategory=sms';
59 | $http->shouldReceive('get')->once()
60 | ->with('/2010-04-01/Accounts/AC123/Usage/Triggers.json?' . $params)
61 | ->andReturn(array(200, array('Content-Type' => 'application/json'),
62 | json_encode(array('usage_triggers' => array(
63 | array(
64 | 'usage_category' => 'sms',
65 | 'current_value' => '4',
66 | 'trigger_value' => '100.30',
67 | ),
68 | array(
69 | 'usage_category' => 'sms',
70 | 'current_value' => '4',
71 | 'trigger_value' => '400.30',
72 | )),
73 | 'next_page_uri' => '/2010-04-01/Accounts/AC123/Usage/Triggers.json?UsageCategory=sms&Page=1&PageSize=50',
74 | ))
75 | ));
76 | $params = 'UsageCategory=sms&Page=1&PageSize=50';
77 | $http->shouldReceive('get')->once()
78 | ->with('/2010-04-01/Accounts/AC123/Usage/Triggers.json?' . $params)
79 | ->andReturn(array(400, array('Content-Type' => 'application/json'),
80 | '{"status":400,"message":"foo", "code": "20006"}'
81 | ));
82 | $client = new Services_Twilio('AC123', '456bef', '2010-04-01', $http);
83 | foreach ($client->account->usage_triggers->getIterator(
84 | 0, 50, array(
85 | 'UsageCategory' => 'sms',
86 | )) as $trigger
87 | ) {
88 | $this->assertSame($trigger->current_value, "4");
89 | }
90 | }
91 |
92 | function testCreateTrigger() {
93 | $http = m::mock(new Services_Twilio_TinyHttp);
94 | $params = 'UsageCategory=sms&TriggerValue=100&CallbackUrl=foo';
95 | $http->shouldReceive('post')->once()
96 | ->with('/2010-04-01/Accounts/AC123/Usage/Triggers.json',
97 | $this->formHeaders, $params)
98 | ->andReturn(array(201, array('Content-Type' => 'application/json'),
99 | json_encode(array(
100 | 'usage_category' => 'sms',
101 | 'sid' => 'UT123',
102 | 'uri' => '/2010-04-01/Accounts/AC123/Usage/Triggers/UT123.json'
103 | ))
104 | ));
105 | $client = new Services_Twilio('AC123', '456bef', '2010-04-01', $http);
106 | $trigger = $client->account->usage_triggers->create(
107 | 'sms',
108 | '100',
109 | 'foo'
110 | );
111 | $this->assertSame('sms', $trigger->usage_category);
112 | }
113 | }
114 |
115 |
--------------------------------------------------------------------------------