diff --git a/src/java/com/twilio/sdk/examples/RestExamples.java b/src/java/com/twilio/sdk/examples/RestExamples.java index 500aa60174..ec956ee3db 100644 --- a/src/java/com/twilio/sdk/examples/RestExamples.java +++ b/src/java/com/twilio/sdk/examples/RestExamples.java @@ -47,7 +47,6 @@ public static void main(String[] args) throws TwilioRestException { // Get the main account (The one we used to authenticate the client Account mainAccount = client.getAccount(); - // Get all accounts including sub accounts AccountList accountList = client.getAccounts(); diff --git a/src/java/com/twilio/sdk/resource/instance/IncomingPhoneNumber.java b/src/java/com/twilio/sdk/resource/instance/IncomingPhoneNumber.java index cfcdb3d9c1..105099324d 100644 --- a/src/java/com/twilio/sdk/resource/instance/IncomingPhoneNumber.java +++ b/src/java/com/twilio/sdk/resource/instance/IncomingPhoneNumber.java @@ -6,23 +6,28 @@ 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 IncomingPhoneNumber. * - * For more information see {@see http://www.twilio.com/docs/api/rest/incoming-phone-numbers} + * For more information see {@see http://www.twilio.com/docs/api/rest/incoming-phone-numbers} */ public class IncomingPhoneNumber extends InstanceResource { - + /** The Constant SID_PROPERTY. */ private static final String SID_PROPERTY = "sid"; /** * Instantiates a new incoming phone number. - * - * @param client the client + * + * @param client + * the client */ public IncomingPhoneNumber(TwilioRestClient client) { super(client); @@ -30,9 +35,11 @@ public IncomingPhoneNumber(TwilioRestClient client) { /** * Instantiates a new incoming phone number. - * - * @param client the client - * @param sid the sid + * + * @param client + * the client + * @param sid + * the sid */ public IncomingPhoneNumber(TwilioRestClient client, String sid) { super(client); @@ -41,16 +48,20 @@ public IncomingPhoneNumber(TwilioRestClient client, String sid) { /** * Instantiates a new incoming phone number. - * - * @param client the client - * @param properties the properties + * + * @param client + * the client + * @param properties + * the properties */ public IncomingPhoneNumber(TwilioRestClient client, Map properties) { super(client, properties); } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see com.twilio.sdk.resource.Resource#getResourceLocation() */ @Override @@ -60,12 +71,28 @@ protected String getResourceLocation() { + this.getSid() + ".json"; } + /** + * Deprovision this IncomingPhoneNumber. This will remove it from your + * account. + * + * @throws TwilioRestException + * if there is an error in the request + * @return true, if successful + * + */ + public boolean delete() throws TwilioRestException { + TwilioRestResponse response = this.getClient().safeRequest( + this.getResourceLocation(), "DELETE", null); + + return !response.isError(); + } + /* * Property getters */ /** * Gets the sid. - * + * * @return the sid */ public String getSid() { @@ -74,7 +101,7 @@ public String getSid() { /** * Gets the date created. - * + * * @return the date created */ public Date getDateCreated() { @@ -89,7 +116,7 @@ public Date getDateCreated() { /** * Gets the date updated. - * + * * @return the date updated */ public Date getDateUpdated() { @@ -104,7 +131,7 @@ public Date getDateUpdated() { /** * Gets the friendly name. - * + * * @return the friendly name */ public String getFriendlyName() { @@ -113,7 +140,7 @@ public String getFriendlyName() { /** * Gets the account sid. - * + * * @return the account sid */ public String getAccountSid() { @@ -122,7 +149,7 @@ public String getAccountSid() { /** * Gets the phone number. - * + * * @return the phone number */ public String getPhoneNumber() { @@ -131,7 +158,7 @@ public String getPhoneNumber() { /** * Gets the voice applicaiton sid. - * + * * @return the voice applicaiton sid */ public String getVoiceApplicaitonSid() { @@ -140,7 +167,7 @@ public String getVoiceApplicaitonSid() { /** * Gets the sms applicaiton sid. - * + * * @return the sms applicaiton sid */ public String getSmsApplicaitonSid() { @@ -149,7 +176,7 @@ public String getSmsApplicaitonSid() { /** * Gets the api version. - * + * * @return the api version */ public String getApiVersion() { @@ -158,7 +185,7 @@ public String getApiVersion() { /** * Gets the voice url. - * + * * @return the voice url */ public String getVoiceUrl() { @@ -167,7 +194,7 @@ public String getVoiceUrl() { /** * Gets the voice method. - * + * * @return the voice method */ public String getVoiceMethod() { @@ -176,7 +203,7 @@ public String getVoiceMethod() { /** * Gets the voice fallback url. - * + * * @return the voice fallback url */ public String getVoiceFallbackUrl() { @@ -185,7 +212,7 @@ public String getVoiceFallbackUrl() { /** * Gets the voice fallback method. - * + * * @return the voice fallback method */ public String getVoiceFallbackMethod() { @@ -194,7 +221,7 @@ public String getVoiceFallbackMethod() { /** * Gets the status callback. - * + * * @return the status callback */ public String getStatusCallback() { @@ -203,7 +230,7 @@ public String getStatusCallback() { /** * Gets the status callback method. - * + * * @return the status callback method */ public String getStatusCallbackMethod() { @@ -212,7 +239,7 @@ public String getStatusCallbackMethod() { /** * Gets the voice caller id lookup. - * + * * @return the voice caller id lookup */ public String getVoiceCallerIdLookup() { @@ -221,7 +248,7 @@ public String getVoiceCallerIdLookup() { /** * Gets the sms url. - * + * * @return the sms url */ public String getSmsUrl() { @@ -230,7 +257,7 @@ public String getSmsUrl() { /** * Gets the sms method. - * + * * @return the sms method */ public String getSmsMethod() { @@ -239,7 +266,7 @@ public String getSmsMethod() { /** * Gets the sms fallback url. - * + * * @return the sms fallback url */ public String getSmsFallbackUrl() { @@ -248,7 +275,7 @@ public String getSmsFallbackUrl() { /** * Gets the sms fallback method. - * + * * @return the sms fallback method */ public String getSmsFallbackMethod() { @@ -257,7 +284,7 @@ public String getSmsFallbackMethod() { /** * Gets the sms status callback. - * + * * @return the sms status callback */ public String getSmsStatusCallback() {