minor refactorings
This commit is contained in:
parent
ceaf8d1bc8
commit
de59b39be5
@ -34,20 +34,20 @@ You can additionally add all available options from the official [Pushover docum
|
||||
|
||||
You can also validate a user and token using the following method
|
||||
|
||||
boolean valid = new JPushover()
|
||||
boolean valid = JPushover().build()
|
||||
.token("MyToken")
|
||||
.user("MyUser")
|
||||
.validate();
|
||||
|
||||
If you want more information and/or the response from the Pushover API, use the JPushoverResponse object.
|
||||
|
||||
JPushoverResponse jPushoverResponse = JPushover()
|
||||
JPushoverResponse jPushoverResponse = JPushover.build()
|
||||
.token("MyToken")
|
||||
.user("MyUser")
|
||||
.message("MyMessage")
|
||||
.push();
|
||||
|
||||
JPushoverResponse will return the raw HTTP status code, along with the raw JSON response and a convenient boolean if the request was successful or not.
|
||||
The JPushoverResponse will return the raw HTTP status code, along with the raw JSON response and a convenient boolean if the request was successful or not.
|
||||
|
||||
[1]: https://pushover.net
|
||||
[2]: https://pushover.net/api
|
5
pom.xml
5
pom.xml
@ -165,11 +165,6 @@
|
||||
<version>4.12</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>18.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<distributionManagement>
|
||||
<snapshotRepository>
|
||||
|
@ -46,6 +46,10 @@ public class JPushover {
|
||||
this.priority(Priority.NORMAL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new JPushover instance
|
||||
* @return JPushover instance
|
||||
*/
|
||||
public static JPushover build() {
|
||||
return new JPushover();
|
||||
}
|
||||
@ -209,7 +213,7 @@ public class JPushover {
|
||||
|
||||
/**
|
||||
* Callback parameter may be supplied with a publicly-accessible URL that the
|
||||
* Pushover servers will send a request to when the user has acknowledged your
|
||||
* pushover servers will send a request to when the user has acknowledged your
|
||||
* notification.
|
||||
* Only required if priority is set to emergency.
|
||||
*
|
||||
@ -340,9 +344,9 @@ public class JPushover {
|
||||
.add(Constants.EXPIRE.toString(), this.pushoverExpire)
|
||||
.add(Constants.CALLBACK.toString(), this.pushoverCallback)
|
||||
.add(Constants.URLTITLE.toString(), this.pushoverUrlTitle)
|
||||
.add(Constants.PRIORITY.toString(), this.pushoverPriority.get())
|
||||
.add(Constants.PRIORITY.toString(), this.pushoverPriority.toString())
|
||||
.add(Constants.TIMESTAMP.toString(), this.pushoverTimestamp)
|
||||
.add(Constants.SOUND.toString(), this.pushoverSound.get())
|
||||
.add(Constants.SOUND.toString(), this.pushoverSound.toString())
|
||||
.add(Constants.HTML.toString(), this.pushoverHtml ? "1" : "0")
|
||||
.build();
|
||||
|
||||
|
@ -26,24 +26,21 @@ public class JPushoverResponse {
|
||||
}
|
||||
|
||||
/**
|
||||
* The raw Json Response from the pushover API
|
||||
* @return String
|
||||
* @return The pushover response
|
||||
*/
|
||||
public String getResponse() {
|
||||
return pushoverResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* The HTTP status from the HTTP request
|
||||
* @return int
|
||||
* @return The HTTP status
|
||||
*/
|
||||
public int getHttpStatus() {
|
||||
return pushoverHttpStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* True if the request to the pushover API returned HTTP code 200, false otherwise
|
||||
* @return boolen
|
||||
* @return true if the api returned a HTTP status code 200, false othwise
|
||||
*/
|
||||
public boolean isSuccessful() {
|
||||
return pushoverSuccessful;
|
||||
|
@ -18,7 +18,7 @@ public enum Priority {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String get() {
|
||||
public String toString() {
|
||||
return this.value;
|
||||
}
|
||||
}
|
@ -8,7 +8,7 @@ package de.svenkubiak.jpushover.enums;
|
||||
public enum Sound {
|
||||
PUSHOVER("pushover"),
|
||||
BIKE("bike"),
|
||||
BUGLE("bugke"),
|
||||
BUGLE("bugle"),
|
||||
CASHREGISTET("cashregister"),
|
||||
CLASSICAL("classical"),
|
||||
COSMIC("cosmic"),
|
||||
@ -35,7 +35,7 @@ public enum Sound {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String get() {
|
||||
public String toString() {
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user