twilio-ruby 5.61.0 → 5.61.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -543,8 +543,11 @@ module Twilio
543
543
  # words:: Words to emphasize
544
544
  # level:: Specify the degree of emphasis
545
545
  # keyword_args:: additional attributes
546
- def emphasis(words, level: nil, **keyword_args)
547
- append(SsmlEmphasis.new(words, level: level, **keyword_args))
546
+ def emphasis(words: nil, level: nil, **keyword_args)
547
+ emphasis = SsmlEmphasis.new(words: words, level: level, **keyword_args)
548
+
549
+ yield(emphasis) if block_given?
550
+ append(emphasis)
548
551
  end
549
552
 
550
553
  ##
@@ -552,16 +555,22 @@ module Twilio
552
555
  # words:: Words to speak
553
556
  # xmlLang:: Specify the language
554
557
  # keyword_args:: additional attributes
555
- def lang(words, xmlLang: nil, **keyword_args)
556
- append(SsmlLang.new(words, xmlLang: xmlLang, **keyword_args))
558
+ def lang(words: nil, xmlLang: nil, **keyword_args)
559
+ lang = SsmlLang.new(words: words, xmlLang: xmlLang, **keyword_args)
560
+
561
+ yield(lang) if block_given?
562
+ append(lang)
557
563
  end
558
564
 
559
565
  ##
560
566
  # Create a new <P> element
561
567
  # words:: Words to speak
562
568
  # keyword_args:: additional attributes
563
- def p(words, **keyword_args)
564
- append(SsmlP.new(words, **keyword_args))
569
+ def p(words: nil, **keyword_args)
570
+ p = SsmlP.new(words: words, **keyword_args)
571
+
572
+ yield(p) if block_given?
573
+ append(p)
565
574
  end
566
575
 
567
576
  ##
@@ -581,16 +590,22 @@ module Twilio
581
590
  # rate:: Specify the rate, available values: x-slow, slow, medium, fast, x-fast, n%
582
591
  # pitch:: Specify the pitch, available values: default, x-low, low, medium, high, x-high, +n%, -n%
583
592
  # keyword_args:: additional attributes
584
- def prosody(words, volume: nil, rate: nil, pitch: nil, **keyword_args)
585
- append(SsmlProsody.new(words, volume: volume, rate: rate, pitch: pitch, **keyword_args))
593
+ def prosody(words: nil, volume: nil, rate: nil, pitch: nil, **keyword_args)
594
+ prosody = SsmlProsody.new(words: words, volume: volume, rate: rate, pitch: pitch, **keyword_args)
595
+
596
+ yield(prosody) if block_given?
597
+ append(prosody)
586
598
  end
587
599
 
588
600
  ##
589
601
  # Create a new <S> element
590
602
  # words:: Words to speak
591
603
  # keyword_args:: additional attributes
592
- def s(words, **keyword_args)
593
- append(SsmlS.new(words, **keyword_args))
604
+ def s(words: nil, **keyword_args)
605
+ s = SsmlS.new(words: words, **keyword_args)
606
+
607
+ yield(s) if block_given?
608
+ append(s)
594
609
  end
595
610
 
596
611
  ##
@@ -617,20 +632,87 @@ module Twilio
617
632
  # words:: Words to speak
618
633
  # role:: Customize the pronunciation of words by specifying the word’s part of speech or alternate meaning
619
634
  # keyword_args:: additional attributes
620
- def w(words, role: nil, **keyword_args)
621
- append(SsmlW.new(words, role: role, **keyword_args))
635
+ def w(words: nil, role: nil, **keyword_args)
636
+ w = SsmlW.new(words: words, role: role, **keyword_args)
637
+
638
+ yield(w) if block_given?
639
+ append(w)
622
640
  end
623
641
  end
624
642
 
625
643
  ##
626
644
  # Improving Pronunciation by Specifying Parts of Speech in <Say>
627
645
  class SsmlW < TwiML
628
- def initialize(words, **keyword_args)
646
+ def initialize(words: nil, **keyword_args)
629
647
  super(**keyword_args)
630
648
  @name = 'w'
631
- @value = words
649
+ @value = words unless words.nil?
632
650
  yield(self) if block_given?
