com.twilio.sdk.resource.instance.FeedbackSummary Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of twilio-java-sdk Show documentation
Show all versions of twilio-java-sdk Show documentation
Release Candidate for Next-Gen Twilio Java Helper Library
package com.twilio.sdk.resource.instance;
import com.twilio.sdk.TwilioRestClient;
import com.twilio.sdk.resource.InstanceResource;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Collections;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* A FeedbackSummary class. Used to get feedback summary resource.
*/
public class FeedbackSummary extends InstanceResource {
public static final String ACCOUNT_SID_PROPERTY = "account_sid";
public static final String CALL_COUNT_PROPERTY = "call_count";
public static final String CALL_FEEDBACK_COUNT_PROPERTY = "call_feedback_count";
public static final String END_DATE_PROPERTY = "end_date";
public static final String INCLUDE_SUB_ACCOUNTS_PROPERTY = "include_subaccounts";
public static final String ISSUES_PROPERTY = "issues";
public static final String QUALITY_SCORE_AVERAGE_PROPERTY = "quality_score_average";
public static final String QUALITY_SCORE_MEDIAN_PROPERTY = "quality_score_median";
public static final String QUALITY_SCORE_STANDARD_DEVIATION_PROPERTY = "quality_score_standard_deviation";
public static final String START_DATE_PROPERTY = "start_date";
public static final String STATUS_PROPERTY = "status";
private static final String DATE_FORMAT = "yyyy-MM-dd";
/**
* Instantiates a new FeedbackSummary
*
* @param client the client
*/
public FeedbackSummary(final TwilioRestClient client) {
super(client);
}
/**
* Instantiates a new FeedbackSummary.
*
* @param client the client
* @param properties the properties
*/
public FeedbackSummary(TwilioRestClient client, Map properties) {
super(client, properties);
}
@Override
protected String getResourceLocation() {
return "/" + TwilioRestClient.DEFAULT_VERSION + "/Accounts/" + getRequestAccountSid() +
"/Calls/FeedbackSummary" + getSid() + ".json";
}
public String getAccountSid() {
return getProperty(ACCOUNT_SID_PROPERTY);
}
public Integer getCallCount() {
try {
return (Integer) getObject(CALL_COUNT_PROPERTY);
} catch (IllegalArgumentException e) {
return null;
}
}
public Integer getCallFeedbackCount() {
try {
return (Integer) getObject(CALL_FEEDBACK_COUNT_PROPERTY);
} catch (IllegalArgumentException e) {
return null;
}
}
public Date getDateCreated() {
return getDateProperty(DATE_CREATED_PROPERTY);
}
public Date getDateUpdated() {
return getDateProperty(DATE_UPDATED_PROPERTY);
}
public Date getEndDate() {
SimpleDateFormat format = new SimpleDateFormat(DATE_FORMAT);
try {
return format.parse(getProperty(END_DATE_PROPERTY));
} catch (ParseException e) {
return null;
}
}
public boolean isIncludeSubAccounts() {
return Boolean.parseBoolean(getProperty(INCLUDE_SUB_ACCOUNTS_PROPERTY));
}
public Set getIssues() {
try {
List