Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add log incoming message field to the application #41

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public class Application extends BaseResource {
private String resourceUri;
private String sipUri;
private String subAccount;
private Boolean logIncomingMessage;

public static ApplicationCreator creator(String appName) {
return new ApplicationCreator(appName);
Expand Down Expand Up @@ -168,6 +169,13 @@ public String getSubAccount() {
return subAccount;
}

/**
* @return indicates if the the incoming message will be logged. By default it is true
*/
public Boolean getLogIncomingMessage() {
return logIncomingMessage;
}

public ApplicationUpdater updater() {
return Application.updater(appId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class ApplicationCreator extends Creator<ApplicationCreateResponse> {
private Boolean defaultNumberApp;
private Boolean defaultEndpointApp;
private String subaccount;
private Boolean logIncomingMessage;

/**
* @param appName The name of your application
Expand Down Expand Up @@ -78,6 +79,10 @@ public String subaccount() {
return this.subaccount;
}

public Boolean logIncomingMessage() {
return this.logIncomingMessage;
}

public ApplicationCreator appName(final String appName) {
this.appName = appName;
return this;
Expand Down Expand Up @@ -138,6 +143,11 @@ public ApplicationCreator subaccount(final String subaccount) {
return this;
}

public ApplicationCreator logIncomingMessage(final Boolean logIncomingMessage) {
this.logIncomingMessage = logIncomingMessage;
return this;
}

@Override
protected Call<ApplicationCreateResponse> obtainCall() {
return client().getApiService().applicationCreate(client().getAuthId(), this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class ApplicationUpdater extends Updater<ApplicationUpdateResponse> {
private Boolean defaultNumberApp;
private Boolean defaultEndpointApp;
private String subaccount;
private Boolean logIncomingMessage;

public ApplicationUpdater(String id) {
super(id);
Expand Down Expand Up @@ -64,6 +65,10 @@ public Boolean defaultEndpointApp() {
public String subaccount() {
return this.subaccount;
}

public Boolean logIncomingMessage() {
return this.logIncomingMessage;
}

public ApplicationUpdater answerUrl(final String answerUrl) {
this.answerUrl = answerUrl;
Expand Down Expand Up @@ -120,6 +125,12 @@ public ApplicationUpdater subaccount(final String subaccount) {
return this;
}

public ApplicationUpdater logIncomingMessage(final Boolean logIncomingMessage) {
this.logIncomingMessage = logIncomingMessage;
return this;
}



@Override
protected Call<ApplicationUpdateResponse> obtainCall() {
Expand Down
1 change: 1 addition & 0 deletions src/test/java/com/plivo/api/ApplicationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public void applicationCreateShouldSucceed() throws Exception {
.fallbackMethod("POST")
.messageUrl("http://message.url")
.messageMethod("POST")
.logIncomingMessage(true)
.create();

assertRequest("POST", "Application/");
Expand Down
3 changes: 2 additions & 1 deletion src/test/resources/com/plivo/api/applicationGetResponse.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@
"public_uri": false,
"resource_uri": "/v1/Account/MAXXXXXXXXXXXXXXXXXX/Application/20468599130939380/",
"sip_uri": "sip:[email protected]",
"sub_account": null
"sub_account": null,
"log_incoming_message": true
}
24 changes: 16 additions & 8 deletions src/test/resources/com/plivo/api/applicationListResponse.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"public_uri": false,
"resource_uri": "/v1/Account/MAXXXXXXXXXXXXXXXXXX/Application/20468599130939380/",
"sip_uri": "sip:[email protected]",
"sub_account": null
"sub_account": null,
"log_incoming_message": true
},
{
"answer_method": "POST",
Expand All @@ -44,7 +45,8 @@
"public_uri": false,
"resource_uri": "/v1/Account/MAXXXXXXXXXXXXXXXXXX/Application/13094892674577059/",
"sip_uri": "sip:[email protected]",
"sub_account": null
"sub_account": null,
"log_incoming_message": false
},
{
"answer_method": "POST",
Expand All @@ -63,7 +65,8 @@
"public_uri": false,
"resource_uri": "/v1/Account/MAXXXXXXXXXXXXXXXXXX/Application/64529074997228907/",
"sip_uri": "sip:[email protected]",
"sub_account": null
"sub_account": null,
"log_incoming_message": true
},
{
"answer_method": "GET",
Expand All @@ -82,7 +85,8 @@
"public_uri": false,
"resource_uri": "/v1/Account/MAXXXXXXXXXXXXXXXXXX/Application/30042999414609341/",
"sip_uri": "sip:[email protected]",
"sub_account": null
"sub_account": null,
"log_incoming_message": true
},
{
"answer_method": "GET",
Expand All @@ -101,7 +105,8 @@
"public_uri": false,
"resource_uri": "/v1/Account/MAXXXXXXXXXXXXXXXXXX/Application/30042349822904887/",
"sip_uri": "sip:[email protected]",
"sub_account": null
"sub_account": null,
"log_incoming_message": true
},
{
"answer_method": "GET",
Expand All @@ -120,7 +125,8 @@
"public_uri": false,
"resource_uri": "/v1/Account/MAXXXXXXXXXXXXXXXXXX/Application/30041373335801898/",
"sip_uri": "sip:[email protected]",
"sub_account": null
"sub_account": null,
"log_incoming_message": true
},
{
"answer_method": "POST",
Expand All @@ -139,7 +145,8 @@
"public_uri": false,
"resource_uri": "/v1/Account/MAXXXXXXXXXXXXXXXXXX/Application/30040535577211472/",
"sip_uri": "sip:[email protected]",
"sub_account": null
"sub_account": null,
"log_incoming_message": true
},
{
"answer_method": "GET",
Expand All @@ -158,7 +165,8 @@
"public_uri": false,
"resource_uri": "/v1/Account/MAXXXXXXXXXXXXXXXXXX/Application/30039778631346811/",
"sip_uri": "sip:[email protected]",
"sub_account": null
"sub_account": null,
"log_incoming_message": true
}
]
}