forked from organicmaps/organicmaps
review link
This commit is contained in:
parent
789b8416f2
commit
f1d606c813
5 changed files with 17 additions and 0 deletions
|
@ -847,8 +847,10 @@ void Framework::FillInfoFromFeatureType(FeatureType const & ft, place_page::Info
|
|||
ASSERT(m_bookingApi, ());
|
||||
info.m_sponsoredType = SponsoredType::Booking;
|
||||
auto const & baseUrl = info.GetMetadata().Get(feature::Metadata::FMD_WEBSITE);
|
||||
auto const & hotelId = info.GetMetadata().Get(feature::Metadata::FMD_SPONSORED_ID);
|
||||
info.m_sponsoredUrl = m_bookingApi->GetBookHotelUrl(baseUrl);
|
||||
info.m_sponsoredDescriptionUrl = m_bookingApi->GetDescriptionUrl(baseUrl);
|
||||
info.m_sponsoredReviewUrl = m_bookingApi->GetHotelReviewsUrl(hotelId, baseUrl);
|
||||
}
|
||||
else if (ftypes::IsOpentableChecker::Instance()(ft))
|
||||
{
|
||||
|
|
|
@ -137,6 +137,7 @@ string Info::GetBookmarkCategoryName() const { return m_bookmarkCategoryName; }
|
|||
string const & Info::GetApiUrl() const { return m_apiUrl; }
|
||||
string const & Info::GetSponsoredUrl() const { return m_sponsoredUrl; }
|
||||
string const & Info::GetSponsoredDescriptionUrl() const { return m_sponsoredDescriptionUrl; }
|
||||
string const & Info::GetSponsoredReviewUrl() const { return m_sponsoredReviewUrl; }
|
||||
|
||||
string Info::GetRatingFormatted() const
|
||||
{
|
||||
|
|
|
@ -73,6 +73,7 @@ public:
|
|||
|
||||
string const & GetSponsoredUrl() const;
|
||||
string const & GetSponsoredDescriptionUrl() const;
|
||||
string const & GetSponsoredReviewUrl() const;
|
||||
|
||||
/// @returns formatted rating string for booking object, or empty if it isn't booking object
|
||||
string GetRatingFormatted() const;
|
||||
|
@ -121,6 +122,7 @@ public:
|
|||
/// Sponsored feature urls.
|
||||
string m_sponsoredUrl;
|
||||
string m_sponsoredDescriptionUrl;
|
||||
string m_sponsoredReviewUrl;
|
||||
|
||||
/// Which country this MapObject is in.
|
||||
/// For a country point it will be set to topmost node for country.
|
||||
|
|
|
@ -192,6 +192,9 @@ void FillHotelInfo(string const & src, HotelInfo & info)
|
|||
|
||||
auto const reviewsArray = json_object_get(root.get(), "reviews");
|
||||
info.m_reviews = ParseReviews(reviewsArray);
|
||||
|
||||
my::FromJSONObjectOptionalField(root.get(), "reviews_url", info.m_reviewsParamsUrl);
|
||||
ASSERT(!info.m_reviewsParamsUrl.empty(), ("Booking reviews url format was changed!"));
|
||||
}
|
||||
|
||||
void FillPriceAndCurrency(string const & src, string const & currency, string & minPrice,
|
||||
|
@ -273,6 +276,13 @@ string Api::GetDescriptionUrl(string const & baseUrl) const
|
|||
return baseUrl + string("?aid=") + BOOKING_AFFILIATE_ID;
|
||||
}
|
||||
|
||||
string Api::GetHotelReviewsUrl(string const & hotelId, string const & baseUrl) const
|
||||
{
|
||||
ostringstream os;
|
||||
os << GetDescriptionUrl(baseUrl) << "&tab=4&label=hotel-" << hotelId << "_reviews";
|
||||
return os.str();
|
||||
}
|
||||
|
||||
void Api::GetMinPrice(string const & hotelId, string const & currency,
|
||||
GetMinPriceCallback const & fn)
|
||||
{
|
||||
|
|
|
@ -41,6 +41,7 @@ struct HotelInfo
|
|||
vector<HotelPhotoUrls> m_photos;
|
||||
vector<HotelFacility> m_facilities;
|
||||
vector<HotelReview> m_reviews;
|
||||
string m_reviewsParamsUrl;
|
||||
float m_score = 0.0;
|
||||
uint32_t m_scoreCount = 0;
|
||||
};
|
||||
|
@ -60,6 +61,7 @@ class Api
|
|||
public:
|
||||
string GetBookHotelUrl(string const & baseUrl) const;
|
||||
string GetDescriptionUrl(string const & baseUrl) const;
|
||||
string GetHotelReviewsUrl(string const & hotelId, string const & baseUrl) const;
|
||||
// Real-time information methods (used for retriving rapidly changing information).
|
||||
// These methods send requests directly to Booking.
|
||||
void GetMinPrice(string const & hotelId, string const & currency, GetMinPriceCallback const & fn);
|
||||
|
|
Loading…
Add table
Reference in a new issue