Created
October 28, 2016 20:21
-
-
Save rhart/83c158cfe5336cc1a6d2ba7d40d224c9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Promise<String> getBookRequest(final String isbn) { | |
def uri = "${config.host}/api/v2/json/${config.apikey}/book/$isbn".toURI() | |
httpClient | |
.get(uri) | |
.map { ReceivedResponse resp -> | |
if (resp.body.text.contains("Daily request limit exceeded")) { | |
throw new RuntimeException("ISBNDB daily request limit exceeded.") | |
} | |
resp.body.text | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment