Skip to content

Instantly share code, notes, and snippets.

@mchmielarz
Last active December 17, 2018 21:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mchmielarz/0762897aad51983254f7d13bed71adf8 to your computer and use it in GitHub Desktop.
Save mchmielarz/0762897aad51983254f7d13bed71adf8 to your computer and use it in GitHub Desktop.
Fetch data from Airly service
Try.of(() -> Uri.create("http://airapi.airly.eu/v2/measurements/nearest/..."))
.flatMap(this::callAirly)
  .map(responseBody -> new RawMeasurements(coordinates.city(), responseBody))
  .mapTry(this::parse);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment