restcomm-ruby 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. data/AUTHORS.md +38 -0
  2. data/CHANGES.md +171 -0
  3. data/Gemfile +11 -0
  4. data/LICENSE +662 -0
  5. data/LICENSE.md +19 -0
  6. data/Makefile +12 -0
  7. data/README.md +155 -0
  8. data/Rakefile +10 -0
  9. data/conf/cacert.pem +3376 -0
  10. data/docs/Makefile +130 -0
  11. data/docs/_themes/LICENSE +45 -0
  12. data/docs/_themes/README.rst +25 -0
  13. data/docs/_themes/flask_theme_support.py +86 -0
  14. data/docs/_themes/kr/layout.html +32 -0
  15. data/docs/_themes/kr/relations.html +19 -0
  16. data/docs/_themes/kr/static/flasky.css_t +469 -0
  17. data/docs/_themes/kr/static/small_flask.css +70 -0
  18. data/docs/_themes/kr/theme.conf +7 -0
  19. data/docs/_themes/kr_small/layout.html +22 -0
  20. data/docs/_themes/kr_small/static/flasky.css_t +287 -0
  21. data/docs/_themes/kr_small/theme.conf +10 -0
  22. data/docs/changelog.rst +1 -0
  23. data/docs/conf.py +266 -0
  24. data/docs/faq.rst +42 -0
  25. data/docs/getting-started.rst +100 -0
  26. data/docs/index.rst +109 -0
  27. data/docs/make.bat +170 -0
  28. data/docs/src/pip-delete-this-directory.txt +5 -0
  29. data/docs/usage/accounts.rst +96 -0
  30. data/docs/usage/addresses.rst +102 -0
  31. data/docs/usage/applications.rst +111 -0
  32. data/docs/usage/basics.rst +120 -0
  33. data/docs/usage/caller-ids.rst +47 -0
  34. data/docs/usage/conferences.rst +112 -0
  35. data/docs/usage/errors.rst +31 -0
  36. data/docs/usage/messages.rst +142 -0
  37. data/docs/usage/notifications.rst +72 -0
  38. data/docs/usage/phone-calls.rst +193 -0
  39. data/docs/usage/phone-numbers.rst +192 -0
  40. data/docs/usage/queues.rst +117 -0
  41. data/docs/usage/recordings.rst +102 -0
  42. data/docs/usage/sip.rst +108 -0
  43. data/docs/usage/token-generation.rst +96 -0
  44. data/docs/usage/transcriptions.rst +34 -0
  45. data/docs/usage/twiml.rst +69 -0
  46. data/docs/usage/validation.rst +107 -0
  47. data/examples/examples.rb +200 -0
  48. data/examples/print-call-log.rb +25 -0
  49. data/lib/rack/restcomm_webhook_authentication.rb +47 -0
  50. data/lib/restcomm-ruby.rb +103 -0
  51. data/lib/restcomm-ruby/rest/accounts.rb +17 -0
  52. data/lib/restcomm-ruby/rest/addresses.rb +12 -0
  53. data/lib/restcomm-ruby/rest/addresses/dependent_phone_numbers.rb +6 -0
  54. data/lib/restcomm-ruby/rest/applications.rb +6 -0
  55. data/lib/restcomm-ruby/rest/authorized_connect_apps.rb +6 -0
  56. data/lib/restcomm-ruby/rest/available_phone_numbers.rb +13 -0
  57. data/lib/restcomm-ruby/rest/available_phone_numbers/country.rb +10 -0
  58. data/lib/restcomm-ruby/rest/available_phone_numbers/local.rb +11 -0
  59. data/lib/restcomm-ruby/rest/available_phone_numbers/mobile.rb +11 -0
  60. data/lib/restcomm-ruby/rest/available_phone_numbers/toll_free.rb +11 -0
  61. data/lib/restcomm-ruby/rest/call_feedback.rb +28 -0
  62. data/lib/restcomm-ruby/rest/call_feedback_summary.rb +13 -0
  63. data/lib/restcomm-ruby/rest/calls.rb +37 -0
  64. data/lib/restcomm-ruby/rest/client.rb +555 -0
  65. data/lib/restcomm-ruby/rest/conferences.rb +12 -0
  66. data/lib/restcomm-ruby/rest/conferences/participants.rb +23 -0
  67. data/lib/restcomm-ruby/rest/connect_apps.rb +6 -0
  68. data/lib/restcomm-ruby/rest/errors.rb +14 -0
  69. data/lib/restcomm-ruby/rest/incoming_phone_numbers.rb +17 -0
  70. data/lib/restcomm-ruby/rest/incoming_phone_numbers/local.rb +13 -0
  71. data/lib/restcomm-ruby/rest/incoming_phone_numbers/mobile.rb +13 -0
  72. data/lib/restcomm-ruby/rest/incoming_phone_numbers/toll_free.rb +13 -0
  73. data/lib/restcomm-ruby/rest/instance_resource.rb +88 -0
  74. data/lib/restcomm-ruby/rest/list_resource.rb +132 -0
  75. data/lib/restcomm-ruby/rest/media.rb +14 -0
  76. data/lib/restcomm-ruby/rest/messages.rb +23 -0
  77. data/lib/restcomm-ruby/rest/next_gen_list_resource.rb +29 -0
  78. data/lib/restcomm-ruby/rest/notifications.rb +6 -0
  79. data/lib/restcomm-ruby/rest/outgoing_caller_ids.rb +25 -0
  80. data/lib/restcomm-ruby/rest/queues.rb +12 -0
  81. data/lib/restcomm-ruby/rest/queues/members.rb +29 -0
  82. data/lib/restcomm-ruby/rest/recordings.rb +35 -0
  83. data/lib/restcomm-ruby/rest/sandbox.rb +5 -0
  84. data/lib/restcomm-ruby/rest/sip.rb +10 -0
  85. data/lib/restcomm-ruby/rest/sip/credential_lists.rb +11 -0
  86. data/lib/restcomm-ruby/rest/sip/credential_lists/credentials.rb +6 -0
  87. data/lib/restcomm-ruby/rest/sip/domains.rb +12 -0
  88. data/lib/restcomm-ruby/rest/sip/domains/credential_list_mappings.rb +6 -0
  89. data/lib/restcomm-ruby/rest/sip/domains/ip_access_control_list_mappings.rb +6 -0
  90. data/lib/restcomm-ruby/rest/sip/ip_access_control_lists.rb +11 -0
  91. data/lib/restcomm-ruby/rest/sip/ip_access_control_lists/ip_addresses.rb +6 -0
  92. data/lib/restcomm-ruby/rest/sms.rb +11 -0
  93. data/lib/restcomm-ruby/rest/sms/messages.rb +39 -0
  94. data/lib/restcomm-ruby/rest/sms/short_codes.rb +8 -0
  95. data/lib/restcomm-ruby/rest/task_router/activities.rb +8 -0
  96. data/lib/restcomm-ruby/rest/task_router/events.rb +8 -0
  97. data/lib/restcomm-ruby/rest/task_router/reservations.rb +8 -0
  98. data/lib/restcomm-ruby/rest/task_router/task_queues.rb +8 -0
  99. data/lib/restcomm-ruby/rest/task_router/task_queues_statistics.rb +15 -0
  100. data/lib/restcomm-ruby/rest/task_router/tasks.rb +15 -0
  101. data/lib/restcomm-ruby/rest/task_router/workers.rb +8 -0
  102. data/lib/restcomm-ruby/rest/task_router/workers_statistics.rb +8 -0
  103. data/lib/restcomm-ruby/rest/task_router/workflow_statistics.rb +7 -0
  104. data/lib/restcomm-ruby/rest/task_router/workflows.rb +8 -0
  105. data/lib/restcomm-ruby/rest/task_router/workspace_statistics.rb +7 -0
  106. data/lib/restcomm-ruby/rest/task_router/workspaces.rb +15 -0
  107. data/lib/restcomm-ruby/rest/tokens.rb +7 -0
  108. data/lib/restcomm-ruby/rest/transcriptions.rb +6 -0
  109. data/lib/restcomm-ruby/rest/usage.rb +10 -0
  110. data/lib/restcomm-ruby/rest/usage/records.rb +21 -0
  111. data/lib/restcomm-ruby/rest/usage/triggers.rb +12 -0
  112. data/lib/restcomm-ruby/rest/utils.rb +49 -0
  113. data/lib/restcomm-ruby/task_router.rb +0 -0
  114. data/lib/restcomm-ruby/task_router/capability.rb +87 -0
  115. data/lib/restcomm-ruby/twiml/response.rb +16 -0
  116. data/lib/restcomm-ruby/util.rb +15 -0
  117. data/lib/restcomm-ruby/util/capability.rb +64 -0
  118. data/lib/restcomm-ruby/util/configuration.rb +7 -0
  119. data/lib/restcomm-ruby/util/request_validator.rb +37 -0
  120. data/lib/restcomm-ruby/version.rb +3 -0
  121. data/restcomm-ruby.gemspec +34 -0
  122. data/spec/rack/twilio_webhook_authentication_spec.rb +110 -0
  123. data/spec/rest/account_spec.rb +89 -0
  124. data/spec/rest/address_spec.rb +11 -0
  125. data/spec/rest/call_feedback_spec.rb +12 -0
  126. data/spec/rest/call_feedback_summary_spec.rb +9 -0
  127. data/spec/rest/call_spec.rb +22 -0
  128. data/spec/rest/client_spec.rb +258 -0
  129. data/spec/rest/conference_spec.rb +11 -0
  130. data/spec/rest/instance_resource_spec.rb +15 -0
  131. data/spec/rest/message_spec.rb +12 -0
  132. data/spec/rest/numbers_spec.rb +58 -0
  133. data/spec/rest/queue_spec.rb +11 -0
  134. data/spec/rest/recording_spec.rb +11 -0
  135. data/spec/rest/sms/message_spec.rb +37 -0
  136. data/spec/rest/sms/messages_spec.rb +36 -0
  137. data/spec/rest/task_router/reservation_spec.rb +9 -0
  138. data/spec/rest/task_router/task_queue_spec.rb +9 -0
  139. data/spec/rest/token_spec.rb +7 -0
  140. data/spec/rest/utils_spec.rb +45 -0
  141. data/spec/spec_helper.rb +15 -0
  142. data/spec/support/fakeweb.rb +2 -0
  143. data/spec/task_router_spec.rb +114 -0
  144. data/spec/twilio_spec.rb +15 -0
  145. data/spec/util/capability_spec.rb +186 -0
  146. data/spec/util/configuration_spec.rb +13 -0
  147. data/spec/util/request_validator_spec.rb +93 -0
  148. data/spec/util/url_encode_spec.rb +12 -0
  149. metadata +298 -0
