Skip to content

Commit

Permalink
[core][taxi] yango taxi is added
Browse files Browse the repository at this point in the history
  • Loading branch information
Arsentiy Milchakov authored and beloal committed Sep 7, 2020
1 parent f940951 commit fb06901
Show file tree
Hide file tree
Showing 8 changed files with 90 additions and 0 deletions.
44 changes: 44 additions & 0 deletions data/taxi_places/yango.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"disabled": {
"countries": [],
"mwms": []
},
"enabled": {
"countries": [
{
"cities": [
"Accra"
],
"id": "Ghana"
},
{
"cities": [
"Abidjan"
],
"id": "Cote dIvoire"
},
{
"cities": [
"Bucharest"
],
"id": "Romania"
},
{
"cities": [
"Helsinki"
],
"id": "Finland"
},
{
"cities": [
"Haifa",
"Ashkelon",
"Be'er Sheva",
"Tel Aviv-Yafo"
],
"id": "Israel Region"
}
],
"mwms": []
}
}
2 changes: 2 additions & 0 deletions partners_api/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ set(
utm.hpp
yandex_api.cpp
yandex_api.hpp
yango_api.cpp
yango_api.hpp
)

omim_add_library(${PROJECT_NAME} ${SRC})
Expand Down
2 changes: 2 additions & 0 deletions partners_api/taxi_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "partners_api/taxi_places_loader.hpp"
#include "partners_api/uber_api.hpp"
#include "partners_api/yandex_api.hpp"
#include "partners_api/yango_api.hpp"

#include "geometry/latlon.hpp"
#include "geometry/mercator.hpp"
Expand Down Expand Up @@ -120,6 +121,7 @@ Engine::Engine(std::vector<ProviderUrl> urls /* = {} */)
{
AddApi<yandex::Api>(urls, Provider::Type::Yandex);
AddApi<freenow::Api>(urls, Provider::Type::Freenow);
AddApi<yango::Api>(urls, Provider::Type::Yango);
}

void Engine::SetDelegate(std::unique_ptr<Delegate> delegate)
Expand Down
1 change: 1 addition & 0 deletions partners_api/taxi_places_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ std::string Loader::GetFileNameByProvider(Provider::Type const type)
case Provider::Type::Uber: return "taxi_places/uber.json";
case Provider::Type::Yandex: return "taxi_places/yandex.json";
case Provider::Type::Freenow: return "taxi_places/freenow.json";
case Provider::Type::Yango: return "taxi_places/yango.json";
case Provider::Type::Count: LOG(LERROR, ("Incorrect taxi provider")); return "";
}
UNREACHABLE();
Expand Down
2 changes: 2 additions & 0 deletions partners_api/taxi_provider.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class Provider
Maxim,
Rutaxi,
Freenow,
Yango,
Count
};

Expand Down Expand Up @@ -84,6 +85,7 @@ inline std::string DebugPrint(Provider::Type type)
case Provider::Type::Maxim: return "Maxim";
case Provider::Type::Rutaxi: return "Rutaxi";
case Provider::Type::Freenow: return "Freenow";
case Provider::Type::Yango: return "Yango";
case Provider::Type::Count: ASSERT(false, ()); return "";
}
UNREACHABLE();
Expand Down
17 changes: 17 additions & 0 deletions partners_api/yango_api.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include "partners_api/yango_api.hpp"

namespace taxi::yango
{
RideRequestLinks Api::GetRideRequestLinks(std::string const & productId, ms::LatLon const & from,
ms::LatLon const & to) const
{
std::ostringstream link;

link << "https://2187871.redirect.appmetrica.yandex.com/route?start-lat=" << from.m_lat
<< "&start-lon=" << from.m_lon << "&end-lat=" << to.m_lat << "&end-lon=" << to.m_lon
<< "&utm_source=mapsme&utm_medium=none&ref=8d20bf0f9e4749c48822358cdaf6a6c7"
"&appmetrica_tracking_id=1179283486394045767&level=50";

return {link.str(), link.str()};;
}
} // namespace taxi::yango
17 changes: 17 additions & 0 deletions partners_api/yango_api.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#pragma once

#include "partners_api/taxi_base.hpp"
#include "partners_api/yandex_api.hpp"

namespace taxi::yango
{
class Api : public yandex::Api
{
public:
explicit Api(std::string const & baseUrl = yandex::kTaxiInfoUrl) : yandex::Api(baseUrl) {}

/// Returns link which allows you to launch the Yandex app.
RideRequestLinks GetRideRequestLinks(std::string const & productId, ms::LatLon const & from,
ms::LatLon const & to) const override;
};
} // namespace taxi::yango
5 changes: 5 additions & 0 deletions tools/python/jsons.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,30 +299,35 @@
"distance": 6888.846981748964,
"options": [
{
"class_level": 50,
"class_name": "econom",
"min_price": 129,
"price": 344,
"waiting_time": 527.8793726078095
},
{
"class_level": 70,
"class_name": "business",
"min_price": 239,
"price": 504,
"waiting_time": 76.37023611385494
},
{
"class_level": 100,
"class_name": "comfortplus",
"min_price": 239,
"price": 557,
"waiting_time": 99.0058955445591
},
{
"class_level": 200,
"class_name": "minivan",
"min_price": 239,
"price": 532,
"waiting_time": 322.77413167989687
},
{
"class_level": 300,
"class_name": "vip",
"min_price": 359,
"price": 799,
Expand Down

0 comments on commit fb06901

Please sign in to comment.