39 lines
1.4 KiB
Python
39 lines
1.4 KiB
Python
from .base_plugin import BasePMSPlugin
|
|
import requests
|
|
|
|
class EcviPMS(BasePMSPlugin):
|
|
"""
|
|
Плагин для PMS ECVI.
|
|
"""
|
|
def _fetch_data(self):
|
|
print("Fetching data from Ecvi PMS...")
|
|
# Реализация метода получения данных из PMS Shelter
|
|
response = requests.get(self.pms_config.url, headers={"Authorization": f"Bearer {self.pms_config.token}"})
|
|
print("Response status:", response.status_code)
|
|
response.raise_for_status()
|
|
data = response.json()
|
|
print("Number of rooms:", len(data))
|
|
return data
|
|
json_schema = {
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {"type": "integer"},
|
|
"number": {"type": "integer"},
|
|
"roomTypeName": {"type": "string"},
|
|
"checkInStatus": {"type": "string"},
|
|
"guests": {"type": "array"},
|
|
},
|
|
"required": ["id", "number", "roomTypeName", "checkInStatus", "guests"]
|
|
}
|
|
def get_default_parser_settings(self):
|
|
"""
|
|
Возвращает настройки парсера по умолчанию.
|
|
"""
|
|
return {
|
|
"field_mapping": {
|
|
"room_name": "roomNumber",
|
|
"check_in": "from",
|
|
"check_out": "until",
|
|
},
|
|
"date_format": "%Y-%m-%dT%H:%M:%S"
|
|
} |