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
Jump to file or symbol
Failed to load files and symbols.
+25 −10
Diff settings

Always

Just for now

@@ -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";
@@ -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);
@@ -72,7 +74,7 @@ protected String getResourceLocation() {
public String getSid() {
return this.getProperty(SID_PROPERTY);
}
/**
* Gets the date created.
*
@@ -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();
}
}
@@ -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";
@@ -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);
@@ -167,7 +167,7 @@ public InputStream getMedia(String extension) {
}
/**
* Delete.
* Delete this Recording
*
* @return true, if successful
* @throws TwilioRestException the twilio rest exception
ProTip! Use n and p to navigate between commits in a pull request.