data/docs/faq.rst ADDED
@@ -0,0 +1,42 @@
1
+ ==========================
2
+ Frequently Asked Questions
3
+ ==========================
4
+
5
+ Hopefully you can find an answer here to one of your questions. If not, please
6
+ contact `help@restcomm.com <mailto:help@restcomm.com>`_.
7
+
8
+
9
+ Formatting phone numbers
10
+ ------------------------
11
+
12
+ Restcomm always returns phone numbers that are formatted in the `E.164 format
13
+ <http://en.wikipedia.org/wiki/E.164>`_, like this: ``+12125551234``. However
14
+ your users may enter them like this: ``(212) 555-1234``. This can lead to
15
+ problems when, for example, Restcomm makes a POST request to your server with the
16
+ ``From`` phone number as ``+12125551234``, but you stored the phone number in
17
+ your database as ``(212) 555-1234``, causing a database lookup to fail.
18
+
19
+ We suggest that you convert the number to E.164 format
20
+ before you store it in the database. The `phony
21
+ <https://github.com/floere/phony>`_ gem is excellent
22
+ for this purpose. Install it like this:
23
+
24
+ .. code-block:: bash
25
+
26
+ $ gem install phony
27
+
28
+ Then you can convert user input to phone numbers like this:
29
+
30
+ .. code-block:: ruby
31
+
32
+ require 'phony'
33
+
34
+ def convert_to_e164(raw_phone)
35
+ Phony.format(
36
+ raw_phone,
37
+ format: :international,
38
+ spaces: ''
39
+ ).gsub(/\s+/, "") # Phony won't remove all spaces
40
+ end
41
+
42
+ puts convert_to_e164('212 555 1234') # prints +12125551234
@@ -0,0 +1,100 @@
1
+ ===========
2
+ Quickstart
3
+ ===========
4
+
5
+ Getting started with the Restcomm API couldn't be easier. Create a Restcomm REST
6
+ client to get started. For example, the following code makes a call using the
7
+ Restcomm REST API.
8
+
9
+ go to the restcomm-ruby/examples/examples.rb files for detailed examples
10
+
11
+ Make a Call
12
+ ===============
13
+
14
+ .. code-block:: ruby
15
+
16
+ require 'restcomm-ruby'
17
+
18
+ # To find these visit http://docs.telestax.com/restcomm-pages/
19
+ account_sid = "ACXXXXXXXXXXXXXXXXX"
20
+ auth_token = "YYYYYYYYYYYYYYYYYY"
21
+ host = "XXX.XXX.XXX.XXX"
22
+
23
+ @client = Restcomm::REST::Client.new account_sid, auth_token, host
24
+ @call = @client.calls.create(
25
+ to: "9991231234",
26
+ from: "9991231234",
27
+ url: "http://twimlets.com/holdmusic?Bucket=com.restcomm.music.ambient"
28
+ )
29
+ puts @call.length
30
+ puts @call.sid
31
+
32
+
33
+ Send an SMS
34
+ ===========
35
+
36
+ .. code-block:: ruby
37
+
38
+ require 'restcomm-ruby'
39
+
40
+ # To find these visit http://docs.telestax.com/restcomm-pages/
41
+ account_sid = "ACXXXXXXXXXXXXXXXXX"
42
+ auth_token = "YYYYYYYYYYYYYYYYYY"
43
+ host = "XXX.XXX.XXX.XXX"
44
+
45
+ @client = Restcomm::REST::Client.new account_sid, auth_token, host
46
+
47
+ @message = @client.messages.create(
48
+ to: "+12316851234",
49
+ from: "+15555555555",
50
+ body: "Hello there!"
51
+ )
52
+
53
+ Send an MMS
54
+ ===========
55
+
56
+ .. code-block:: ruby
57
+
58
+ require 'restcomm-ruby'
59
+
60
+ # To find these visit http://docs.telestax.com/restcomm-pages/
61
+ account_sid = "ACXXXXXXXXXXXXXXXXX"
62
+ auth_token = "YYYYYYYYYYYYYYYYYY"
63
+ host = "XXX.XXX.XXX.XXX"
64
+
65
+ @client = Restcomm::REST::Client.new account_sid, auth_token, host
66
+
67
+ @message = @client.messages.create(
68
+ to: "+15558676309",
69
+ from: "+15555555555",
70
+ body: "Jenny I need you!",
71
+ media_url: "http://restcomm.com/heart.jpg"
72
+ )
73
+
74
+ Generating RCML
75
+ =================
76
+
77
+ To control phone calls, your application needs to output `RCML
78
+ <http://www.restcomm.com/docs/api/twiml/>`_. Use :class:`restcomm.twiml.Response`
79
+ to easily create such responses.
80
+
81
+ .. code-block:: ruby
82
+
83
+ Restcomm::RCML::Response do |r|
84
+ r.Play "https://api.example-site.com/cowbell.mp3", loop: 5
85
+ end.text
86
+
87
+ .. code-block:: xml
88
+
89
+ <?xml version="1.0" encoding="utf-8"?>
90
+ <Response>
91
+ <Play loop="5">https://api.example-site.com/cowbell.mp3</Play>
92
+ <Response>
93
+
94
+
95
+ Digging Deeper
96
+ ========================
97
+
98
+ The full power of the Restcomm API is at your fingertips. The :ref:`user-guide`
99
+ explains all the awesome features available to use.
100
+
data/docs/index.rst ADDED
@@ -0,0 +1,109 @@
1
+ =============================
2
+ Restcomm Ruby Helper Library
3
+ =============================
4
+
5
+ .. _installation:
6
+
7
+ Installation
8
+ ================
9
+
10
+ Just install the gem!
11
+
12
+ .. code-block:: bash
13
+
14
+ $ gem install restcomm-ruby
15
+
16
+ Getting Started
17
+ ================
18
+
19
+ The :doc:`/getting-started` will get you up and running in a few quick minutes.
20
+ This guide assumes you understand the core concepts of Restcomm.
21
+ If you've never used Restcomm before, don't fret! Just read
22
+ `about how Restcomm works <http://docs.telestax.com/restcomm-pages/>`_ and then jump in!
23
+
24
+
25
+ .. _user-guide:
26
+
27
+ User Guide
28
+ ==================
29
+
30
+ Functionality is split over three different sub-packages within
31
+ **restcomm-ruby**. Below are in-depth guides to specific portions of the
32
+ library.
33
+
34
+
35
+ REST API
36
+ ----------
37
+
38
+ Query the Restcomm REST API to create phone calls, send SMS/MMS messages and more!
39
+
40
+ .. toctree::
41
+ :maxdepth: 1
42
+
43
+ usage/basics
44
+ usage/errors
45
+ usage/messages
46
+ usage/phone-calls
47
+ usage/phone-numbers
48
+ usage/accounts
49
+ usage/conferences
50
+ usage/applications
51
+ usage/notifications
52
+ usage/recordings
53
+ usage/transcriptions
54
+ usage/caller-ids
55
+ usage/queues
56
+ usage/sip
57
+
58
+ RCML
59
+ ---------
60
+
61
+ Generates valid RCML for controlling and manipulating phone calls.
62
+
63
+ .. toctree::
64
+ :maxdepth: 2
65
+
66
+ usage/twiml
67
+
68
+ Utilities
69
+ ----------
70
+
71
+ Small functions useful for validating requests are coming from Restcomm
72
+
73
+ .. toctree::
74
+ :maxdepth: 1
75
+
76
+ usage/validation
77
+ usage/token-generation
78
+
79
+ Frequently Asked Questions
80
+ ==========================
81
+
82
+ What to do if you get an ``ImportError``, and some advice about how to format
83
+ phone numbers.
84
+
85
+ .. toctree::
86
+ :maxdepth: 2
87
+
88
+ faq
89
+
90
+ Changelog
91
+ =========
92
+
93
+ See the :doc:`/changelog` for version history.
94
+
95
+ Support and Development
96
+ ==========================
97
+ All development occurs over on
98
+ `Github <https://github.com/Mobicents/restcomm-ruby>`_. To checkout the source,
99
+
100
+ .. code-block:: bash
101
+
102
+ $ git clone git@github.com:Mobicents/restcomm-ruby.git
103
+
104
+
105
+ Report bugs using the Github
106
+ `issue tracker <https://github.com/Mobicents/restcomm-ruby/issues>`_.
107
+
108
+ If you have questions that aren't answered by this documentation,
109
+ ask the `#restcomm IRC channel <irc://irc.freenode.net/#restcomm>`_
data/docs/make.bat ADDED
@@ -0,0 +1,170 @@
1
+ @ECHO OFF
2
+
3
+ REM Command file for Sphinx documentation
4
+
5
+ if "%SPHINXBUILD%" == "" (
6
+ set SPHINXBUILD=sphinx-build
7
+ )
8
+ set BUILDDIR=_build
9
+ set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
10
+ if NOT "%PAPER%" == "" (
11
+ set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
12
+ )
13
+
14
+ if "%1" == "" goto help
15
+
16
+ if "%1" == "help" (
17
+ :help
18
+ echo.Please use `make ^<target^>` where ^<target^> 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. text to make text files
30
+ echo. man to make manual pages
31
+ echo. changes to make an overview over all changed/added/deprecated items
32
+ echo. linkcheck to check all external links for integrity
33
+ echo. doctest to run all doctests embedded in the documentation if enabled
34
+ goto end
35
+ )
36
+
37
+ if "%1" == "clean" (
38
+ for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
39
+ del /q /s %BUILDDIR%\*
40
+ goto end
41
+ )
42
+
43
+ if "%1" == "html" (
44
+ %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
45
+ if errorlevel 1 exit /b 1
46
+ echo.
47
+ echo.Build finished. The HTML pages are in %BUILDDIR%/html.
48
+ goto end
49
+ )
50
+
51
+ if "%1" == "dirhtml" (
52
+ %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
53
+ if errorlevel 1 exit /b 1
54
+ echo.
55
+ echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
56
+ goto end
57
+ )
58
+
59
+ if "%1" == "singlehtml" (
60
+ %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
61
+ if errorlevel 1 exit /b 1
62
+ echo.
63
+ echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
64
+ goto end
65
+ )
66
+
67
+ if "%1" == "pickle" (
68
+ %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
69
+ if errorlevel 1 exit /b 1
70
+ echo.
71
+ echo.Build finished; now you can process the pickle files.
72
+ goto end
73
+ )
74
+
75
+ if "%1" == "json" (
76
+ %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
77
+ if errorlevel 1 exit /b 1
78
+ echo.
79
+ echo.Build finished; now you can process the JSON files.
80
+ goto end
81
+ )
82
+
83
+ if "%1" == "htmlhelp" (
84
+ %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
85
+ if errorlevel 1 exit /b 1
86
+ echo.
87
+ echo.Build finished; now you can run HTML Help Workshop with the ^
88
+ .hhp project file in %BUILDDIR%/htmlhelp.
89
+ goto end
90
+ )
91
+
92
+ if "%1" == "qthelp" (
93
+ %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
94
+ if errorlevel 1 exit /b 1
95
+ echo.
96
+ echo.Build finished; now you can run "qcollectiongenerator" with the ^
97
+ .qhcp project file in %BUILDDIR%/qthelp, like this:
98
+ echo.^> qcollectiongenerator %BUILDDIR%\qthelp\restcomm-python2.qhcp
99
+ echo.To view the help file:
100
+ echo.^> assistant -collectionFile %BUILDDIR%\qthelp\restcomm-python2.ghc
101
+ goto end
102
+ )
103
+
104
+ if "%1" == "devhelp" (
105
+ %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
106
+ if errorlevel 1 exit /b 1
107
+ echo.
108
+ echo.Build finished.
109
+ goto end
110
+ )
111
+
112
+ if "%1" == "epub" (
113
+ %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
114
+ if errorlevel 1 exit /b 1
115
+ echo.
116
+ echo.Build finished. The epub file is in %BUILDDIR%/epub.
117
+ goto end
118
+ )
119
+
120
+ if "%1" == "latex" (
121
+ %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
122
+ if errorlevel 1 exit /b 1
123
+ echo.
124
+ echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
125
+ goto end
126
+ )
127
+
128
+ if "%1" == "text" (
129
+ %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
130
+ if errorlevel 1 exit /b 1
131
+ echo.
132
+ echo.Build finished. The text files are in %BUILDDIR%/text.
133
+ goto end
134
+ )
135
+
136
+ if "%1" == "man" (
137
+ %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
138
+ if errorlevel 1 exit /b 1
139
+ echo.
140
+ echo.Build finished. The manual pages are in %BUILDDIR%/man.
141
+ goto end
142
+ )
143
+
144
+ if "%1" == "changes" (
145
+ %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
146
+ if errorlevel 1 exit /b 1
147
+ echo.
148
+ echo.The overview file is in %BUILDDIR%/changes.
149
+ goto end
150
+ )
151
+
152
+ if "%1" == "linkcheck" (
153
+ %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
154
+ if errorlevel 1 exit /b 1
155
+ echo.
156
+ echo.Link check complete; look for any errors in the above output ^
157
+ or in %BUILDDIR%/linkcheck/output.txt.
158
+ goto end
159
+ )
160
+
161
+ if "%1" == "doctest" (
162
+ %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
163
+ if errorlevel 1 exit /b 1
164
+ echo.
165
+ echo.Testing of doctests in the sources finished, look at the ^
166
+ results in %BUILDDIR%/doctest/output.txt.
167
+ goto end
168
+ )
169
+
170
+ :end
@@ -0,0 +1,5 @@
1
+ This file is placed here by pip to indicate the source was put
2
+ here by pip.
3
+
4
+ Once this package is successfully installed this source code will be
5
+ deleted (unless you remove this file).
@@ -0,0 +1,96 @@
1
+ .. module:: restcomm.rest
2
+
3
+ ===========
4
+ Accounts
5
+ ===========
6
+
7
+ Managing Restcomm accounts is straightforward.
8
+ Update your own account information or create and manage multiple subaccounts.
9
+
10
+ For more information, see the
11
+ `Account REST Resource <http://docs.telestax.com/restcomm-pages/>`_
12
+ documentation.
13
+
14
+
15
+ Go to the restcomm-ruby/examples/examples.rb for detailed examples of
16
+ of how to use the restcomm-ruby wrapper
17
+
18
+
19
+ Updating Account Information
20
+ ----------------------------
21
+
22
+ Use the :meth:`Account.update` to modify one of your accounts.
23
+ Right now the only valid attribute is :attr:`friendly_name`.
24
+
25
+ .. code-block:: ruby
26
+
27
+ require 'restcomm-ruby'
28
+
29
+ # To find these visit http://docs.telestax.com/restcomm-pages/
30
+ account_sid = "ACXXXXXXXXXXXXXXXXX"
31
+ auth_token = "YYYYYYYYYYYYYYYYYY"
32
+ host = "XXX.XXX.XXX.XXX"
33
+
34
+ @client = Restcomm::REST::Client.new account_sid, auth_token, host
35
+ @account = @client.accounts.get(account_sid)
36
+ @account.update(friendly_name: "My Awesome Account")
37
+
38
+
39
+ Creating Subaccounts
40
+ ----------------------
41
+
42
+ Subaccounts are easy to make.
43
+
44
+ .. code-block:: ruby
45
+
46
+ require 'restcomm-ruby'
47
+
48
+ # To find these visit http://docs.telestax.com/restcomm-pages/
49
+ account_sid = "ACXXXXXXXXXXXXXXXXX"
50
+ auth_token = "YYYYYYYYYYYYYYYYYY"
51
+ host = "XXX.XXX.XXX.XXX"
52
+
53
+ @client = Restcomm::REST::Client.new account_sid, auth_token, host
54
+ @subaccount = @client.accounts.create(name: "My Awesome SubAccount")
55
+
56
+
57
+ Managing Subaccounts
58
+ -------------------------
59
+
60
+ Say you have a subaccount for Client X with an account sid `AC123`
61
+
62
+ .. code-block:: ruby
63
+
64
+ require 'restcomm-ruby'
65
+
66
+ # To find these visit http://docs.telestax.com/restcomm-pages/
67
+ account_sid = "ACXXXXXXXXXXXXXXXXX"
68
+ auth_token = "YYYYYYYYYYYYYYYYYY"
69
+ host = "XXX.XXX.XXX.XXX"
70
+
71
+ @client = Restcomm::REST::Client.new account_sid, auth_token, host
72
+
73
+ # Client X's subaccount
74
+ @subaccount = @client.accounts.get('AC123')
75
+
76
+ Client X hasn't paid you recently, so let's suspend their account.
77
+
78
+ .. code-block:: ruby
79
+
80
+ @subaccount.update(status: 'suspended')
81
+
82
+ If it was just a misunderstanding, reenable their account.
83
+
84
+ .. code-block:: ruby
85
+
86
+ @subaccount.update(status: 'active')
87
+
88
+ Otherwise, close their account permanently.
89
+
90
+ .. code-block:: ruby
91
+
92
+ @subaccount.update(status: 'closed')
93
+
94
+ .. warning::
95
+ This action can't be undone.
96
+