Add fetch_category_names to Eviivo, QBook and Mews profiles
- Eviivo: no-dates page fetch returns all room types with data-item-name and
data-rate-plan-name; single request populates the full name catalogue
- QBook: item_name already in /api/pull response; extracted on a dummy date
call; no distinct rate plan names exposed so rate_labels left empty
- Mews: getCalendarData (bookingEngineId field) returns resourceCategories[].name
and rates[].name as {en-US: ...} dicts; both room and rate labels populated
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
c2e1a9703a
commit
68e8a6883b
3 changed files with 89 additions and 0 deletions
|
|
@ -91,6 +91,40 @@ class MewsProfile(BaseProfile):
|
|||
return {"booking_engine_id": m.group(1)}
|
||||
return None
|
||||
|
||||
async def fetch_category_names(self, client, params: dict) -> tuple[dict, dict]:
|
||||
if not await _ensure_config(client, params):
|
||||
return {}, {}
|
||||
tz = params.get("_tz", ZoneInfo("Europe/London"))
|
||||
today = date.today()
|
||||
r = await client.post(
|
||||
f"{API_BASE}/services/getCalendarData",
|
||||
json={
|
||||
"bookingEngineId": params["booking_engine_id"],
|
||||
"serviceId": params["service_id"],
|
||||
"startUtc": _midnight_utc(today, tz),
|
||||
"endUtc": _midnight_utc(today + timedelta(days=7), tz),
|
||||
"client": CLIENT,
|
||||
"session": _session(),
|
||||
},
|
||||
headers=HEADERS,
|
||||
timeout=20,
|
||||
)
|
||||
if r.status_code != 200:
|
||||
return {}, {}
|
||||
data = r.json()
|
||||
lang = "en-US"
|
||||
room_names = {
|
||||
cat["id"]: cat["name"].get(lang, cat["id"])
|
||||
for cat in data.get("resourceCategories", [])
|
||||
if "name" in cat
|
||||
}
|
||||
rate_names = {
|
||||
rate["id"]: rate["name"].get(lang, rate["id"])
|
||||
for rate in data.get("rates", [])
|
||||
if "name" in rate
|
||||
}
|
||||
return room_names, rate_names
|
||||
|
||||
async def fetch_arrival_dates(self, client, params: dict) -> list[str]:
|
||||
if not await _ensure_config(client, params):
|
||||
return []
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue