From 3c60e2828fdbb20d9c16a21ca092f20b83797c21 Mon Sep 17 00:00:00 2001 From: Artyom Date: Wed, 18 Apr 2018 11:44:33 +0300 Subject: [PATCH 1/2] update StationClarifying --- onelya_sdk/wrapper/__init__.py | 11 ++--------- setup.py | 2 +- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/onelya_sdk/wrapper/__init__.py b/onelya_sdk/wrapper/__init__.py index 09b6f3c..46d918b 100644 --- a/onelya_sdk/wrapper/__init__.py +++ b/onelya_sdk/wrapper/__init__.py @@ -19,15 +19,8 @@ def __init__(self, json_data): class StationClarifying(object): def __init__(self, json_data): - self.station_type = StationType(json_data.get('StationType')) - - self.json_data = json_data - - -class StationType(object): - def __init__(self, json_data): - self.origin = json_data.get('Origin') - self.destination = [StationInfo(station_info) for station_info in json_data.get('Destination')] + self.station_type = json_data.get('StationType') + self.station_options = get_array(json_data.get('StationOptions'), StationInfo) self.json_data = json_data diff --git a/setup.py b/setup.py index 472ce51..1658b1d 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ from setuptools import setup, find_packages -__version__ = '1.2.2' +__version__ = '1.2.3' setup( version=__version__, From 51099cf983336f5b3d04fe7c040d4b9e34db64f3 Mon Sep 17 00:00:00 2001 From: Artyom Date: Tue, 8 May 2018 12:15:39 +0300 Subject: [PATCH 2/2] add json_data to requests --- .../aeroexpress/reservation/requests.py | 27 ++++++++++ onelya_sdk/railway/reservation/requests.py | 49 +++++++++++++++++++ setup.py | 2 +- 3 files changed, 77 insertions(+), 1 deletion(-) diff --git a/onelya_sdk/aeroexpress/reservation/requests.py b/onelya_sdk/aeroexpress/reservation/requests.py index a554cf5..e4f6fb4 100644 --- a/onelya_sdk/aeroexpress/reservation/requests.py +++ b/onelya_sdk/aeroexpress/reservation/requests.py @@ -27,6 +27,21 @@ def __init__(self, document_number: str, document_type: DocumentType, first_name self.birth_place = birth_place self.birthday = birthday + self.json_data = { + 'type': self.type, + 'document_number': self.document_number, + 'document_type': self.document_type, + 'first_name': self.first_name, + 'last_name': self.last_name, + 'sex': self.sex, + 'index': self.index, + 'middle_name': self.middle_name, + 'document_valid_till': self.document_valid_till, + 'citizenship_code': self.citizenship_code, + 'birth_place': self.birth_place, + 'birthday': self.birthday + } + class AeroexpressReservationRequest(object): def __init__(self, tariff_id: str, departure_date: datetime, passengers: 'list of int', index: int, @@ -42,6 +57,18 @@ def __init__(self, tariff_id: str, departure_date: datetime, passengers: 'list o self.agent_reference_id = agent_reference_id self.agent_payment_id = agent_payment_id + self.json_data = { + 'type': self.type, + 'tariff_id': self.tariff_id, + 'departure_date': self.departure_date, + 'passengers': [item.order_customer_index for item in self.passengers], + 'index': self.index, + 'schedule_id': self.schedule_id, + 'provider_payment_form': self.provider_payment_form, + 'agent_reference_id': self.agent_reference_id, + 'agent_payment_id': self.agent_payment_id + } + class OrderCustomerDocuments(object): def __init__(self, order_customer_id: int=None, document_number: str=None, document_type: DocumentType=None, diff --git a/onelya_sdk/railway/reservation/requests.py b/onelya_sdk/railway/reservation/requests.py index f9bbef4..f017cfb 100644 --- a/onelya_sdk/railway/reservation/requests.py +++ b/onelya_sdk/railway/reservation/requests.py @@ -14,6 +14,14 @@ def __init__(self, category: RailwayPassengerCategory, order_customer_index: int self.railway_bonus_cards = railway_bonus_cards self.is_invalid = is_invalid + self.json_data = { + 'category': self.category, + 'order_customer_index': self.order_customer_index, + 'preferred_adult_tariff_type': self.preferred_adult_tariff_type, + 'railway_bonus_cards': self.railway_bonus_cards, + 'is_invalid': self.is_invalid + } + class RailwayBonusCardInfo(object): def __init__(self, card_number: str, car_type: RzhdCardTypes=None): @@ -38,6 +46,21 @@ def __init__(self, document_number: str, document_type: DocumentType, first_name self.birth_place = birth_place self.birthday = birthday + self.json_data = { + 'type': self.type, + 'document_number': self.document_number, + 'document_type': self.document_type, + 'first_name': self.first_name, + 'last_name': self.last_name, + 'sex': self.sex, + 'index': self.index, + 'middle_name': self.middle_name, + 'document_valid_till': self.document_valid_till, + 'citizenship_code': self.citizenship_code, + 'birth_place': self.birth_place, + 'birthday': self.birthday + } + class RailwayReservationRequest(object): def __init__(self, origin_code: str, destination_code: str, departure_date: datetime, train_number: str, @@ -72,6 +95,32 @@ def __init__(self, origin_code: str, destination_code: str, departure_date: date self.agent_reference_id = agent_reference_id self.agent_payment_id = agent_payment_id + self.json_data = { + 'type': self.type, + 'origin_code': self.origin_code, + 'destination_code': self.destination_code, + 'departure_date': self.departure_date, + 'train_number': self.train_number, + 'car_type': self.car_type, + 'passengers': [item.json_data for item in self.passengers], + 'index': self.index, + 'car_number': self.car_number, + 'lower_place_quantity': self.lower_place_quantity, + 'upper_place_quantity': self.upper_place_quantity, + 'cabin_gender_kind': self.cabin_gender_kind, + 'car_storey': self.car_storey, + 'place_range': self.place_range, + 'cabin_place_demands': self.cabin_place_demands, + 'set_electronic_registration': self.set_electronic_registration, + 'bedding': self.bedding, + 'service_class': self.service_class, + 'international_service_class': self.international_service_class, + 'additional_place_requirements': self.additional_place_requirements, + 'provider_payment_form': self.provider_payment_form, + 'agent_reference_id': self.agent_reference_id, + 'agent_payment_id': self.agent_payment_id + } + class OrderCustomerDocuments(object): def __init__(self, order_customer_id: int=None, document_number: str=None, document_type: DocumentType=None, diff --git a/setup.py b/setup.py index 1658b1d..8693399 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ from setuptools import setup, find_packages -__version__ = '1.2.3' +__version__ = '1.2.4' setup( version=__version__,