Skip to content

Commit 0482431

Browse files
author
Ilya Nevolin
committed
group appointment endpoint
1 parent 281339c commit 0482431

File tree

3 files changed

+40
-1
lines changed

3 files changed

+40
-1
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def find_package_modules(self, package, package_dir):
1717

1818
setup(
1919
name='Spurwing',
20-
version='1.0.5',
20+
version='1.0.6',
2121
author='Ilya Nevolin',
2222
author_email='ilya@spurwing.io',
2323
packages=find_packages(),

spurwing/Client.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ def complete_booking(provider_id, appointment_type_id, email, first_name, last_n
4343
'video_chat_url': video_chat_url,
4444
'contact_type': contact_type })
4545

46+
def create_group_appointment(authorization, provider_id, appointment_type_id, datetime):
47+
return HTTP('POST', 'appointments',
48+
data={
49+
'provider_id':provider_id,
50+
'appointment_type_id': appointment_type_id,
51+
'datetime': datetime },
52+
headers={ 'authorization': 'Bearer ' + authorization })
53+
4654
def list_appointments(authorization, page_size, offset, appointment_category=None, load_attendees=None, load_providers=None, load_appointment_type=None):
4755
return HTTP('GET', 'appointments',
4856
params={

spurwing/test_api.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,37 @@ def test_2():
6363
assert 'data' in A
6464
assert 'appointments' in A['data']
6565

66+
@runner
67+
def test_3():
68+
A = sp.get_appointment_types(PID)
69+
log(A)
70+
assert len(A) >= 1
71+
72+
appointment_type_id=A[3]['id']
73+
74+
B = sp.create_group_appointment(KEY, PID, appointment_type_id, dateTomorrow())
75+
log(B)
76+
assert 'data' in B
77+
assert 'appointment' in B['data']
78+
assert 'id' in B['data']['appointment']
79+
apid = B['data']['appointment']['id']
80+
81+
def add_attendee(fn, ln, email):
82+
D = sp.complete_booking(PID, appointment_type_id, email, fn, ln, appointment_id=apid)
83+
log(D)
84+
assert 'appointment' in D
85+
add_attendee('john', 'G', 'john@nevolin.be')
86+
add_attendee('bill', 'H', 'bill@nevolin.be')
87+
88+
E = sp.list_appointments(KEY, 1000, 0)
89+
log(E)
90+
91+
F = sp.delete_appointment(KEY, apid)
92+
log(F)
93+
assert 'data' in F
94+
assert 'appointment' in F['data']
95+
assert F['data']['appointment']['id'] == apid
96+
assert len(F['errors']) == 0
6697

6798
from datetime import date, timedelta
6899
def dateNow():

0 commit comments

Comments
 (0)