633
651
  end
652
+
653
+ ##
654
+ # Create a new <Break> element
655
+ # strength:: Set a pause based on strength
656
+ # time:: Set a pause to a specific length of time in seconds or milliseconds, available values: [number]s, [number]ms
657
+ # keyword_args:: additional attributes
658
+ def break(strength: nil, time: nil, **keyword_args)
659
+ append(SsmlBreak.new(strength: strength, time: time, **keyword_args))
660
+ end
661
+
662
+ ##
663
+ # Create a new <Emphasis> element
664
+ # words:: Words to emphasize
665
+ # level:: Specify the degree of emphasis
666
+ # keyword_args:: additional attributes
667
+ def emphasis(words: nil, level: nil, **keyword_args)
668
+ emphasis = SsmlEmphasis.new(words: words, level: level, **keyword_args)
669
+
670
+ yield(emphasis) if block_given?
671
+ append(emphasis)
672
+ end
673
+
674
+ ##
675
+ # Create a new <Phoneme> element
676
+ # words:: Words to speak
677
+ # alphabet:: Specify the phonetic alphabet
678
+ # ph:: Specifiy the phonetic symbols for pronunciation
679
+ # keyword_args:: additional attributes
680
+ def phoneme(words, alphabet: nil, ph: nil, **keyword_args)
681
+ append(SsmlPhoneme.new(words, alphabet: alphabet, ph: ph, **keyword_args))
682
+ end
683
+
684
+ ##
685
+ # Create a new <Prosody> element
686
+ # words:: Words to speak
687
+ # volume:: Specify the volume, available values: default, silent, x-soft, soft, medium, loud, x-loud, +ndB, -ndB
688
+ # rate:: Specify the rate, available values: x-slow, slow, medium, fast, x-fast, n%
689
+ # pitch:: Specify the pitch, available values: default, x-low, low, medium, high, x-high, +n%, -n%
690
+ # keyword_args:: additional attributes
691
+ def prosody(words: nil, volume: nil, rate: nil, pitch: nil, **keyword_args)
692
+ prosody = SsmlProsody.new(words: words, volume: volume, rate: rate, pitch: pitch, **keyword_args)
693
+
694
+ yield(prosody) if block_given?
695
+ append(prosody)
696
+ end
697
+
698
+ ##
699
+ # Create a new <Say-As> element
700
+ # words:: Words to be interpreted
701
+ # interpretAs:: Specify the type of words are spoken
702
+ # role:: Specify the format of the date when interpret-as is set to date
703
+ # keyword_args:: additional attributes
704
+ def say_as(words, interpretAs: nil, role: nil, **keyword_args)
705
+ append(SsmlSayAs.new(words, interpretAs: interpretAs, role: role, **keyword_args))
706
+ end
707
+
708
+ ##
709
+ # Create a new <Sub> element
710
+ # words:: Words to be substituted
711
+ # aliasAttribute:: Substitute a different word (or pronunciation) for selected text such as an acronym or abbreviation
712
+ # keyword_args:: additional attributes
713
+ def sub(words, aliasAttribute: nil, **keyword_args)
714
+ append(SsmlSub.new(words, aliasAttribute: aliasAttribute, **keyword_args))
715
+ end
634
716
  end
635
717
 
636
718
  ##
@@ -656,25 +738,223 @@ module Twilio
656
738
  end
657
739
 
658
740
  ##
659
- # Adding A Pause Between Sentences in <Say>
660
- class SsmlS < TwiML
661
- def initialize(words, **keyword_args)
741
+ # Controling Volume, Speaking Rate, and Pitch in <Say>
742
+ class SsmlProsody < TwiML
743
+ def initialize(words: nil, **keyword_args)
662
744
  super(**keyword_args)
663
- @name = 's'
664
- @value = words
745
+ @name = 'prosody'
746
+ @value = words unless words.nil?
665
747
  yield(self) if block_given?
666
748
  end
