Skip to content

Commit bddf73f

Browse files
Updated README for 1.2.0
1 parent 3219c25 commit bddf73f

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

README.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
# Tzeva Adom API
2-
Simple Java API that listens to `Pikud Haoref's API` and notifies registered listeners once a Tzeva Adom takes place.
2+
Async Java API that listens to `Pikud Ha'oref API` and notifies registered listeners as soon as a Tzeva Adom happens.
33

44

55
## How to use
6-
Let's create a notifier object that logs a message when it's Tzeva Adom:
6+
Let's create a notifier that logs a message when it's Tzeva Adom:
77
```java
88
TzevaAdomNotifier
99
.requestFromPikudHaoref()
1010
.every(Duration.ofSeconds(3)) //amount of delay between requests
11-
.onFailedRequest(exception -> LOGGER.error("Failed to send a request to Pikud Ha'oref...", exception))
11+
.onFailedRequest(exception -> LOGGER.error("Failed to request the last alert from Pikud Ha'oref", exception))
1212
.onTzevaAdom(alert -> LOGGER.info("Tzeva Adom at: " + alert.getCity()))
13-
.listen();
13+
.listen(); //async
1414
```
1515

16-
You can save the notifier object in order to add functionality or get data from it, by calling `build()` instead of `listen()`:
16+
You can save the notifier object by calling `build()` instead of `listen()`, in order to add functionality or get data from it:
1717
```java
1818
TzevaAdomNotifier notifier = TzevaAdomNotifier
1919
// builder pattern goes here
@@ -22,14 +22,17 @@ TzevaAdomNotifier notifier = TzevaAdomNotifier
2222
notifier.listen();
2323
```
2424

25-
Adding Listeners anytime:
25+
Add more listeners anytime:
2626
```java
2727
notifier.addListener(alert -> ...);
2828
```
2929

30-
Retrieving the Tzeva Adom Alerts encountered while running:
30+
Retrieve the Tzeva Adom alerts encountered while running:
3131
```java
32+
//run the notifier async and sleep for a day
33+
notifier.run();
3234
TimeUnit.DAYS.sleep(1);
35+
3336
LOGGER.info("There were {} alerts in the last 24 hours:", notifier.getHistory().size());
3437

3538
//Pro Tip: TzevaAdomNotifier implements Iterable!

0 commit comments

Comments
 (0)