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.
- data/AUTHORS.md +38 -0
- data/CHANGES.md +171 -0
- data/Gemfile +11 -0
- data/LICENSE +662 -0
- data/LICENSE.md +19 -0
- data/Makefile +12 -0
- data/README.md +155 -0
- data/Rakefile +10 -0
- data/conf/cacert.pem +3376 -0
- data/docs/Makefile +130 -0
- data/docs/_themes/LICENSE +45 -0
- data/docs/_themes/README.rst +25 -0
- data/docs/_themes/flask_theme_support.py +86 -0
- data/docs/_themes/kr/layout.html +32 -0
- data/docs/_themes/kr/relations.html +19 -0
- data/docs/_themes/kr/static/flasky.css_t +469 -0
- data/docs/_themes/kr/static/small_flask.css +70 -0
- data/docs/_themes/kr/theme.conf +7 -0
- data/docs/_themes/kr_small/layout.html +22 -0
- data/docs/_themes/kr_small/static/flasky.css_t +287 -0
- data/docs/_themes/kr_small/theme.conf +10 -0
- data/docs/changelog.rst +1 -0
- data/docs/conf.py +266 -0
- data/docs/faq.rst +42 -0
- data/docs/getting-started.rst +100 -0
- data/docs/index.rst +109 -0
- data/docs/make.bat +170 -0
- data/docs/src/pip-delete-this-directory.txt +5 -0
- data/docs/usage/accounts.rst +96 -0
- data/docs/usage/addresses.rst +102 -0
- data/docs/usage/applications.rst +111 -0
- data/docs/usage/basics.rst +120 -0
- data/docs/usage/caller-ids.rst +47 -0
- data/docs/usage/conferences.rst +112 -0
- data/docs/usage/errors.rst +31 -0
- data/docs/usage/messages.rst +142 -0
- data/docs/usage/notifications.rst +72 -0
- data/docs/usage/phone-calls.rst +193 -0
- data/docs/usage/phone-numbers.rst +192 -0
- data/docs/usage/queues.rst +117 -0
- data/docs/usage/recordings.rst +102 -0
- data/docs/usage/sip.rst +108 -0
- data/docs/usage/token-generation.rst +96 -0
- data/docs/usage/transcriptions.rst +34 -0
- data/docs/usage/twiml.rst +69 -0
- data/docs/usage/validation.rst +107 -0
- data/examples/examples.rb +200 -0
- data/examples/print-call-log.rb +25 -0
- data/lib/rack/restcomm_webhook_authentication.rb +47 -0
- data/lib/restcomm-ruby.rb +103 -0
- data/lib/restcomm-ruby/rest/accounts.rb +17 -0
- data/lib/restcomm-ruby/rest/addresses.rb +12 -0
- data/lib/restcomm-ruby/rest/addresses/dependent_phone_numbers.rb +6 -0
- data/lib/restcomm-ruby/rest/applications.rb +6 -0
- data/lib/restcomm-ruby/rest/authorized_connect_apps.rb +6 -0
- data/lib/restcomm-ruby/rest/available_phone_numbers.rb +13 -0
- data/lib/restcomm-ruby/rest/available_phone_numbers/country.rb +10 -0
- data/lib/restcomm-ruby/rest/available_phone_numbers/local.rb +11 -0
- data/lib/restcomm-ruby/rest/available_phone_numbers/mobile.rb +11 -0
- data/lib/restcomm-ruby/rest/available_phone_numbers/toll_free.rb +11 -0
- data/lib/restcomm-ruby/rest/call_feedback.rb +28 -0
- data/lib/restcomm-ruby/rest/call_feedback_summary.rb +13 -0
- data/lib/restcomm-ruby/rest/calls.rb +37 -0
- data/lib/restcomm-ruby/rest/client.rb +555 -0
- data/lib/restcomm-ruby/rest/conferences.rb +12 -0
- data/lib/restcomm-ruby/rest/conferences/participants.rb +23 -0
- data/lib/restcomm-ruby/rest/connect_apps.rb +6 -0
- data/lib/restcomm-ruby/rest/errors.rb +14 -0
- data/lib/restcomm-ruby/rest/incoming_phone_numbers.rb +17 -0
- data/lib/restcomm-ruby/rest/incoming_phone_numbers/local.rb +13 -0
- data/lib/restcomm-ruby/rest/incoming_phone_numbers/mobile.rb +13 -0
- data/lib/restcomm-ruby/rest/incoming_phone_numbers/toll_free.rb +13 -0
- data/lib/restcomm-ruby/rest/instance_resource.rb +88 -0
- data/lib/restcomm-ruby/rest/list_resource.rb +132 -0
- data/lib/restcomm-ruby/rest/media.rb +14 -0
- data/lib/restcomm-ruby/rest/messages.rb +23 -0
- data/lib/restcomm-ruby/rest/next_gen_list_resource.rb +29 -0
- data/lib/restcomm-ruby/rest/notifications.rb +6 -0
- data/lib/restcomm-ruby/rest/outgoing_caller_ids.rb +25 -0
- data/lib/restcomm-ruby/rest/queues.rb +12 -0
- data/lib/restcomm-ruby/rest/queues/members.rb +29 -0
- data/lib/restcomm-ruby/rest/recordings.rb +35 -0
- data/lib/restcomm-ruby/rest/sandbox.rb +5 -0
- data/lib/restcomm-ruby/rest/sip.rb +10 -0
- data/lib/restcomm-ruby/rest/sip/credential_lists.rb +11 -0
- data/lib/restcomm-ruby/rest/sip/credential_lists/credentials.rb +6 -0
- data/lib/restcomm-ruby/rest/sip/domains.rb +12 -0
- data/lib/restcomm-ruby/rest/sip/domains/credential_list_mappings.rb +6 -0
- data/lib/restcomm-ruby/rest/sip/domains/ip_access_control_list_mappings.rb +6 -0
- data/lib/restcomm-ruby/rest/sip/ip_access_control_lists.rb +11 -0
- data/lib/restcomm-ruby/rest/sip/ip_access_control_lists/ip_addresses.rb +6 -0
- data/lib/restcomm-ruby/rest/sms.rb +11 -0
- data/lib/restcomm-ruby/rest/sms/messages.rb +39 -0
- data/lib/restcomm-ruby/rest/sms/short_codes.rb +8 -0
- data/lib/restcomm-ruby/rest/task_router/activities.rb +8 -0
- data/lib/restcomm-ruby/rest/task_router/events.rb +8 -0
- data/lib/restcomm-ruby/rest/task_router/reservations.rb +8 -0
- data/lib/restcomm-ruby/rest/task_router/task_queues.rb +8 -0
- data/lib/restcomm-ruby/rest/task_router/task_queues_statistics.rb +15 -0
- data/lib/restcomm-ruby/rest/task_router/tasks.rb +15 -0
- data/lib/restcomm-ruby/rest/task_router/workers.rb +8 -0
- data/lib/restcomm-ruby/rest/task_router/workers_statistics.rb +8 -0
- data/lib/restcomm-ruby/rest/task_router/workflow_statistics.rb +7 -0
- data/lib/restcomm-ruby/rest/task_router/workflows.rb +8 -0
- data/lib/restcomm-ruby/rest/task_router/workspace_statistics.rb +7 -0
- data/lib/restcomm-ruby/rest/task_router/workspaces.rb +15 -0
- data/lib/restcomm-ruby/rest/tokens.rb +7 -0
- data/lib/restcomm-ruby/rest/transcriptions.rb +6 -0
- data/lib/restcomm-ruby/rest/usage.rb +10 -0
- data/lib/restcomm-ruby/rest/usage/records.rb +21 -0
- data/lib/restcomm-ruby/rest/usage/triggers.rb +12 -0
- data/lib/restcomm-ruby/rest/utils.rb +49 -0
- data/lib/restcomm-ruby/task_router.rb +0 -0
- data/lib/restcomm-ruby/task_router/capability.rb +87 -0
- data/lib/restcomm-ruby/twiml/response.rb +16 -0
- data/lib/restcomm-ruby/util.rb +15 -0
- data/lib/restcomm-ruby/util/capability.rb +64 -0
- data/lib/restcomm-ruby/util/configuration.rb +7 -0
- data/lib/restcomm-ruby/util/request_validator.rb +37 -0
- data/lib/restcomm-ruby/version.rb +3 -0
- data/restcomm-ruby.gemspec +34 -0
- data/spec/rack/twilio_webhook_authentication_spec.rb +110 -0
- data/spec/rest/account_spec.rb +89 -0
- data/spec/rest/address_spec.rb +11 -0
- data/spec/rest/call_feedback_spec.rb +12 -0
- data/spec/rest/call_feedback_summary_spec.rb +9 -0
- data/spec/rest/call_spec.rb +22 -0
- data/spec/rest/client_spec.rb +258 -0
- data/spec/rest/conference_spec.rb +11 -0
- data/spec/rest/instance_resource_spec.rb +15 -0
- data/spec/rest/message_spec.rb +12 -0
- data/spec/rest/numbers_spec.rb +58 -0
- data/spec/rest/queue_spec.rb +11 -0
- data/spec/rest/recording_spec.rb +11 -0
- data/spec/rest/sms/message_spec.rb +37 -0
- data/spec/rest/sms/messages_spec.rb +36 -0
- data/spec/rest/task_router/reservation_spec.rb +9 -0
- data/spec/rest/task_router/task_queue_spec.rb +9 -0
- data/spec/rest/token_spec.rb +7 -0
- data/spec/rest/utils_spec.rb +45 -0
- data/spec/spec_helper.rb +15 -0
- data/spec/support/fakeweb.rb +2 -0
- data/spec/task_router_spec.rb +114 -0
- data/spec/twilio_spec.rb +15 -0
- data/spec/util/capability_spec.rb +186 -0
- data/spec/util/configuration_spec.rb +13 -0
- data/spec/util/request_validator_spec.rb +93 -0
- data/spec/util/url_encode_spec.rb +12 -0
- metadata +298 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
module Restcomm
|
|
2
|
+
module REST
|
|
3
|
+
class Members < ListResource
|
|
4
|
+
def initialize(path, client)
|
|
5
|
+
super
|
|
6
|
+
# hard-code the json keys since members are special
|
|
7
|
+
@list_key, @instance_id_key = 'queue_members', 'call_sid'
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def front
|
|
11
|
+
@instance_class.new "#{@path}/Front", @client
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def front!
|
|
15
|
+
front.refresh
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def dequeue(url, method='POST')
|
|
19
|
+
front.dequeue url, method
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
class Member < InstanceResource
|
|
24
|
+
def dequeue(url, method='POST')
|
|
25
|
+
update url: url, method: method
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
module Restcomm
|
|
2
|
+
module REST
|
|
3
|
+
class Recordings < ListResource; end
|
|
4
|
+
|
|
5
|
+
class Recording < InstanceResource
|
|
6
|
+
def initialize(path, client, params={})
|
|
7
|
+
path.sub! /\/Calls\/CA[^\/]+/, ''
|
|
8
|
+
super path, client, params
|
|
9
|
+
resource :transcriptions
|
|
10
|
+
# grab a reference to the client's connection object for streaming
|
|
11
|
+
@connection = @client.instance_variable_get :@connection
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
##
|
|
15
|
+
# Return the wav URL for this recording.
|
|
16
|
+
def wav
|
|
17
|
+
"https://#{@connection.address}#{@path}.wav"
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def wav!(&block)
|
|
21
|
+
@connection.request_get @path, &block
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
##
|
|
25
|
+
# Return the mp3 URL for this recording.
|
|
26
|
+
def mp3
|
|
27
|
+
"https://#{@connection.address}#{@path}.mp3"
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def mp3!(&block)
|
|
31
|
+
@connection.request_get "#{@path}.mp3", &block
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
module Restcomm
|
|
2
|
+
module REST
|
|
3
|
+
module SMS
|
|
4
|
+
|
|
5
|
+
module Deprecation
|
|
6
|
+
def deprecate(method_name)
|
|
7
|
+
old_method = "_deprecated_#{method_name}"
|
|
8
|
+
alias_method old_method, method_name
|
|
9
|
+
define_method method_name do |*args, &block|
|
|
10
|
+
warn "[DEPRECATED] SMS Resource is deprecated. Please use Messages (https://www.restcomm.com/docs/api/rest/message)"
|
|
11
|
+
send old_method, *args, &block
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
class Messages < ListResource
|
|
17
|
+
extend Deprecation
|
|
18
|
+
|
|
19
|
+
deprecate :list
|
|
20
|
+
deprecate :total
|
|
21
|
+
deprecate :get
|
|
22
|
+
deprecate :create
|
|
23
|
+
|
|
24
|
+
def initialize(path, client)
|
|
25
|
+
super
|
|
26
|
+
@list_key = 'sms_messages'
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
class Message < InstanceResource
|
|
31
|
+
extend Deprecation
|
|
32
|
+
|
|
33
|
+
deprecate :update
|
|
34
|
+
deprecate :refresh
|
|
35
|
+
deprecate :delete
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Restcomm
|
|
2
|
+
module REST
|
|
3
|
+
module TaskRouter
|
|
4
|
+
class TaskQueuesStatistics < Restcomm::REST::NextGenListResource
|
|
5
|
+
def initialize(path, client)
|
|
6
|
+
@path, @client = path, client
|
|
7
|
+
@instance_class = Restcomm::REST::TaskRouter::TaskQueueStatistics
|
|
8
|
+
@list_key, @instance_id_key = 'task_queues_statistics', 'task_queue_sid'
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
class TaskQueueStatistics < InstanceResource; end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Restcomm
|
|
2
|
+
module REST
|
|
3
|
+
module TaskRouter
|
|
4
|
+
class Tasks < Restcomm::REST::NextGenListResource; end
|
|
5
|
+
|
|
6
|
+
class Task < InstanceResource
|
|
7
|
+
def initialize(path, client, params={})
|
|
8
|
+
super path, client, params
|
|
9
|
+
@submodule = :TaskRouter
|
|
10
|
+
resource :reservations
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Restcomm
|
|
2
|
+
module REST
|
|
3
|
+
module TaskRouter
|
|
4
|
+
class Workspaces < Restcomm::REST::NextGenListResource; end
|
|
5
|
+
|
|
6
|
+
class Workspace < InstanceResource
|
|
7
|
+
def initialize(path, client, params={})
|
|
8
|
+
super path, client, params
|
|
9
|
+
@submodule = :TaskRouter
|
|
10
|
+
resource :activities, :events, :task_queues, :tasks, :workers, :workflows
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
module Restcomm
|
|
2
|
+
module REST
|
|
3
|
+
class Records < ListResource
|
|
4
|
+
|
|
5
|
+
SUBRESOURCES = [:daily, :monthly, :yearly, :all_time, :today,
|
|
6
|
+
:yesterday, :this_month, :last_month]
|
|
7
|
+
|
|
8
|
+
def initialize(path, client)
|
|
9
|
+
super
|
|
10
|
+
@list_key = 'usage_records'
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def method_missing(method, *args)
|
|
14
|
+
return super unless SUBRESOURCES.include? method
|
|
15
|
+
self.class.new "#{@path}/#{restify(method)}", @client
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
class Record < InstanceResource; end
|
|
20
|
+
end
|
|
21
|
+
end
|