749
+
750
+ ##
751
+ # Create a new <Break> element
752
+ # strength:: Set a pause based on strength
753
+ # time:: Set a pause to a specific length of time in seconds or milliseconds, available values: [number]s, [number]ms
754
+ # keyword_args:: additional attributes
755
+ def break(strength: nil, time: nil, **keyword_args)
756
+ append(SsmlBreak.new(strength: strength, time: time, **keyword_args))
757
+ end
758
+
759
+ ##
760
+ # Create a new <Emphasis> element
761
+ # words:: Words to emphasize
762
+ # level:: Specify the degree of emphasis
763
+ # keyword_args:: additional attributes
764
+ def emphasis(words: nil, level: nil, **keyword_args)
765
+ emphasis = SsmlEmphasis.new(words: words, level: level, **keyword_args)
766
+
767
+ yield(emphasis) if block_given?
768
+ append(emphasis)
769
+ end
770
+
771
+ ##
772
+ # Create a new <Lang> element
773
+ # words:: Words to speak
774
+ # xmlLang:: Specify the language
775
+ # keyword_args:: additional attributes
776
+ def lang(words: nil, xmlLang: nil, **keyword_args)
777
+ lang = SsmlLang.new(words: words, xmlLang: xmlLang, **keyword_args)
778
+
779
+ yield(lang) if block_given?
780
+ append(lang)
781
+ end
782
+
783
+ ##
784
+ # Create a new <P> element
785
+ # words:: Words to speak
786
+ # keyword_args:: additional attributes
787
+ def p(words: nil, **keyword_args)
788
+ p = SsmlP.new(words: words, **keyword_args)
789
+
790
+ yield(p) if block_given?
791
+ append(p)
792
+ end
793
+
794
+ ##
795
+ # Create a new <Phoneme> element
796
+ # words:: Words to speak
797
+ # alphabet:: Specify the phonetic alphabet
798
+ # ph:: Specifiy the phonetic symbols for pronunciation
799
+ # keyword_args:: additional attributes
800
+ def phoneme(words, alphabet: nil, ph: nil, **keyword_args)
801
+ append(SsmlPhoneme.new(words, alphabet: alphabet, ph: ph, **keyword_args))
802
+ end
803
+
804
+ ##
805
+ # Create a new <Prosody> element
806
+ # words:: Words to speak
807
+ # volume:: Specify the volume, available values: default, silent, x-soft, soft, medium, loud, x-loud, +ndB, -ndB
808
+ # rate:: Specify the rate, available values: x-slow, slow, medium, fast, x-fast, n%
809
+ # pitch:: Specify the pitch, available values: default, x-low, low, medium, high, x-high, +n%, -n%
810
+ # keyword_args:: additional attributes
811
+ def prosody(words: nil, volume: nil, rate: nil, pitch: nil, **keyword_args)
812
+ prosody = SsmlProsody.new(words: words, volume: volume, rate: rate, pitch: pitch, **keyword_args)
813
+
814
+ yield(prosody) if block_given?
815
+ append(prosody)
816
+ end
817
+
818
+ ##
819
+ # Create a new <S> element
820
+ # words:: Words to speak
821
+ # keyword_args:: additional attributes
822
+ def s(words: nil, **keyword_args)
823
+ s = SsmlS.new(words: words, **keyword_args)
824
+
825
+ yield(s) if block_given?
826
+ append(s)
827
+ end
828
+
829
+ ##
830
+ # Create a new <Say-As> element
831
+ # words:: Words to be interpreted
832
+ # interpretAs:: Specify the type of words are spoken
833
+ # role:: Specify the format of the date when interpret-as is set to date
834
+ # keyword_args:: additional attributes
835
+ def say_as(words, interpretAs: nil, role: nil, **keyword_args)
836
+ append(SsmlSayAs.new(words, interpretAs: interpretAs, role: role, **keyword_args))
837
+ end
838
+
839
+ ##
840
+ # Create a new <Sub> element
841
+ # words:: Words to be substituted
842
+ # aliasAttribute:: Substitute a different word (or pronunciation) for selected text such as an acronym or abbreviation
843
+ # keyword_args:: additional attributes
844
+ def sub(words, aliasAttribute: nil, **keyword_args)
845
+ append(SsmlSub.new(words, aliasAttribute: aliasAttribute, **keyword_args))
846
+ end
847
+
848
+ ##
849
+ # Create a new <W> element
850
+ # words:: Words to speak
851
+ # role:: Customize the pronunciation of words by specifying the word’s part of speech or alternate meaning
852
+ # keyword_args:: additional attributes
853
+ def w(words: nil, role: nil, **keyword_args)
854
+ w = SsmlW.new(words: words, role: role, **keyword_args)
855
+
856
+ yield(w) if block_given?
857
+ append(w)
858
+ end
667
859
  end
