From 0cc73a2e955d3854b26b4b86c8a267545799d216 Mon Sep 17 00:00:00 2001 From: Christine Dodrill Date: Mon, 17 Aug 2015 14:36:32 -0700 Subject: [PATCH] Update Nim API client --- client/nim/ponyapi.nim | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/client/nim/ponyapi.nim b/client/nim/ponyapi.nim index 1b205e7..8613526 100644 --- a/client/nim/ponyapi.nim +++ b/client/nim/ponyapi.nim @@ -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