lib/twilio-ruby/twiml/voice_response.rb in twilio-ruby-5.2.0 vs lib/twilio-ruby/twiml/voice_response.rb in twilio-ruby-5.2.1

- old
+ new

@@ -1,916 +1,532 @@ +## +# This code was generated by +# \ / _ _ _| _ _ +# | (_)\/(_)(_|\/| |(/_ v1.0.0 +# / / + module Twilio module TwiML - # Voice TwiML Response + ## + # <Response> TwiML for Voice class VoiceResponse < TwiML - # Create a new <Response> - def initialize - super() + def initialize(**keyword_args) + super(**keyword_args) @name = 'Response' + yield(self) if block_given? end - # Create a <Dial> element - # - # == Parameters: - # number:: phone number to dial - # action:: action URL - # method:: action HTTP method - # timeout:: time to wait for answer - # hangup_on_star:: hangup call on * press - # time_limit:: max time length - # caller_id:: caller ID to display - # record:: record the call - # trim:: trim the recording - # recording_status_callback:: status callback URL - # recording_status_callback_method:: status callback URL method + ## + # Create a new <Dial> element + # number:: Phone number to dial + # action:: Action URL + # method:: Action URL method + # timeout:: Time to wait for answer + # hangup_on_star:: Hangup call on star press + # time_limit:: Max time length + # caller_id:: Caller ID to display + # record:: Record the call + # trim:: Trim the recording + # recording_status_callback:: Recording status callback URL + # recording_status_callback_method:: Recording status callback URL method # keyword_args:: additional attributes - # - # == Returns: - # A <Response> element with a <Dial> child element - def dial( - number: nil, - action: nil, - method: nil, - timeout: nil, - hangup_on_star: nil, - time_limit: nil, - caller_id: nil, - record: nil, - trim: nil, - recording_status_callback: nil, - recording_status_callback_method: nil, - **keyword_args - ) + def dial(number: nil, action: nil, method: nil, timeout: nil, hangup_on_star: nil, time_limit: nil, caller_id: nil, record: nil, trim: nil, recording_status_callback: nil, recording_status_callback_method: nil, **keyword_args) + dial = Dial.new(number: number, action: action, method: method, timeout: timeout, hangup_on_star: hangup_on_star, time_limit: time_limit, caller_id: caller_id, record: record, trim: trim, recording_status_callback: recording_status_callback, recording_status_callback_method: recording_status_callback_method, **keyword_args) - dial = Dial.new( - number: number, - action: action, - method: method, - timeout: timeout, - hangup_on_star: hangup_on_star, - time_limit: time_limit, - caller_id: caller_id, - record: record, - trim: trim, - recording_status_callback: recording_status_callback, - recording_status_callback_method: recording_status_callback_method, - **keyword_args - ) - yield(dial) if block_given? append(dial) end - # Create an <Echo> element - # - # == Parameters: - # keyword_args:: attributes - # - # == Returns: - # A <Response> element with an <Echo> child element + ## + # Create a new <Echo> element + # keyword_args:: additional attributes def echo(**keyword_args) append(Echo.new(**keyword_args)) end - # Create an <Enqueue> element - # - # == Parameters: - # name:: friendly name - # action:: action URL - # method:: action URL method - # wait_url:: wait URL - # wait_url_method:: wait URL method - # workflow_sid:: TaskRouter workflow SID + ## + # Create a new <Enqueue> element + # name:: Friendly name + # action:: Action URL + # method:: Action URL method + # wait_url:: Wait URL + # wait_url_method:: Wait URL method + # workflow_sid:: TaskRouter Workflow SID # keyword_args:: additional attributes - # - # == Returns: - # A <Response> element with an <Enqueue> child element - def enqueue( - name, - action: nil, - method: nil, - wait_url: nil, - wait_url_method: nil, - workflow_sid: nil, - **keyword_args - ) + def enqueue(name: nil, action: nil, method: nil, wait_url: nil, wait_url_method: nil, workflow_sid: nil, **keyword_args) + enqueue = Enqueue.new(name: name, action: action, method: method, wait_url: wait_url, wait_url_method: wait_url_method, workflow_sid: workflow_sid, **keyword_args) - enqueue = Enqueue.new( - name, - action: action, - method: method, - wait_url: wait_url, - wait_url_method: wait_url_method, - workflow_sid: workflow_sid, - **keyword_args - ) - yield(enqueue) if block_given? append(enqueue) end - # Create a <Gather> element - # - # == Parameters: - # action:: action URL - # method:: action URL method - # timeout:: time to wait while gathering input - # finish_on_key:: finish on key press - # num_digits:: digits to collect - # partial_result_callback:: callback url - # partial_result_callback_method:: callback method - # language:: locale string - # hints:: speech recognition hints - # barge_in:: stop playing media upon speech - # acknowledge_sound_url:: url to hit when sound starts + ## + # Create a new <Gather> element + # input:: Input type Twilio should accept + # action:: Action URL + # method:: Action URL method + # timeout:: Time to wait to gather input + # finish_on_key:: Finish gather on key + # num_digits:: Number of digits to collect + # partial_result_callback:: Partial result callback URL + # partial_result_callback_method:: Partial result callback URL method + # language:: Language to use + # hints:: Speech recognition hints + # barge_in:: Stop playing media upon speech # keyword_args:: additional attributes - # - # == Returns: - # A <Response> element with a <Gather> child element - def gather( - action: nil, - method: nil, - timeout: nil, - finish_on_key: nil, - num_digits: nil, - partial_result_callback: nil, - partial_result_callback_method: nil, - language: nil, - hints: nil, - barge_in: nil, - acknowledge_sound_url: nil, - **keyword_args - ) + def gather(input: nil, action: nil, method: nil, timeout: nil, finish_on_key: nil, num_digits: nil, partial_result_callback: nil, partial_result_callback_method: nil, language: nil, hints: nil, barge_in: nil, **keyword_args) + gather = Gather.new(input: input, action: action, method: method, timeout: timeout, finish_on_key: finish_on_key, num_digits: num_digits, partial_result_callback: partial_result_callback, partial_result_callback_method: partial_result_callback_method, language: language, hints: hints, barge_in: barge_in, **keyword_args) - gather = Gather.new( - action: action, - method: method, - timeout: timeout, - finish_on_key: finish_on_key, - num_digits: num_digits, - partial_result_callback: partial_result_callback, - partial_result_callback_method: partial_result_callback_method, - language: language, - hints: hints, - barge_in: barge_in, - acknowledge_sound_url: acknowledge_sound_url, - **keyword_args - ) - yield(gather) if block_given? append(gather) end - # Create a <Hangup> element - # - # == Returns: - # A <Response> element with a <Hangup> child element - def hangup - append(Hangup.new) + ## + # Create a new <Hangup> element + # keyword_args:: additional attributes + def hangup(**keyword_args) + append(Hangup.new(**keyword_args)) end - # Create a <Leave> element - # - # == Returns: - # A <Response> element with a <Leave> child element - def leave - append(Leave.new) + ## + # Create a new <Leave> element + # keyword_args:: additional attributes + def leave(**keyword_args) + append(Leave.new(**keyword_args)) end - # Create a <Pause> element - # - # == Parameters: - # length:: time in seconds to pause - # - # == Returns: - # A <Response> element with a <Pause> child element - def pause(length: nil) - append(Pause.new(length: length)) + ## + # Create a new <Pause> element + # length:: Length in seconds to pause + # keyword_args:: additional attributes + def pause(length: nil, **keyword_args) + append(Pause.new(length: length, **keyword_args)) end - # Create a <Play> element - # - # == Parameters: - # url:: url to play - # loop:: times to loop - # digits:: play DTMF tones during a call + ## + # Create a new <Play> element + # url:: Media URL + # loop:: Times to loop media + # digits:: Play DTMF tones for digits # keyword_args:: additional attributes - # - # == Returns: - # A <Response> element with a <Play> child element def play(url: nil, loop: nil, digits: nil, **keyword_args) - append(Play.new( - url: url, - loop: loop, - digits: digits, - **keyword_args - )) + append(Play.new(url: url, loop: loop, digits: digits, **keyword_args)) end - # Create a <Record> element - # - # == Parameters: - # action:: action URL - # method:: action URL method - # timeout:: timeout for recording - # finish_on_key:: finish recording on key - # max_length:: max length to record - # play_beep:: play beep - # trim:: trim the recording - # recording_status_callback:: status callback for the recordings - # recording_status_callback_method:: status callback method - # transcribe:: transcribe the recording - # transcribe_callback:: transcribe callback URL + ## + # Create a new <Queue> element + # name:: Queue name + # url:: Action URL + # method:: Action URL method + # reservation_sid:: TaskRouter Reservation SID + # post_work_activity_sid:: TaskRouter Activity SID # keyword_args:: additional attributes - # - # == Returns: - # A <Response> element with a <Record> child element - def record( - action: nil, - method: nil, - timeout: nil, - finish_on_key: nil, - max_length: nil, - play_beep: nil, - trim: nil, - recording_status_callback: nil, - recording_status_callback_method: nil, - transcribe: nil, - transcribe_callback: nil, - **keyword_args - ) - append(Record.new( - action: action, - method: method, - timeout: timeout, - finish_on_key: finish_on_key, - max_length: max_length, - play_beep: play_beep, - trim: trim, - recording_status_callback: recording_status_callback, - recording_status_callback_method: recording_status_callback_method, - transcribe: transcribe, - transcribe_callback: transcribe_callback, - **keyword_args - )) + def queue(name, url: nil, method: nil, reservation_sid: nil, post_work_activity_sid: nil, **keyword_args) + append(Queue.new(name, url: url, method: method, reservation_sid: reservation_sid, post_work_activity_sid: post_work_activity_sid, **keyword_args)) end - # Create a <Redirect> element - # - # == Parameters: - # url:: redirect URL - # method:: redirect method + ## + # Create a new <Record> element + # action:: Action URL + # method:: Action URL method + # timeout:: Timeout to begin recording + # finish_on_key:: Finish recording on key + # max_length:: Max time to record in seconds + # play_beep:: Play beep + # trim:: Trim the recording + # recording_status_callback:: Status callback URL + # recording_status_callback_method:: Status callback URL method + # transcribe:: Transcribe the recording + # transcribe_callback:: Transcribe callback URL # keyword_args:: additional attributes - # - # == Returns: - # A <Response> element with a <Redirect> child element + def record(action: nil, method: nil, timeout: nil, finish_on_key: nil, max_length: nil, play_beep: nil, trim: nil, recording_status_callback: nil, recording_status_callback_method: nil, transcribe: nil, transcribe_callback: nil, **keyword_args) + append(Record.new(action: action, method: method, timeout: timeout, finish_on_key: finish_on_key, max_length: max_length, play_beep: play_beep, trim: trim, recording_status_callback: recording_status_callback, recording_status_callback_method: recording_status_callback_method, transcribe: transcribe, transcribe_callback: transcribe_callback, **keyword_args)) + end + + ## + # Create a new <Redirect> element + # url:: Redirect URL + # method:: Redirect URL method + # keyword_args:: additional attributes def redirect(url, method: nil, **keyword_args) append(Redirect.new(url, method: method, **keyword_args)) end - # Create a <Reject> element - # - # == Parameters: - # reason:: rejection reason + ## + # Create a new <Reject> element + # reason:: Rejection reason # keyword_args:: additional attributes - # - # == Returns: - # A <Response> element with a <Reject> child element def reject(reason: nil, **keyword_args) append(Reject.new(reason: reason, **keyword_args)) end - # Create a <Say> element - # - # == Parameters: - # body:: message body - # loop:: times to loop - # language:: language of message - # voice:: voice to use + ## + # Create a new <Say> element + # message:: Message to say + # voice:: Voice to use + # loop:: Times to loop message + # language:: Message langauge # keyword_args:: additional attributes - # - # == Returns: - # A <Response> element with a <Say> child element - def say(body, loop: nil, language: nil, voice: nil, **keyword_args) - append(Say.new( - body, - loop: loop, - language: language, - voice: voice, - **keyword_args - )) + def say(message, voice: nil, loop: nil, language: nil, **keyword_args) + append(Say.new(message, voice: voice, loop: loop, language: language, **keyword_args)) end - # Create a <Sms> element - # - # == Parameters: - # body:: body of message - # to:: to phone number - # from_:: from phone number - # method:: action URL method - # action:: action URL - # status_callback:: status callback URL + ## + # Create a new <Sms> element + # message:: Message body + # to:: Number to send message to + # from:: Number to send message from + # action:: Action URL + # method:: Action URL method + # status_callback:: Status callback URL # keyword_args:: additional attributes - # - # == Returns: - # A <Response> element with a <Sms> child element - def sms(body, to: nil, from: nil, method: nil, action: nil, status_callback: nil, **keyword_args) - append(Sms.new( - body, - to: to, - from: from, - method: method, - action: action, - status_callback: status_callback, - **keyword_args - )) + def sms(message, to: nil, from: nil, action: nil, method: nil, status_callback: nil, **keyword_args) + append(Sms.new(message, to: to, from: from, action: action, method: method, status_callback: status_callback, **keyword_args)) end end - # <Dial> element - class Dial < TwiML - # Create a <Dial> element - # - # == Parameters: - # number:: phone number to dial - # keyword_args:: additional attributes - # - # == Returns: - # A <Dial> element - def initialize(number: nil, **keyword_args) + ## + # <Sms> TwiML Noun + class Sms < TwiML + def initialize(message, **keyword_args) super(**keyword_args) - @value = number unless number.nil? + @name = 'Sms' + @value = message yield(self) if block_given? end + end - # Create a <Client> element - # - # == Parameters: - # name:: name of client - # method:: action URL method - # url:: action URL - # status_callback_event:: events to call status callback - # status_callback_method:: status callback URL method - # status_callback:: status callback URL - # keyword_args:: additional attributes - # - # == Returns: - # A <Dial> element with a <Client> child element - def client( - name, - method: nil, - url: nil, - status_callback_event: nil, - status_callback_method: nil, - status_callback: nil, - **keyword_args - ) - append(Client.new( - name, - method: method, - url: url, - status_callback_event: status_callback_event, - status_callback_method: status_callback_method, - status_callback: status_callback, - **keyword_args - )) + ## + # <Say> TwiML Verb + class Say < TwiML + def initialize(message, **keyword_args) + super(**keyword_args) + @name = 'Say' + @value = message + yield(self) if block_given? end + end - # Create a <Conference> element - # - # == Parameters: - # name:: name of conference - # muted:: join the conference muted - # start_conference_on_enter:: start the conference on enter - # end_conference_on_exit:: end the conference on exit - # max_participants:: max number of people in conference - # beep:: play beep when joining - # record:: record the conference - # trim:: trim the recording - # wait_method:: wait URL method - # wait_url:: wait URL to play - # event_callback_url:: event callback URL - # status_callback_event:: events to call status callback - # status_callback:: status callback URL - # status_callback_method:: status callback URL method - # recording_status_callback:: recording status callback URL - # recording_status_callback_method:: recording status callback URL method - # keyword_args:: additional attributes - # - # == Returns: - # A <Dial> element with a <Conference> child element - def conference( - name, - muted: nil, - start_conference_on_enter: nil, - end_conference_on_exit: nil, - max_participants: nil, - beep: nil, - record: nil, - trim: nil, - wait_url: nil, - wait_method: nil, - event_callback_url: nil, - status_callback: nil, - status_callback_event: nil, - status_callback_method: nil, - recording_status_callback: nil, - recording_status_callback_method: nil, - **keyword_args - ) - append(Conference.new( - name, - muted: muted, - start_conference_on_enter: start_conference_on_enter, - end_conference_on_exit: end_conference_on_exit, - max_participants: max_participants, - beep: beep, - record: record, - trim: trim, - wait_url: wait_url, - wait_method: wait_method, - event_callback_url: event_callback_url, - status_callback: status_callback, - status_callback_event: status_callback_event, - status_callback_method: status_callback_method, - recording_status_callback: recording_status_callback, - recording_status_callback_method: recording_status_callback_method, - **keyword_args - )) - end + ## + # <Reject> TwiML Verb + class Reject < TwiML + def initialize(**keyword_args) + super(**keyword_args) + @name = 'Reject' - # Create a <Number> element - # - # == Parameters: - # number:: phone number to dial - # send_digits:: play DTMF tones when the call is answered - # url:: TwiML URL - # method:: TwiML URL method - # status_callback_event:: events to call status callback - # status_callback:: status callback URL - # status_callback_method:: status callback URL method - # keyword_args:: additional attributes - # - # == Returns: - # A <Dial> element with a <Number> child element - def number( - number, - send_digits: nil, - url: nil, - method: nil, - status_callback: nil, - status_callback_event: nil, - status_callback_method: nil, - **keyword_args - ) - append(Number.new( - number, - send_digits: send_digits, - url: url, - method: method, - status_callback: status_callback, - status_callback_event: status_callback_event, - status_callback_method: status_callback_method, - **keyword_args - )) + yield(self) if block_given? end + end - # Create a <Queue> element - # - # == Parameters: - # queue_name:: queue name - # url:: action URL - # method:: action URL method - # reservation_sid:: TaskRouter reservation SID - # post_work_activity_sid:: TaskRouter activity SID - # keyword_args:: additional attributes - # - # == Returns: - # A <Dial> element with a <Queue> child element - def queue( - queue_name, - url: nil, - method: nil, - reservation_sid: nil, - post_work_activity_sid: nil, - **keyword_args - ) - append(Queue.new( - queue_name, - url: url, - method: method, - reservation_sid: reservation_sid, - post_work_activity_sid: post_work_activity_sid, - **keyword_args - )) + ## + # <Redirect> TwiML Verb + class Redirect < TwiML + def initialize(url, **keyword_args) + super(**keyword_args) + @name = 'Redirect' + @value = url + yield(self) if block_given? end + end - # Create a <Sim> element - # - # == Parameters: - # sid:: sim sid - # keyword_args:: additional attributes - # - # == Returns: - # A <Dial> element with a <Sim> child element - def sim(sid, **keyword_args) - append(Sim.new(sid, **keyword_args)) - end + ## + # <Record> TwiML Verb + class Record < TwiML + def initialize(**keyword_args) + super(**keyword_args) + @name = 'Record' - # Create a <Sip> element - # - # == Parameters: - # uri:: sip url - # username:: sip username - # password:: sip password - # url:: action URL - # method:: action URL method - # status_callback_event:: events to call status callback - # status_callback:: status callback URL - # status_callback_method:: status callback URL method - # keyword_args:: additional attributes - # - # == Returns: - # A <Dial> element with a <Sip> child element - def sip( - uri, - username: nil, - password: nil, - url: nil, - method: nil, - status_callback: nil, - status_callback_event: nil, - status_callback_method: nil, - **keyword_args - ) - append(Sip.new( - uri, - username: username, - password: password, - url: url, - method: method, - status_callback: status_callback, - status_callback_event: status_callback_event, - status_callback_method: status_callback_method, - **keyword_args - )) + yield(self) if block_given? end end - # <Client> element - class Client < TwiML - # Create a <Client> element - # - # == Parameters: - # name:: name of client - # keyword_args:: additional attributes - # - # == Returns: - # A <Client> element + ## + # <Queue> TwiML Noun + class Queue < TwiML def initialize(name, **keyword_args) super(**keyword_args) + @name = 'Queue' @value = name + yield(self) if block_given? end end - # <Conference> element - class Conference < TwiML - # Create a <Conference> element - # - # == Parameters: - # name:: name of conference - # keyword_args:: additional attributes - # - # == Returns: - # A <Conference> element - def initialize(name, **keyword_args) + ## + # <Play> TwiML Verb + class Play < TwiML + def initialize(url: nil, **keyword_args) super(**keyword_args) - @value = name + @name = 'Play' + @value = url unless url.nil? + yield(self) if block_given? end end - # <Number> element - class Number < TwiML - # Create a <Number> element - # - # == Parameters: - # number:: phone number - # keyword_args:: additional attributes - # - # == Returns: - # A <Number> element - def initialize(number, **keyword_args) + ## + # <Pause> TwiML Verb + class Pause < TwiML + def initialize(**keyword_args) super(**keyword_args) - @value = number + @name = 'Pause' + + yield(self) if block_given? end end - # <Queue> element - class Queue < TwiML - # Create a <Queue> element - # - # == Parameters: - # queue_name:: name of queues - # keyword_args:: additional attributes - # - # == Returns: - # A <Queue> element - def initialize(queue_name, **keyword_args) + ## + # <Leave> TwiML Verb + class Leave < TwiML + def initialize(**keyword_args) super(**keyword_args) - @value = queue_name + @name = 'Leave' + + yield(self) if block_given? end end - # <Sim> element - class Sim < TwiML - # Create a <Sim> element - # - # == Parameters: - # sid:: sim sid - # keyword_args:: additional attributes - # - # == Returns: - # A <Sim> element - def initialize(sid, **keyword_args) + ## + # <Hangup> TwiML Verb + class Hangup < TwiML + def initialize(**keyword_args) super(**keyword_args) - @value = sid + @name = 'Hangup' + + yield(self) if block_given? end end - # <Sip> element - class Sip < TwiML - # Create a <Sip> element - # - # == Parameters: - # uri:: sip uri - # keyword_args:: additional attributes - # - # == Returns: - # A <Sip> element - def initialize(uri, **keyword_args) + ## + # <Gather> TwiML Verb + class Gather < TwiML + def initialize(**keyword_args) super(**keyword_args) - @value = uri + @name = 'Gather' + + yield(self) if block_given? end - end - # <Echo> element - class Echo < TwiML - # Create a <Echo> element - # - # == Parameters: + ## + # Create a new <Say> element + # message:: Message to say + # voice:: Voice to use + # loop:: Times to loop message + # language:: Message langauge # keyword_args:: additional attributes - # - # == Returns: - # A <Echo> element - def initialize(**keyword_args) - super(**keyword_args) + def say(message, voice: nil, loop: nil, language: nil, **keyword_args) + append(Say.new(message, voice: voice, loop: loop, language: language, **keyword_args)) end + + ## + # Create a new <Pause> element + # length:: Length in seconds to pause + # keyword_args:: additional attributes + def pause(length: nil, **keyword_args) + append(Pause.new(length: length, **keyword_args)) + end + + ## + # Create a new <Play> element + # url:: Media URL + # loop:: Times to loop media + # digits:: Play DTMF tones for digits + # keyword_args:: additional attributes + def play(url: nil, loop: nil, digits: nil, **keyword_args) + append(Play.new(url: url, loop: loop, digits: digits, **keyword_args)) + end end - # <Enqueue> element + ## + # <Enqueue> TwiML Noun class Enqueue < TwiML - # Create a <Enqueue> element - # - # == Parameters: - # name:: queue name - # keyword_args:: additional attributes - # - # == Returns: - # A <Enqueue> element - def initialize(name, **keyword_args) + def initialize(name: nil, **keyword_args) super(**keyword_args) - @value = name + @name = 'Enqueue' + @value = name unless name.nil? yield(self) if block_given? end - # Create a <Task> element - # - # == Parameters: - # attributes:: attributes for a task + ## + # Create a new <Task> element + # body:: TaskRouter task attributes # keyword_args:: additional attributes - # - # == Returns: - # An <Enqueue> element with a <Task> child element - def task(attributes, **keyword_args) - append(Task.new(attributes, **keyword_args)) + def task(body, **keyword_args) + append(Task.new(body, **keyword_args)) end end - # <Task> element + ## + # <Task> TwiML Noun class Task < TwiML - # Create a <Task> element - # - # == Parameters: - # attributes:: attributes for a task - # keyword_args:: additional attributes - # - # == Returns: - # A <Task> element - def initialize(attributes, **keyword_args) + def initialize(body, **keyword_args) super(**keyword_args) - @value = attributes.is_a?(String) ? attributes : JSON.generate(attributes) + @name = 'Task' + @value = body + yield(self) if block_given? end end - # <Gather> element - class Gather < TwiML - # Create a <Gather> element - # - # == Parameters: - # keyword_args:: additional attributes - # - # == Returns: - # A <Gather> element + ## + # <Echo> TwiML Verb + class Echo < TwiML def initialize(**keyword_args) super(**keyword_args) + @name = 'Echo' + yield(self) if block_given? end + end - # Create a <Say> element - # - # == Parameters: - # name:: name of client - # body:: message body - # loop:: times to loop - # language:: message language - # voice:: voice to use - # keyword_args:: additional attributes - # - # == Returns: - # A <Gather> element with a <Say> child element - def say(body, loop: nil, language: nil, voice: nil, **keyword_args) - append(Say.new( - body, - loop: loop, - language: language, - voice: voice, - **keyword_args - )) + ## + # <Dial> TwiML Verb + class Dial < TwiML + def initialize(number: nil, **keyword_args) + super(**keyword_args) + @name = 'Dial' + @value = number unless number.nil? + yield(self) if block_given? end - # Create a <Play> element - # - # == Parameters: - # url:: media URL - # loop:: times to loop - # digits:: digits to simulate + ## + # Create a new <Client> element + # name:: Client name + # url:: Client URL + # method:: Client URL Method + # status_callback_event:: Events to trigger status callback + # status_callback:: Status Callback URL + # status_callback_method:: Status Callback URL Method # keyword_args:: additional attributes - # - # == Returns: - # A <Gather> element with a <Play> child element - def play(url: nil, loop: nil, digits: nil, **keyword_args) - append(Play.new( - url: url, - loop: loop, - digits: digits, - **keyword_args - )) + def client(name, url: nil, method: nil, status_callback_event: nil, status_callback: nil, status_callback_method: nil, **keyword_args) + append(Client.new(name, url: url, method: method, status_callback_event: status_callback_event, status_callback: status_callback, status_callback_method: status_callback_method, **keyword_args)) end - # Create a <Pause> element - # - # == Parameters: - # length:: time to pause - # - # == Returns: - # A <Gather> element with a <Pause> child element - def pause(length: nil) - append(Pause.new(length: length)) + ## + # Create a new <Conference> element + # name:: Conference name + # muted:: Join the conference muted + # beep:: Play beep when joining + # start_conference_on_enter:: Start the conference on enter + # end_conference_on_exit:: End the conferenceon exit + # wait_url:: Wait URL + # wait_method:: Wait URL method + # max_participants:: Maximum number of participants + # record:: Record the conference + # region:: Conference region + # whisper:: Call whisper + # trim:: Trim the conference recording + # status_callback_event:: Events to call status callback URL + # status_callback:: Status callback URL + # status_callback_method:: Status callback URL method + # recording_status_callback:: Recording status callback URL + # recording_status_callback_method:: Recording status callback URL method + # event_callback_url:: Event callback URL + # keyword_args:: additional attributes + def conference(name, muted: nil, beep: nil, start_conference_on_enter: nil, end_conference_on_exit: nil, wait_url: nil, wait_method: nil, max_participants: nil, record: nil, region: nil, whisper: nil, trim: nil, status_callback_event: nil, status_callback: nil, status_callback_method: nil, recording_status_callback: nil, recording_status_callback_method: nil, event_callback_url: nil, **keyword_args) + append(Conference.new(name, muted: muted, beep: beep, start_conference_on_enter: start_conference_on_enter, end_conference_on_exit: end_conference_on_exit, wait_url: wait_url, wait_method: wait_method, max_participants: max_participants, record: record, region: region, whisper: whisper, trim: trim, status_callback_event: status_callback_event, status_callback: status_callback, status_callback_method: status_callback_method, recording_status_callback: recording_status_callback, recording_status_callback_method: recording_status_callback_method, event_callback_url: event_callback_url, **keyword_args)) end - end - # <Pause> element - class Pause < TwiML - # Create a <Pause> element - # - # == Parameters: + ## + # Create a new <Number> element + # number:: Phone Number to dial + # send_digits:: DTMF tones to play when the call is answered + # url:: TwiML URL + # method:: TwiML URL method + # status_callback_event:: Events to call status callback + # status_callback:: Status callback URL + # status_callback_method:: Status callback URL method # keyword_args:: additional attributes - # - # == Returns: - # A <Pause> element - def initialize(**keyword_args) - super(**keyword_args) + def number(number, send_digits: nil, url: nil, method: nil, status_callback_event: nil, status_callback: nil, status_callback_method: nil, **keyword_args) + append(Number.new(number, send_digits: send_digits, url: url, method: method, status_callback_event: status_callback_event, status_callback: status_callback, status_callback_method: status_callback_method, **keyword_args)) end - end - # <Play> element - class Play < TwiML - # Create a <Play> element - # - # == Parameters: - # url:: media URL + ## + # Create a new <Queue> element + # name:: Queue name + # url:: Action URL + # method:: Action URL method + # reservation_sid:: TaskRouter Reservation SID + # post_work_activity_sid:: TaskRouter Activity SID # keyword_args:: additional attributes - # - # == Returns: - # A <Play> element - def initialize(url: nil, **keyword_args) - super(**keyword_args) - @value = url + def queue(name, url: nil, method: nil, reservation_sid: nil, post_work_activity_sid: nil, **keyword_args) + append(Queue.new(name, url: url, method: method, reservation_sid: reservation_sid, post_work_activity_sid: post_work_activity_sid, **keyword_args)) end - end - # <Say> element - class Say < TwiML - # Create a <Say> element - # - # == Parameters: - # body:: message body + ## + # Create a new <Sim> element + # sim_sid:: SIM SID # keyword_args:: additional attributes - # - # == Returns: - # A <Say> element - def initialize(body, **keyword_args) - super(**keyword_args) - @value = body + def sim(sim_sid, **keyword_args) + append(Sim.new(sim_sid, **keyword_args)) end - end - # <Hangup> element - class Hangup < TwiML - # Create a <hangup_on_star> element - # - # == Parameters: + ## + # Create a new <Sip> element + # sip_url:: SIP URL + # username:: SIP Username + # password:: SIP Password + # url:: Action URL + # method:: Action URL method + # status_callback_event:: Status callback events + # status_callback:: Status callback URL + # status_callback_method:: Status callback URL method # keyword_args:: additional attributes - # - # == Returns: - # A <hangup_on_star> element - def initialize(**keyword_args) - super(**keyword_args) + def sip(sip_url, username: nil, password: nil, url: nil, method: nil, status_callback_event: nil, status_callback: nil, status_callback_method: nil, **keyword_args) + append(Sip.new(sip_url, username: username, password: password, url: url, method: method, status_callback_event: status_callback_event, status_callback: status_callback, status_callback_method: status_callback_method, **keyword_args)) end end - # <Leave> element - class Leave < TwiML - # Create a <Leave> element - # - # == Parameters: - # keyword_args:: additional attributes - # - # == Returns: - # A <Leave> element - def initialize(**keyword_args) + ## + # <Sip> TwiML Noun + class Sip < TwiML + def initialize(sip_url, **keyword_args) super(**keyword_args) + @name = 'Sip' + @value = sip_url + yield(self) if block_given? end end - # <Record> element - class Record < TwiML - # Create a <Record> element - # - # == Parameters: - # keyword_args:: additional attributes - # - # == Returns: - # A <Record> element - def initialize(**keyword_args) + ## + # <Sim> TwiML Noun + class Sim < TwiML + def initialize(sim_sid, **keyword_args) super(**keyword_args) + @name = 'Sim' + @value = sim_sid + yield(self) if block_given? end end - # <Redirect> element - class Redirect < TwiML - # Create a <Redirect> element - # - # == Parameters: - # url:: TwiML URL - # keyword_args:: additional attributes - # - # == Returns: - # A <Redirect> element - def initialize(url, **keyword_args) + ## + # <Number> TwiML Noun + class Number < TwiML + def initialize(number, **keyword_args) super(**keyword_args) - @value = url + @name = 'Number' + @value = number + yield(self) if block_given? end end - # <Reject> element - class Reject < TwiML - # Create a <Reject> element - # - # == Parameters: - # keyword_args:: additional attributes - # - # == Returns: - # A <Reject> element - def initialize(**keyword_args) + ## + # <Conference> TwiML Noun + class Conference < TwiML + def initialize(name, **keyword_args) super(**keyword_args) + @name = 'Conference' + @value = name + yield(self) if block_given? end end - # <Sms> element - class Sms < TwiML - # Create a <Sms> element - # - # == Parameters: - # body:: message body - # keyword_args:: additional attributes - # - # == Returns: - # A <Sms> element - def initialize(body, **keyword_args) + ## + # <Client> TwiML Noun + class Client < TwiML + def initialize(name, **keyword_args) super(**keyword_args) - @value = body + @name = 'Client' + @value = name + yield(self) if block_given? end end end -end +end \ No newline at end of file