668
860
 
669
861
  ##
670
- # Controling Volume, Speaking Rate, and Pitch in <Say>
671
- class SsmlProsody < TwiML
672
- def initialize(words, **keyword_args)
862
+ # Adding A Pause Between Sentences in <Say>
863
+ class SsmlS < TwiML
864
+ def initialize(words: nil, **keyword_args)
673
865
  super(**keyword_args)
674
- @name = 'prosody'
675
- @value = words
866
+ @name = 's'
867
+ @value = words unless words.nil?
676
868
  yield(self) if block_given?
677
869
  end
870
+
871
+ ##
872
+ # Create a new <Break> element
873
+ # strength:: Set a pause based on strength
874
+ # time:: Set a pause to a specific length of time in seconds or milliseconds, available values: [number]s, [number]ms
875
+ # keyword_args:: additional attributes
876
+ def break(strength: nil, time: nil, **keyword_args)
877
+ append(SsmlBreak.new(strength: strength, time: time, **keyword_args))
878
+ end
879
+
880
+ ##
881
+ # Create a new <Emphasis> element
882
+ # words:: Words to emphasize
883
+ # level:: Specify the degree of emphasis
884
+ # keyword_args:: additional attributes
885
+ def emphasis(words: nil, level: nil, **keyword_args)
886
+ emphasis = SsmlEmphasis.new(words: words, level: level, **keyword_args)
887
+
888
+ yield(emphasis) if block_given?
889
+ append(emphasis)
890
+ end
891
+
892
+ ##
893
+ # Create a new <Lang> element
894
+ # words:: Words to speak
895
+ # xmlLang:: Specify the language
896
+ # keyword_args:: additional attributes
897
+ def lang(words: nil, xmlLang: nil, **keyword_args)
898
+ lang = SsmlLang.new(words: words, xmlLang: xmlLang, **keyword_args)
899
+
900
+ yield(lang) if block_given?
901
+ append(lang)
902
+ end
903
+
904
+ ##
905
+ # Create a new <Phoneme> element
906
+ # words:: Words to speak
907
+ # alphabet:: Specify the phonetic alphabet
908
+ # ph:: Specifiy the phonetic symbols for pronunciation
909
+ # keyword_args:: additional attributes
910
+ def phoneme(words, alphabet: nil, ph: nil, **keyword_args)
911
+ append(SsmlPhoneme.new(words, alphabet: alphabet, ph: ph, **keyword_args))
912
+ end
913
+
914
+ ##
915
+ # Create a new <Prosody> element
916
+ # words:: Words to speak
917
+ # volume:: Specify the volume, available values: default, silent, x-soft, soft, medium, loud, x-loud, +ndB, -ndB
918
+ # rate:: Specify the rate, available values: x-slow, slow, medium, fast, x-fast, n%
919
+ # pitch:: Specify the pitch, available values: default, x-low, low, medium, high, x-high, +n%, -n%
920
+ # keyword_args:: additional attributes
921
+ def prosody(words: nil, volume: nil, rate: nil, pitch: nil, **keyword_args)
922
+ prosody = SsmlProsody.new(words: words, volume: volume, rate: rate, pitch: pitch, **keyword_args)
923
+
924
+ yield(prosody) if block_given?
925
+ append(prosody)
926
+ end
927
+
928
+ ##
929
+ # Create a new <Say-As> element
930
+ # words:: Words to be interpreted
931
+ # interpretAs:: Specify the type of words are spoken
932
+ # role:: Specify the format of the date when interpret-as is set to date
933
+ # keyword_args:: additional attributes
934
+ def say_as(words, interpretAs: nil, role: nil, **keyword_args)
935
+ append(SsmlSayAs.new(words, interpretAs: interpretAs, role: role, **keyword_args))
936
+ end
937
+
938
+ ##
939
+ # Create a new <Sub> element
940
+ # words:: Words to be substituted
941
+ # aliasAttribute:: Substitute a different word (or pronunciation) for selected text such as an acronym or abbreviation
942
+ # keyword_args:: additional attributes
943
+ def sub(words, aliasAttribute: nil, **keyword_args)
944
+ append(SsmlSub.new(words, aliasAttribute: aliasAttribute, **keyword_args))
945
+ end
946
+
947
+ ##
948
+ # Create a new <W> element
949
+ # words:: Words to speak
950
+ # role:: Customize the pronunciation of words by specifying the word’s part of speech or alternate meaning
951
+ # keyword_args:: additional attributes
952
+ def w(words: nil, role: nil, **keyword_args)
953
+ w = SsmlW.new(words: words, role: role, **keyword_args)
954
+
955
+ yield(w) if block_given?
956
+ append(w)
957
+ end
678
958
  end
