2015-01-07 13:16:55 +01:00
|
|
|
package de.svenkubiak.jpushover;
|
|
|
|
|
2015-01-08 08:12:55 +01:00
|
|
|
/**
|
2015-12-08 22:03:44 +01:00
|
|
|
*
|
2015-01-08 08:12:55 +01:00
|
|
|
* @author svenkubiak
|
|
|
|
*
|
|
|
|
*/
|
2015-01-07 13:16:55 +01:00
|
|
|
public class JPushoverResponse {
|
2015-01-07 20:11:23 +01:00
|
|
|
private String pushoverResponse;
|
|
|
|
private int pushoverHttpStatus;
|
|
|
|
private boolean pushoverSuccessful;
|
2015-12-08 22:03:44 +01:00
|
|
|
|
2015-01-07 13:16:55 +01:00
|
|
|
public JPushoverResponse response(String response) {
|
2015-01-07 20:11:23 +01:00
|
|
|
this.pushoverResponse = response;
|
2015-01-07 13:16:55 +01:00
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public JPushoverResponse httpStatus(int httpStatus) {
|
2015-01-07 20:11:23 +01:00
|
|
|
this.pushoverHttpStatus = httpStatus;
|
2015-01-07 13:16:55 +01:00
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public JPushoverResponse isSuccessful(boolean successful) {
|
2015-01-07 20:11:23 +01:00
|
|
|
this.pushoverSuccessful = successful;
|
2015-01-07 13:16:55 +01:00
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The raw Json Response from the pushover API
|
|
|
|
* @return String
|
|
|
|
*/
|
|
|
|
public String getResponse() {
|
2015-01-07 20:11:23 +01:00
|
|
|
return pushoverResponse;
|
2015-01-07 13:16:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The HTTP status from the HTTP request
|
|
|
|
* @return int
|
|
|
|
*/
|
|
|
|
public int getHttpStatus() {
|
2015-01-07 20:11:23 +01:00
|
|
|
return pushoverHttpStatus;
|
2015-01-07 13:16:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2015-01-08 08:12:55 +01:00
|
|
|
* True if the request to the pushover API returned HTTP code 200, false otherwise
|
2015-01-07 13:16:55 +01:00
|
|
|
* @return boolen
|
|
|
|
*/
|
|
|
|
public boolean isSuccessful() {
|
2015-01-07 20:11:23 +01:00
|
|
|
return pushoverSuccessful;
|
2015-01-07 13:16:55 +01:00
|
|
|
}
|
|
|
|
}
|