diff options
Diffstat (limited to 'partners_api')
-rw-r--r-- | partners_api/booking_api.cpp | 2 | ||||
-rw-r--r-- | partners_api/booking_api.hpp | 2 | ||||
-rw-r--r-- | partners_api/opentable_api.cpp | 21 | ||||
-rw-r--r-- | partners_api/opentable_api.hpp | 12 | ||||
-rw-r--r-- | partners_api/partners_api.pro | 2 | ||||
-rw-r--r-- | partners_api/partners_api_tests/booking_tests.cpp | 2 |
6 files changed, 38 insertions, 3 deletions
diff --git a/partners_api/booking_api.cpp b/partners_api/booking_api.cpp index 6bb2dc1a75..201f2cafbd 100644 --- a/partners_api/booking_api.cpp +++ b/partners_api/booking_api.cpp @@ -20,7 +20,7 @@ BookingApi::BookingApi() : m_affiliateId(BOOKING_AFFILIATE_ID), m_testingMode(fa m_apiUrl = "https://" + ss.str() + "@distribution-xml.booking.com/json/bookings."; } -string BookingApi::GetBookingUrl(string const & baseUrl, string const & /* lang */) const +string BookingApi::GetBookHotelUrl(string const & baseUrl, string const & /* lang */) const { return GetDescriptionUrl(baseUrl) + "#availability"; } diff --git a/partners_api/booking_api.hpp b/partners_api/booking_api.hpp index 4e92a8ca83..4804fefa7d 100644 --- a/partners_api/booking_api.hpp +++ b/partners_api/booking_api.hpp @@ -117,7 +117,7 @@ public: static constexpr const char kDefaultCurrency[1] = {0}; BookingApi(); - string GetBookingUrl(string const & baseUrl, string const & lang = string()) const; + string GetBookHotelUrl(string const & baseUrl, string const & lang = string()) const; string GetDescriptionUrl(string const & baseUrl, string const & lang = string()) const; inline void SetTestingMode(bool testing) { m_testingMode = testing; } diff --git a/partners_api/opentable_api.cpp b/partners_api/opentable_api.cpp new file mode 100644 index 0000000000..9454cef63b --- /dev/null +++ b/partners_api/opentable_api.cpp @@ -0,0 +1,21 @@ +#include "partners_api/opentable_api.hpp" + +#include "std/sstream.hpp" + +#include "private.h" + +namespace +{ + auto const kOpentableBaseUrl = "http://www.opentable.com/restaurant/profile/"; +} // namespace + +namespace opentable +{ +// static +string Api::GetBookTableUrl(string const & restaurantId) +{ + stringstream ss; + ss << kOpentableBaseUrl << restaurantId << "?ref=" << OPENTABLE_AFFILATE_ID; + return ss.str(); +} +} // namespace opentable diff --git a/partners_api/opentable_api.hpp b/partners_api/opentable_api.hpp new file mode 100644 index 0000000000..b298fafdd7 --- /dev/null +++ b/partners_api/opentable_api.hpp @@ -0,0 +1,12 @@ +#pragma once + +#include "std/string.hpp" + +namespace opentable +{ +class Api +{ +public: + static string GetBookTableUrl(string const & restaurantId); +}; +} // namespace opentable diff --git a/partners_api/partners_api.pro b/partners_api/partners_api.pro index e49f090dae..47cf571ac3 100644 --- a/partners_api/partners_api.pro +++ b/partners_api/partners_api.pro @@ -10,8 +10,10 @@ include($$ROOT_DIR/common.pri) SOURCES += \ booking_api.cpp \ + opentable_api.cpp \ uber_api.cpp \ HEADERS += \ booking_api.hpp \ + opentable_api.hpp \ uber_api.hpp \ diff --git a/partners_api/partners_api_tests/booking_tests.cpp b/partners_api/partners_api_tests/booking_tests.cpp index 05b28b25ae..86f3fcf54c 100644 --- a/partners_api/partners_api_tests/booking_tests.cpp +++ b/partners_api/partners_api_tests/booking_tests.cpp @@ -6,7 +6,7 @@ UNIT_TEST(Booking_SmokeTest) { BookingApi api; - string url = api.GetBookingUrl("http://someurl.com"); + string url = api.GetBookHotelUrl("http://someurl.com"); TEST(!url.empty(), ()); } |