679
959
 
680
960
  ##
@@ -689,36 +969,333 @@ module Twilio
689
969
  end
690
970
 
691
971
  ##
692
- # Adding a Pause Between Paragraphs in <Say>
693
- class SsmlP < TwiML
694
- def initialize(words, **keyword_args)
972
+ # Specifying Another Language for Specific Words in <Say>
973
+ class SsmlLang < TwiML
974
+ def initialize(words: nil, **keyword_args)
695
975
  super(**keyword_args)
696
- @name = 'p'
697
- @value = words
976
+ @name = 'lang'
977
+ @value = words unless words.nil?
698
978
  yield(self) if block_given?
699
979
  end
980
+
981
+ ##
982
+ # Create a new <Break> element
983
+ # strength:: Set a pause based on strength
984
+ # time:: Set a pause to a specific length of time in seconds or milliseconds, available values: [number]s, [number]ms
985
+ # keyword_args:: additional attributes
986
+ def break(strength: nil, time: nil, **keyword_args)
987
+ append(SsmlBreak.new(strength: strength, time: time, **keyword_args))
988
+ end
989
+
990
+ ##
991
+ # Create a new <Emphasis> element
992
+ # words:: Words to emphasize
993
+ # level:: Specify the degree of emphasis
994
+ # keyword_args:: additional attributes
995
+ def emphasis(words: nil, level: nil, **keyword_args)
996
+ emphasis = SsmlEmphasis.new(words: words, level: level, **keyword_args)
997
+
998
+ yield(emphasis) if block_given?
999
+ append(emphasis)
1000
+ end
1001
+
1002
+ ##
1003
+ # Create a new <Lang> element
1004
+ # words:: Words to speak
1005
+ # xmlLang:: Specify the language
1006
+ # keyword_args:: additional attributes
1007
+ def lang(words: nil, xmlLang: nil, **keyword_args)
1008
+ lang = SsmlLang.new(words: words, xmlLang: xmlLang, **keyword_args)
1009
+
1010
+ yield(lang) if block_given?
1011
+ append(lang)
1012
+ end
1013
+
1014
+ ##
1015
+ # Create a new <P> element
1016
+ # words:: Words to speak
1017
+ # keyword_args:: additional attributes
1018
+ def p(words: nil, **keyword_args)
1019
+ p = SsmlP.new(words: words, **keyword_args)
1020
+
1021
+ yield(p) if block_given?
1022
+ append(p)
1023
+ end
1024
+
1025
+ ##
1026
+ # Create a new <Phoneme> element
1027
+ # words:: Words to speak
1028
+ # alphabet:: Specify the phonetic alphabet
1029
+ # ph:: Specifiy the phonetic symbols for pronunciation
1030
+ # keyword_args:: additional attributes
1031
+ def phoneme(words, alphabet: nil, ph: nil, **keyword_args)
1032
+ append(SsmlPhoneme.new(words, alphabet: alphabet, ph: ph, **keyword_args))
1033
+ end
1034
+
1035
+ ##
1036
+ # Create a new <Prosody> element
1037
+ # words:: Words to speak
1038
+ # volume:: Specify the volume, available values: default, silent, x-soft, soft, medium, loud, x-loud, +ndB, -ndB
1039
+ # rate:: Specify the rate, available values: x-slow, slow, medium, fast, x-fast, n%
1040
+ # pitch:: Specify the pitch, available values: default, x-low, low, medium, high, x-high, +n%, -n%
1041
+ # keyword_args:: additional attributes
1042
+ def prosody(words: nil, volume: nil, rate: nil, pitch: nil, **keyword_args)
1043
+ prosody = SsmlProsody.new(words: words, volume: volume, rate: rate, pitch: pitch, **keyword_args)
1044
+
1045
+ yield(prosody) if block_given?
1046
+ append(prosody)
1047
+ end
1048
+
1049
+ ##
1050
+ # Create a new <S> element
1051
+ # words:: Words to speak
1052
+ # keyword_args:: additional attributes
1053
+ def s(words: nil, **keyword_args)
1054
+ s = SsmlS.new(words: words, **keyword_args)
1055
+
1056
+ yield(s) if block_given?
1057
+ append(s)
1058
+ end
1059
+
1060
+ ##
1061
+ # Create a new <Say-As> element
1062
+ # words:: Words to be interpreted
1063
+ # interpretAs:: Specify the type of words are spoken
1064
+ # role:: Specify the format of the date when interpret-as is set to date
1065
+ # keyword_args:: additional attributes
1066
+ def say_as(words, interpretAs: nil, role: nil, **keyword_args)
1067
+ append(SsmlSayAs.new(words, interpretAs: interpretAs, role: role, **keyword_args))
1068
+ end
1069
+
1070
+ ##
1071
+ # Create a new <Sub> element
1072
+ # words:: Words to be substituted
1073
+ # aliasAttribute:: Substitute a different word (or pronunciation) for selected text such as an acronym or abbreviation
1074
+ # keyword_args:: additional attributes
1075
+ def sub(words, aliasAttribute: nil, **keyword_args)
1076
+ append(SsmlSub.new(words, aliasAttribute: aliasAttribute, **keyword_args))
1077
+ end
1078
+
1079
+ ##
1080
+ # Create a new <W> element
1081
+ # words:: Words to speak
1082
+ # role:: Customize the pronunciation of words by specifying the word’s part of speech or alternate meaning
1083
+ # keyword_args:: additional attributes
1084
+ def w(words: nil, role: nil, **keyword_args)
1085
+ w = SsmlW.new(words: words, role: role, **keyword_args)
1086
+
1087
+ yield(w) if block_given?
1088
+ append(w)
1089
+ end
700
1090
  end
