Skip to content

Commit 34cd577

Browse files
authored
Tnr 2038 cancel reservation (#31)
* Added reservations-abandoned endpoint. * Added a docstring. * Updated a docstring. * Version bump. * Updated docstrings to match standard. * Add discount_id conditionally upon its existence. * Added get blocklist entries for testing. * Added paging parameter. * Improved docstring. * Updated version. * Fixed name.
1 parent 337938f commit 34cd577

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
setup(
44
name='VacasaConnect',
5-
version='0.7.1',
5+
version='0.6.3',
66
description='A Python 3.6 SDK for the connect.vacasa.com API.',
77
packages=['vacasa.connect'],
88
url='https://github.com/Vacasa/python-vacasa-connect-sdk',

vacasa/connect/connect.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,7 @@ def create_reservation(self,
732732

733733
return self._post(url, json={'data': {'attributes': payload}}, headers=headers).json()
734734

735-
def created_cancelled_reservation(self,
735+
def create_cancelled_reservation(self,
736736
unit_id: int,
737737
arrival: str,
738738
departure: str,
@@ -786,7 +786,6 @@ def created_cancelled_reservation(self,
786786
'children': children,
787787
'cleaning_fees': cleaning_fees,
788788
'last_night': departure,
789-
'discount_id': discount_id,
790789
'fee_amount': fee_amount,
791790
'first_name': first_name,
792791
'last_name': last_name,
@@ -800,6 +799,10 @@ def created_cancelled_reservation(self,
800799
'unit_id': unit_id,
801800
}
802801

802+
# The discount_id is optional. Add it if we've got it.
803+
if discount_id:
804+
payload['discount_id'] = discount_id
805+
803806
return self._post(url, json={'data': {'attributes': payload}}, headers=headers).json()
804807

805808
def create_blocklist_entry(self,
@@ -841,6 +844,21 @@ def create_blocklist_entry(self,
841844

842845
return self._post(url, json={'data': {'attributes': payload, 'type': 'blocklists'}}, headers=headers).json()
843846

847+
def get_blocklist_entries(self, page_number=0) -> dict:
848+
"""
849+
Args:
850+
page_number: An int used to specify a page of blocklist data.
851+
852+
Returns: dict
853+
"""
854+
855+
url = f"{self.endpoint}/v1/blocklists"
856+
if page_number:
857+
url += "?page[number]=" + str(page_number)
858+
headers = self._headers()
859+
860+
return self._get(url, headers=headers).json()
861+
844862

845863
def add_reservation_guests(self,
846864
reservation_id: int,

0 commit comments

Comments
 (0)