Update Nim API client

This commit is contained in:
Christine Dodrill 2015-08-17 14:36:32 -07:00
parent 045f69d53a
commit 0cc73a2e95
1 changed files with 13 additions and 1 deletions

View File

@ -44,6 +44,10 @@ proc newest*(): Episode =
## returns information on the newest episode of My Little Pony: Friendship is Magic.
getJson("/newest")["episode"].newEpisodeFromNode
proc last_aired*(): Episode =
## returns information on the most recently aired episode of My Little Pony: Friendship is Magic.
getJson("/last_aired")["episode"].newEpisodeFromNode
proc random*(): Episode =
## returns information on a random episode.
getJson("/random")["episode"].newEpisodeFromNode
@ -72,7 +76,7 @@ when isMainModule:
suite "ponyapi tests":
var ep: Episode
test "Newest episode lookup":
test "newest episode lookup":
try:
ep = newest()
@ -80,6 +84,14 @@ when isMainModule:
echo getCurrentExceptionMsg()
fail
test "last aired episode lookup":
try:
ep = last_aired()
except:
echo getCurrentExceptionMsg()
fail
test "stringify episode":
echo ep