![JAR search and dependency download from the Maven repository](/logo.png)
com.twilio.sdk.resource.instance.ShortCode Maven / Gradle / Ivy
package com.twilio.sdk.resource.instance;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;
import com.twilio.sdk.TwilioRestClient;
import com.twilio.sdk.resource.InstanceResource;
// TODO: Auto-generated Javadoc
/**
* The Class IncomingPhoneNumber.
*
* For more information see http://www.twilio.com/docs/api/rest/shortcodes
*/
public class ShortCode extends InstanceResource {
/** The Constant SID_PROPERTY. */
private static final String SID_PROPERTY = "sid";
/**
* Instantiates a new incoming phone number.
*
* @param client the client
*/
public ShortCode(TwilioRestClient client) {
super(client);
}
/**
* Instantiates a new incoming phone number.
*
* @param client the client
* @param sid the sid
*/
public ShortCode(TwilioRestClient client, String sid) {
super(client);
if (sid == null) {
throw new IllegalStateException("The Sid for a Recording can not be null");
}
this.setProperty(SID_PROPERTY, sid);
}
/**
* Instantiates a new incoming phone number.
*
* @param client the client
* @param properties the properties
*/
public ShortCode(TwilioRestClient client,
Map properties) {
super(client, properties);
}
/* (non-Javadoc)
* @see com.twilio.sdk.resource.Resource#getResourceLocation()
*/
@Override
protected String getResourceLocation() {
return "/" + TwilioRestClient.DEFAULT_VERSION + "/Accounts/"
+ this.getRequestAccountSid() + "/SMS/ShortCodes/"
+ this.getSid() + ".json";
}
/*
* Property getters
*/
/**
* Gets the sid.
*
* @return the sid
*/
public String getSid() {
return this.getProperty(SID_PROPERTY);
}
/**
* Gets the date created.
*
* @return the date created
*/
public Date getDateCreated() {
SimpleDateFormat format = new SimpleDateFormat(
"EEE, dd MMM yyyy HH:mm:ss Z");
try {
return format.parse(this.getProperty("date_created"));
} catch (ParseException e) {
return null;
}
}
/**
* Gets the date updated.
*
* @return the date updated
*/
public Date getDateUpdated() {
SimpleDateFormat format = new SimpleDateFormat(
"EEE, dd MMM yyyy HH:mm:ss Z");
try {
return format.parse(this.getProperty("date_updated"));
} catch (ParseException e) {
return null;
}
}
/**
* Gets the friendly name.
*
* @return the friendly name
*/
public String getFriendlyName() {
return this.getProperty("friendly_name");
}
/**
* Gets the account sid.
*
* @return the account sid
*/
public String getAccountSid() {
return this.getProperty("account_sid");
}
/**
* Gets the short code number.
*
* @return the short code number
*/
public String getShortCode() {
return this.getProperty("short_code");
}
/**
* Gets the sms application sid.
*
* @return the sms application sid
*/
public String getSmsApplicationSid() {
return this.getProperty("sms_application_sid");
}
/**
* Gets the api version.
*
* @return the api version
*/
public String getApiVersion() {
return this.getProperty("api_version");
}
/**
* Gets the sms url.
*
* @return the sms url
*/
public String getSmsUrl() {
return this.getProperty("sms_url");
}
/**
* Gets the sms method.
*
* @return the sms method
*/
public String getSmsMethod() {
return this.getProperty("sms_method");
}
/**
* Gets the sms fallback url.
*
* @return the sms fallback url
*/
public String getSmsFallbackUrl() {
return this.getProperty("sms_fallback_url");
}
/**
* Gets the sms fallback method.
*
* @return the sms fallback method
*/
public String getSmsFallbackMethod() {
return this.getProperty("sms_fallback_method");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy