From aef428d8d6840395d85abb066b8118fb3e04dbc9 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Mon, 18 Jan 2016 21:41:57 +0000 Subject: Remove straggling use of Slicer::Deserialize in favour of more flexible DeserializeAny --- libtmdb/httpClient.h | 4 ++-- libtmdb/testModels.cpp | 10 +++++----- libtmdb/tmdb-proxy.cpp | 12 ++++++------ 3 files changed, 13 insertions(+), 13 deletions(-) (limited to 'libtmdb') diff --git a/libtmdb/httpClient.h b/libtmdb/httpClient.h index e171323..8e75428 100644 --- a/libtmdb/httpClient.h +++ b/libtmdb/httpClient.h @@ -46,11 +46,11 @@ namespace TMDb { } template - IceInternal::Handle + ReturnModel GetData(const std::string & pathFormat, const Params & ... params, const Parameters & parameters) const { json::Value data = FetchJson(GetUrl(pathFormat, params..., parameters)); - return Slicer::Deserialize(data); + return Slicer::DeserializeAny(data); } DLL_PUBLIC static void packParams(boost::format &); diff --git a/libtmdb/testModels.cpp b/libtmdb/testModels.cpp index fac4e65..0557017 100644 --- a/libtmdb/testModels.cpp +++ b/libtmdb/testModels.cpp @@ -20,7 +20,7 @@ const boost::filesystem::path root(XSTR(ROOT)); BOOST_AUTO_TEST_CASE( deserialize_searchmulti_json ) { - auto results = Slicer::Deserialize((root / "samples" / "searchMulti_breakingBad.json").string()); + auto results = Slicer::DeserializeAny((root / "samples" / "searchMulti_breakingBad.json").string()); BOOST_REQUIRE_EQUAL(1, results->Page); BOOST_REQUIRE_EQUAL(1, results->TotalPages); BOOST_REQUIRE_EQUAL(3, results->TotalResults); @@ -30,13 +30,13 @@ BOOST_AUTO_TEST_CASE( deserialize_searchmulti_json ) BOOST_REQUIRE_EQUAL("Breaking Bad", tv->Name); BOOST_REQUIRE_EQUAL("/4yMXf3DW6oCL0lVPZaZM2GypgwE.jpg", tv->PosterPath); BOOST_REQUIRE_EQUAL(1396, tv->Id); - + BOOST_REQUIRE_EQUAL("::TMDb::SearchMatchMovie", results->Results[1]->ice_id()); auto movie = TMDb::SearchMatchMoviePtr::dynamicCast(results->Results[1]); BOOST_REQUIRE_EQUAL("No Half Measures: Creating the Final Season of Breaking Bad", movie->Title); BOOST_REQUIRE_EQUAL("/8OixSR45U5dbqv8F0tlspmTbXxN.jpg", movie->PosterPath); BOOST_REQUIRE_EQUAL(239459, movie->Id); - + BOOST_REQUIRE_EQUAL("::TMDb::SearchMatchPerson", results->Results[2]->ice_id()); auto person = TMDb::SearchMatchPersonPtr::dynamicCast(results->Results[2]); BOOST_REQUIRE_EQUAL("Brad Pitt", person->Name); @@ -45,7 +45,7 @@ BOOST_AUTO_TEST_CASE( deserialize_searchmulti_json ) BOOST_AUTO_TEST_CASE( deserialize_movie_json ) { - auto movie = Slicer::Deserialize((root / "samples" / "movie_550.json").string()); + auto movie = Slicer::DeserializeAny((root / "samples" / "movie_550.json").string()); BOOST_REQUIRE_EQUAL(550, movie->Id); BOOST_REQUIRE_EQUAL(false, movie->Adult); BOOST_REQUIRE_EQUAL("/8uO0gUM8aNqYLs1OsTBQiXu0fEv.jpg", movie->BackdropPath); @@ -80,7 +80,7 @@ BOOST_AUTO_TEST_CASE( deserialize_movie_json ) BOOST_AUTO_TEST_CASE( deserialize_tvseries_json ) { - auto tvSeries = Slicer::Deserialize((root / "samples" / "tv_1396.json").string()); + auto tvSeries = Slicer::DeserializeAny((root / "samples" / "tv_1396.json").string()); BOOST_REQUIRE_EQUAL("/sIJyCJedGlZf1TId41gCtkblBGo.jpg", tvSeries->BackdropPath); BOOST_REQUIRE_EQUAL(1, tvSeries->CreatedBy.size()); BOOST_REQUIRE_EQUAL(66633, tvSeries->CreatedBy.front().Id); diff --git a/libtmdb/tmdb-proxy.cpp b/libtmdb/tmdb-proxy.cpp index 7a575e5..b20752c 100644 --- a/libtmdb/tmdb-proxy.cpp +++ b/libtmdb/tmdb-proxy.cpp @@ -9,37 +9,37 @@ namespace TMDb { SearchMultiResultsPtr Proxy::SearchMulti(const std::string & query, const IceUtil::Optional & page, const Ice::Current&) { - return GetData("/search/multi", { { "query", query }, { "page", page } }); + return GetData("/search/multi", { { "query", query }, { "page", page } }); } SearchMovieResultsPtr Proxy::SearchMovies(const std::string & query, const IceUtil::Optional & year, const IceUtil::Optional & page, const Ice::Current&) { - return GetData("/search/movies", { { "query", query }, { "page", page }, { "year", year } }); + return GetData("/search/movies", { { "query", query }, { "page", page }, { "year", year } }); } SearchPersonResultsPtr Proxy::SearchPersons(const std::string & query, const IceUtil::Optional & page, const Ice::Current&) { - return GetData("/search/person", { { "query", query }, { "page", page } }); + return GetData("/search/person", { { "query", query }, { "page", page } }); } SearchTvResultsPtr Proxy::SearchTv(const std::string & query, const IceUtil::Optional & page, const Ice::Current&) { - return GetData("/search/tv", { { "query", query}, { "page", page } }); + return GetData("/search/tv", { { "query", query}, { "page", page } }); } MoviePtr Proxy::GetMovie(Ice::Int id, const Ice::Current&) { - return GetData("/movie/%d", id, { }); + return GetData("/movie/%d", id, { }); } TvSeriesPtr Proxy::GetTvSeries(Ice::Int id, const Ice::Current&) { - return GetData("/tv/%d", id, { }); + return GetData("/tv/%d", id, { }); } } -- cgit v1.2.3