Skip to content

Commit d6e984e

Browse files
committed
Update Enqueue TwiML, extend TaskRouterResource on TaskRouting/Workflow
1 parent f305d94 commit d6e984e

File tree

6 files changed

+16
-8
lines changed

6 files changed

+16
-8
lines changed

src/main/java/com/twilio/taskrouter/TaskRouting.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY)
1414
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
15-
public class TaskRouting {
15+
public class TaskRouting extends TaskRouterResource {
1616

1717
@JsonProperty("filters")
1818
private final List<WorkflowRule> workflowRules;

src/main/java/com/twilio/taskrouter/Workflow.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY)
1616
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
17-
public class Workflow {
17+
public class Workflow extends TaskRouterResource {
1818

1919
@JsonProperty("task_routing")
2020
private final TaskRouting taskRouting;

src/main/java/com/twilio/twiml/Enqueue.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class Enqueue extends TwiML {
3131

3232
// For XML Serialization
3333
private Enqueue() {
34-
this(new Builder(null));
34+
this(new Builder());
3535
}
3636

3737
private Enqueue(Builder b) {
@@ -75,8 +75,9 @@ public static class Builder {
7575
private String workflowSid;
7676
private String queueName;
7777

78-
public Builder(String queueName) {
78+
public Builder queueName(String queueName) {
7979
this.queueName = queueName;
80+
return this;
8081
}
8182

8283
public Builder action(String action) {

src/main/java/com/twilio/twiml/VoiceResponse.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ public Builder enqueue(Enqueue enqueue) {
5151
return this;
5252
}
5353

54+
public Builder enqueue(EnqueueTask enqueue) {
55+
this.actions.add(enqueue);
56+
return this;
57+
}
58+
5459
public Builder gather(Gather gather) {
5560
this.actions.add(gather);
5661
return this;

src/test/java/com/twilio/twiml/EnqueueTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ public class EnqueueTest {
1010

1111
@Test
1212
public void testXml() throws TwiMLException {
13-
Enqueue enqueue = new Enqueue.Builder("enqueue")
13+
Enqueue enqueue = new Enqueue.Builder()
14+
.queueName("enqueue")
1415
.action("/enqueue")
1516
.method(Method.GET)
1617
.waitUrl("/wait")
@@ -23,7 +24,8 @@ public void testXml() throws TwiMLException {
2324

2425
@Test
2526
public void testUrl() throws TwiMLException {
26-
Enqueue enqueue = new Enqueue.Builder("enqueue")
27+
Enqueue enqueue = new Enqueue.Builder()
28+
.queueName("enqueue")
2729
.action("/enqueue")
2830
.method(Method.GET)
2931
.waitUrl("/wait")

src/test/java/com/twilio/twiml/VoiceResponseTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public void testXml() throws TwiMLException {
1313
VoiceResponse response = new VoiceResponse.Builder()
1414
.redirect(new Redirect.Builder().build())
1515
.dial(new Dial.Builder().build())
16-
.enqueue(new Enqueue.Builder("enqueue").build())
16+
.enqueue(new Enqueue.Builder().queueName("enqueue").build())
1717
.gather(new Gather.Builder().build())
1818
.hangup(new Hangup())
1919
.leave(new Leave())
@@ -49,7 +49,7 @@ public void testUrl() throws TwiMLException {
4949
VoiceResponse response = new VoiceResponse.Builder()
5050
.redirect(new Redirect.Builder().build())
5151
.dial(new Dial.Builder().build())
52-
.enqueue(new Enqueue.Builder("enqueue").build())
52+
.enqueue(new Enqueue.Builder().queueName("enqueue").build())
5353
.gather(new Gather.Builder().build())
5454
.hangup(new Hangup())
5555
.leave(new Leave())

0 commit comments

Comments
 (0)