701
1091
 
702
1092
  ##
703
- # Specifying Another Language for Specific Words in <Say>
704
- class SsmlLang < TwiML
705
- def initialize(words, **keyword_args)
1093
+ # Adding a Pause Between Paragraphs in <Say>
1094
+ class SsmlP < TwiML
1095
+ def initialize(words: nil, **keyword_args)
706
1096
  super(**keyword_args)
707
- @name = 'lang'
708
- @value = words
1097
+ @name = 'p'
1098
+ @value = words unless words.nil?
709
1099
  yield(self) if block_given?
710
1100
  end
1101
+
1102
+ ##
1103
+ # Create a new <Break> element
1104
+ # strength:: Set a pause based on strength
1105
+ # time:: Set a pause to a specific length of time in seconds or milliseconds, available values: [number]s, [number]ms
1106
+ # keyword_args:: additional attributes
1107
+ def break(strength: nil, time: nil, **keyword_args)
1108
+ append(SsmlBreak.new(strength: strength, time: time, **keyword_args))
1109
+ end
1110
+
1111
+ ##
1112
+ # Create a new <Emphasis> element
1113
+ # words:: Words to emphasize
1114
+ # level:: Specify the degree of emphasis
1115
+ # keyword_args:: additional attributes
1116
+ def emphasis(words: nil, level: nil, **keyword_args)
1117
+ emphasis = SsmlEmphasis.new(words: words, level: level, **keyword_args)
1118
+
1119
+ yield(emphasis) if block_given?
1120
+ append(emphasis)
1121
+ end
1122
+
1123
+ ##
1124
+ # Create a new <Lang> element
1125
+ # words:: Words to speak
1126
+ # xmlLang:: Specify the language
1127
+ # keyword_args:: additional attributes
1128
+ def lang(words: nil, xmlLang: nil, **keyword_args)
1129
+ lang = SsmlLang.new(words: words, xmlLang: xmlLang, **keyword_args)
1130
+
1131
+ yield(lang) if block_given?
1132
+ append(lang)
1133
+ end
1134
+
1135
+ ##
1136
+ # Create a new <Phoneme> element
1137
+ # words:: Words to speak
1138
+ # alphabet:: Specify the phonetic alphabet
1139
+ # ph:: Specifiy the phonetic symbols for pronunciation
1140
+ # keyword_args:: additional attributes
1141
+ def phoneme(words, alphabet: nil, ph: nil, **keyword_args)
1142
+ append(SsmlPhoneme.new(words, alphabet: alphabet, ph: ph, **keyword_args))
1143
+ end
1144
+
1145
+ ##
1146
+ # Create a new <Prosody> element
1147
+ # words:: Words to speak
1148
+ # volume:: Specify the volume, available values: default, silent, x-soft, soft, medium, loud, x-loud, +ndB, -ndB
1149
+ # rate:: Specify the rate, available values: x-slow, slow, medium, fast, x-fast, n%
1150
+ # pitch:: Specify the pitch, available values: default, x-low, low, medium, high, x-high, +n%, -n%
1151
+ # keyword_args:: additional attributes
1152
+ def prosody(words: nil, volume: nil, rate: nil, pitch: nil, **keyword_args)
1153
+ prosody = SsmlProsody.new(words: words, volume: volume, rate: rate, pitch: pitch, **keyword_args)
1154
+
1155
+ yield(prosody) if block_given?
1156
+ append(prosody)
1157
+ end
1158
+
1159
+ ##
1160
+ # Create a new <S> element
1161
+ # words:: Words to speak
1162
+ # keyword_args:: additional attributes
1163
+ def s(words: nil, **keyword_args)
1164
+ s = SsmlS.new(words: words, **keyword_args)
1165
+
1166
+ yield(s) if block_given?
1167
+ append(s)
1168
+ end
1169
+
1170
+ ##
1171
+ # Create a new <Say-As> element
1172
+ # words:: Words to be interpreted
1173
+ # interpretAs:: Specify the type of words are spoken
1174
+ # role:: Specify the format of the date when interpret-as is set to date
1175
+ # keyword_args:: additional attributes
1176
+ def say_as(words, interpretAs: nil, role: nil, **keyword_args)
1177
+ append(SsmlSayAs.new(words, interpretAs: interpretAs, role: role, **keyword_args))
1178
+ end
1179
+
1180
+ ##
1181
+ # Create a new <Sub> element
1182
+ # words:: Words to be substituted
1183
+ # aliasAttribute:: Substitute a different word (or pronunciation) for selected text such as an acronym or abbreviation
1184
+ # keyword_args:: additional attributes
1185
+ def sub(words, aliasAttribute: nil, **keyword_args)
1186
+ append(SsmlSub.new(words, aliasAttribute: aliasAttribute, **keyword_args))
1187
+ end
1188
+
1189
+ ##
1190
+ # Create a new <W> element
1191
+ # words:: Words to speak
1192
+ # role:: Customize the pronunciation of words by specifying the word’s part of speech or alternate meaning
1193
+ # keyword_args:: additional attributes
1194
+ def w(words: nil, role: nil, **keyword_args)
1195
+ w = SsmlW.new(words: words, role: role, **keyword_args)
1196
+
1197
+ yield(w) if block_given?
1198
+ append(w)
1199
+ end
711
1200
  end
