File tree 2 files changed +31
-0
lines changed
2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change
1
+ import json
2
+
3
+ from clients .restful_booker .base_client import BaseClient
4
+ from config import BASE_URI
5
+ from utils .request import APIRequest
6
+
7
+
8
+ class RestfulBookerClient (BaseClient ):
9
+ def __init__ (self ):
10
+ super ().__init__ ()
11
+ self .base_url = BASE_URI
12
+ self .request = APIRequest ()
13
+
14
+ def create_booking (self , payload ):
15
+ return self .request .post_request (
16
+ self .base_url , json .dumps (payload ), self .headers
17
+ )
18
+
19
+ def get_booking (self , booking_id ):
20
+ url = f"{ BASE_URI } /{ booking_id } "
21
+ return self .request .get_request (url , self .headers )
22
+
23
+ def update_booking (self , booking_id , payload ):
24
+ url = f"{ BASE_URI } /{ booking_id } "
25
+ return self .request .put_request (
26
+ url , json .dumps (payload ), self .headers_with_basic_auth
27
+ )
28
+
29
+ def delete_booking (self , booking_id ):
30
+ url = f"{ BASE_URI } /{ booking_id } "
31
+ return self .request .delete_request (url , self .headers_with_basic_auth )
You can’t perform that action at this time.
0 commit comments