-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add Terminal Verbs * update bridge and add unit test * add unit test for root verb module * bridge test * bridge comment * update conference * add terminal verb unit test * verb test * all attributes in bridge test * add conference and test * add conference to sdk * remove backslash escaping * test number * use real booleans for conference * add comment to bridge * add pause and test * conference timeout is a Number * add forward and test * add explicit empty hash to tag * add hangup and test * add pause_recording and test * add phone_number and test * add play_audio and test * comments for params * add record and test * add redirect and test * add resume_recording and test * add ring and test * add send_dtmf and test * add sip_uri and test * add speak_sentence and test * add start_gather and test * add start_recording and test * add stop_gather and test * add stop_recording and test * add stop_stream and test * _name for stop_stream * add stream_param and test * add test for tag verb * turn ssml regex into constants * test decimals in ring verb * test decimals in conference * comment clean up * Add Non-Terminal Verbs (#77) * Add Non-Terminal Verbs * merge SWI-1730 * update gather and add tests * period in gather comment * add start_stream and test * add transfer and test * remove add_verb method * update response and bxml class tests * update non-terminal verbs and tests * refactor base verb classes (#80)
- Loading branch information
Showing
59 changed files
with
1,660 additions
and
455 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
require 'ox' | ||
|
||
module Bandwidth | ||
module Bxml | ||
module NestableVerb | ||
include Bandwidth::Bxml::Verb | ||
|
||
# Initializer | ||
# @param tag [String] Name of the XML element. | ||
# @param content [String] XML element content. Defaults to nil. | ||
# @param nested_verbs [Array] XML element children. Defaults to an empty array. | ||
# @param attributes [Hash] The attributes to add to the element. Defaults to an empty hash. | ||
def initialize(tag, content = nil, nested_verbs = [], attributes = {}) | ||
@tag = tag | ||
@content = content | ||
@nested_verbs = nested_verbs | ||
@attributes = attributes | ||
@attribute_map = [] | ||
end | ||
|
||
# Generate an XML element for the verb | ||
# @return [Node] The XML element. | ||
def generate_xml | ||
root = Ox::Element.new(@tag) | ||
if @content | ||
root << @content | ||
end | ||
|
||
if @nested_verbs.length > 0 | ||
@nested_verbs.each do |verb| | ||
root << verb.generate_xml | ||
end | ||
end | ||
|
||
if !@attributes.empty? | ||
@attributes.each do |key, value| | ||
if @attribute_map.include? key.to_sym | ||
root[@attribute_map[key.to_sym]] = value | ||
else | ||
raise NoMethodError.new("attribute '#{key}' is not a valid attribute for this verb") | ||
end | ||
end | ||
end | ||
|
||
return root | ||
end | ||
|
||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,31 @@ | ||
require_relative 'xml_verb' | ||
|
||
module Bandwidth | ||
module Voice | ||
# The Conference verb is used to add callees to conferences | ||
module Bandwidth | ||
module Bxml | ||
class Conference | ||
include XmlVerb | ||
include Bandwidth::Bxml::Verb | ||
|
||
def to_bxml(xml) | ||
if not call_ids_to_coach.nil? | ||
coach_ids = call_ids_to_coach.instance_of?(String) ? call_ids_to_coach : call_ids_to_coach.join(",") | ||
else | ||
coach_ids = nil | ||
end | ||
xml.Conference(conference_name, compact_hash({ | ||
'mute' => mute, | ||
'hold' => hold, | ||
'callIdsToCoach' => coach_ids, | ||
'conferenceEventUrl' => conference_event_url, | ||
'conferenceEventMethod' => conference_event_method, | ||
'username' => username, | ||
'password' => password, | ||
'tag' => tag, | ||
'conferenceEventFallbackUrl' => conference_event_fallback_url, | ||
'conferenceEventFallbackMethod' => conference_event_fallback_method, | ||
'fallbackUsername' => fallback_username, | ||
'fallbackPassword' => fallback_password | ||
})) | ||
# Initializer | ||
# @param name [String] The name of the conference. Can contain up to 100 characters of letters, numbers, and the symbols -, _, and . | ||
# @param attributes [Hash] The attributes to add to the element. Defaults to an empty hash. | ||
def initialize(name, attributes = {}) | ||
super("Conference", name, attributes) | ||
|
||
@attribute_map = { | ||
mute: 'mute', # Optional [Boolean]: A boolean value to indicate whether the member should be on mute in the conference. When muted, a member can hear others speak, but others cannot hear them speak. Defaults to false. | ||
hold: 'hold', # Optional [Boolean]: A boolean value to indicate whether the member should be on hold in the conference. When on hold, a member cannot hear others, and they cannot be heard. Defaults to false. | ||
call_ids_to_coach: 'callIdsToCoach', # Optional [String]: A comma-separated list of call ids to coach. When a call joins a conference with this attribute set, it will coach the listed calls. Those calls will be able to hear and be heard by the coach, but other calls in the conference will not hear the coach. | ||
conference_event_url: 'conferenceEventUrl', # Optional [String]: URL to send Conference events to. The URL, method, username, and password are set by the BXML document that creates the conference, and all events related to that conference will be delivered to that same endpoint. If more calls join afterwards and also have this property (or any other webhook related properties like username and password), they will be ignored and the original webhook information will be used. This URL may be a relative endpoint. | ||
conference_event_method: 'conferenceEventMethod', # Optional [String]: The HTTP method to use for the request to conferenceEventUrl. GET or POST. Default value is POST. | ||
conference_event_fallback_url: 'conferenceEventFallbackUrl', # Optional [String]: A fallback url which, if provided, will be used to retry the conference webhook deliveries in case conferenceEventUrl fails to respond. | ||
conference_event_fallback_method: 'conferenceEventFallbackMethod', # Optional [String]: The HTTP method to use to deliver the conference webhooks to conferenceEventFallbackUrl. GET or POST. Default value is POST. | ||
username: 'username', # Optional [String]: The username to send in the HTTP request to conferenceEventUrl. | ||
password: 'password', # Optional [String]: The password to send in the HTTP request to conferenceEventUrl. | ||
fallback_username: 'fallbackUsername', # Optional [String]: The username to send in the HTTP request to conferenceEventFallbackUrl. | ||
fallback_password: 'fallbackPassword', # Optional [String]: The password to send in the HTTP request to conferenceEventFallbackUrl. | ||
tag: 'tag', # Optional [String]: A custom string that will be sent with this and all future callbacks unless overwritten by a future tag attribute or <Tag> verb, or cleared. May be cleared by setting tag="". Max length 256 characters. Defaults to None. | ||
callback_timeout: 'callbackTimeout', # Optional [Number]: This is the timeout (in seconds) to use when delivering webhooks for the conference. If not set, it will inherit the webhook timeout from the call that creates the conference. Can be any numeric value (including decimals) between 1 and 25. | ||
} | ||
end | ||
end | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.