712
1201
 
713
1202
  ##
714
1203
  # Emphasizing Words in <Say>
715
1204
  class SsmlEmphasis < TwiML
716
- def initialize(words, **keyword_args)
1205
+ def initialize(words: nil, **keyword_args)
717
1206
  super(**keyword_args)
718
1207
  @name = 'emphasis'
719
- @value = words
1208
+ @value = words unless words.nil?
720
1209
  yield(self) if block_given?
721
1210
  end
1211
+
1212
+ ##
1213
+ # Create a new <Break> element
1214
+ # strength:: Set a pause based on strength
1215
+ # time:: Set a pause to a specific length of time in seconds or milliseconds, available values: [number]s, [number]ms
1216
+ # keyword_args:: additional attributes
1217
+ def break(strength: nil, time: nil, **keyword_args)
1218
+ append(SsmlBreak.new(strength: strength, time: time, **keyword_args))
1219
+ end
1220
+
1221
+ ##
1222
+ # Create a new <Emphasis> element
1223
+ # words:: Words to emphasize
1224
+ # level:: Specify the degree of emphasis
1225
+ # keyword_args:: additional attributes
1226
+ def emphasis(words: nil, level: nil, **keyword_args)
1227
+ emphasis = SsmlEmphasis.new(words: words, level: level, **keyword_args)
1228
+
1229
+ yield(emphasis) if block_given?
1230
+ append(emphasis)
1231
+ end
1232
+
1233
+ ##
1234
+ # Create a new <Lang> element
1235
+ # words:: Words to speak
1236
+ # xmlLang:: Specify the language
1237
+ # keyword_args:: additional attributes
1238
+ def lang(words: nil, xmlLang: nil, **keyword_args)
1239
+ lang = SsmlLang.new(words: words, xmlLang: xmlLang, **keyword_args)
1240
+
1241
+ yield(lang) if block_given?
1242
+ append(lang)
1243
+ end
1244
+
1245
+ ##
1246
+ # Create a new <Phoneme> element
1247
+ # words:: Words to speak
1248
+ # alphabet:: Specify the phonetic alphabet
1249
+ # ph:: Specifiy the phonetic symbols for pronunciation
1250
+ # keyword_args:: additional attributes
1251
+ def phoneme(words, alphabet: nil, ph: nil, **keyword_args)
1252
+ append(SsmlPhoneme.new(words, alphabet: alphabet, ph: ph, **keyword_args))
1253
+ end
1254
+
1255
+ ##
1256
+ # Create a new <Prosody> element
1257
+ # words:: Words to speak
1258
+ # volume:: Specify the volume, available values: default, silent, x-soft, soft, medium, loud, x-loud, +ndB, -ndB
1259
+ # rate:: Specify the rate, available values: x-slow, slow, medium, fast, x-fast, n%
1260
+ # pitch:: Specify the pitch, available values: default, x-low, low, medium, high, x-high, +n%, -n%
1261
+ # keyword_args:: additional attributes
1262
+ def prosody(words: nil, volume: nil, rate: nil, pitch: nil, **keyword_args)
1263
+ prosody = SsmlProsody.new(words: words, volume: volume, rate: rate, pitch: pitch, **keyword_args)
1264
+
1265
+ yield(prosody) if block_given?
1266
+ append(prosody)
1267
+ end
1268
+
1269
+ ##
1270
+ # Create a new <Say-As> element
1271
+ # words:: Words to be interpreted
1272
+ # interpretAs:: Specify the type of words are spoken
1273
+ # role:: Specify the format of the date when interpret-as is set to date
1274
+ # keyword_args:: additional attributes
1275
+ def say_as(words, interpretAs: nil, role: nil, **keyword_args)
1276
+ append(SsmlSayAs.new(words, interpretAs: interpretAs, role: role, **keyword_args))
1277
+ end
1278
+
1279
+ ##
1280
+ # Create a new <Sub> element
1281
+ # words:: Words to be substituted
1282
+ # aliasAttribute:: Substitute a different word (or pronunciation) for selected text such as an acronym or abbreviation
1283
+ # keyword_args:: additional attributes
1284
+ def sub(words, aliasAttribute: nil, **keyword_args)
1285
+ append(SsmlSub.new(words, aliasAttribute: aliasAttribute, **keyword_args))
1286
+ end
1287
+
1288
+ ##
1289
+ # Create a new <W> element
1290
+ # words:: Words to speak
1291
+ # role:: Customize the pronunciation of words by specifying the word’s part of speech or alternate meaning
1292
+ # keyword_args:: additional attributes
1293
+ def w(words: nil, role: nil, **keyword_args)
1294
+ w = SsmlW.new(words: words, role: role, **keyword_args)
1295
+
1296
+ yield(w) if block_given?
1297
+ append(w)
1298
+ end
722
1299
  end
723
1300
 
724
1301
  ##