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 delete to OutgoingCallerId #70

Merged
merged 1 commit into from Jan 13, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -6,16 +6,18 @@
import java.util.Map;

import com.twilio.sdk.TwilioRestClient;
import com.twilio.sdk.TwilioRestException;
import com.twilio.sdk.TwilioRestResponse;
import com.twilio.sdk.resource.InstanceResource;

// TODO: Auto-generated Javadoc
/**
* The Class OutgoingCallerId.
*
*
* For more information see <a href="http://www.twilio.com/docs/api/rest/outgoing-caller-ids">http://www.twilio.com/docs/api/rest/outgoing-caller-ids</a>
*/
public class OutgoingCallerId extends InstanceResource {

/** The Constant SID_PROPERTY. */
private static final String SID_PROPERTY = "sid";

Expand All @@ -36,7 +38,7 @@ public OutgoingCallerId(TwilioRestClient client) {
*/
public OutgoingCallerId(TwilioRestClient client, String sid) {
super(client);
if (sid == null) {
if (sid == null) {
throw new IllegalStateException("The Sid for an OutgoingCallerId can not be null");
}
this.setProperty(SID_PROPERTY, sid);
Expand Down Expand Up @@ -72,7 +74,7 @@ protected String getResourceLocation() {
public String getSid() {
return this.getProperty(SID_PROPERTY);
}

/**
* Gets the date created.
*
Expand Down Expand Up @@ -129,4 +131,17 @@ public String getAccountSid() {
public String getPhoneNumber() {
return this.getProperty("phone_number");
}

/**
* Delete this CallerId
*
* @return true, if successful
* @throws TwilioRestException the twilio rest exception
*/
public boolean delete() throws TwilioRestException {
TwilioRestResponse response = this.getClient().safeRequest(
this.getResourceLocation(), "DELETE", null);

return !response.isError();
}
}
12 changes: 6 additions & 6 deletions src/main/java/com/twilio/sdk/resource/instance/Recording.java
Expand Up @@ -14,13 +14,13 @@
// TODO: Auto-generated Javadoc
/**
* The Class Recording.
*
*
* For more information see <a href="http://www.twilio.com/docs/api/rest/recording">http://www.twilio.com/docs/api/rest/recording</a>
*
*
*
*
*/
public class Recording extends InstanceResource {

/** The Constant SID_PROPERTY. */
private static final String SID_PROPERTY = "sid";

Expand All @@ -41,7 +41,7 @@ public Recording(TwilioRestClient client) {
*/
public Recording(TwilioRestClient client, String sid) {
super(client);
if (sid == null) {
if (sid == null) {
throw new IllegalStateException("The Sid for a Recording can not be null");
}
this.setProperty(SID_PROPERTY, sid);
Expand Down Expand Up @@ -167,7 +167,7 @@ public InputStream getMedia(String extension) {
}

/**
* Delete.
* Delete this Recording
*
* @return true, if successful
* @throws TwilioRestException the twilio rest exception
Expand Down