File tree Expand file tree Collapse file tree 3 files changed +68
-0
lines changed
bandwidth/model/bxml/verbs Expand file tree Collapse file tree 3 files changed +68
-0
lines changed Original file line number Diff line number Diff line change 66from .phone_number import PhoneNumber
77from .play_audio import PlayAudio
88from .record import Record
9+ from .ring import Ring
910from .send_dtmf import SendDtmf
1011from .sip_uri import SipUri
1112from .speak_sentence import SpeakSentence
Original file line number Diff line number Diff line change 1+ """
2+ ring.py
3+
4+ Bandwidth's Ring BXML verb
5+
6+ @copyright Bandwidth INC
7+ """
8+ from ..terminal_verb import TerminalVerb
9+
10+
11+ class Ring (TerminalVerb ):
12+
13+ def __init__ (
14+ self , duration : str = None ,
15+ answer_call : str = None ,
16+ ):
17+ """Initialize a <Ring> verb
18+
19+ Args:
20+ duration (str, optional): How many seconds to play ringing on the call. Default value is 5. Range: decimal values between 0.1 - 86400.
21+ answer_call (str, optional): A boolean indicating whether or not to answer the call when Ring is executed on an unanswered incoming call. Default value is 'true'.
22+ """
23+ self .duration = duration
24+ self .answer_call = answer_call
25+ super ().__init__ (tag = "Ring" )
26+
27+ @property
28+ def _attributes (self ):
29+ return {
30+ "duration" : self .duration ,
31+ "answerCall" : self .answer_call ,
32+ }
Original file line number Diff line number Diff line change 1+ """
2+ test_ring.py
3+
4+ Unit tests for the <Ring> BXML verb
5+
6+ @copyright Bandwidth Inc.
7+ """
8+ import os
9+ import pytest
10+ import unittest
11+
12+ from bandwidth .model .bxml .verb import Verb
13+ from bandwidth .model .bxml .verbs .ring import Ring
14+
15+
16+ class TestRing (unittest .TestCase ):
17+
18+ def setUp (self ):
19+ self .ring = Ring (
20+ duration = "30" ,
21+ answer_call = "true" ,
22+ )
23+ self .test_verb = Verb (tag = "test" )
24+
25+ def test_to_bxml (self ):
26+ if os .environ ['PYTHON_VERSION' ] == '3.7' :
27+ expected = '<Ring answerCall="true" duration="30" />'
28+ else :
29+ expected = '<Ring duration="30" answerCall="true" />'
30+
31+ assert (expected == self .ring .to_bxml ())
32+
33+ def test_add_verb (self ):
34+ with pytest .raises (AttributeError ):
35+ self .ring .add_verb (self .test_verb )
You can’t perform that action at this time.
0 commit comments