Skip to content

Commit d6f0639

Browse files
author
Jakub Reczko
committed
Added Customer namespace
1 parent a077fc8 commit d6f0639

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

voucherify/client.py

+39
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,48 @@ def request(self, path, method='GET', **kwargs):
4848
return result
4949

5050

51+
class Customer(VoucherifyRequest):
52+
def __init__(self, *args, **kwargs):
53+
super(Customer, self).__init__(*args, **kwargs)
54+
55+
def create(self, customer):
56+
path = '/customers/'
57+
58+
return self.request(
59+
path,
60+
data=json.dumps(customer),
61+
method='POST'
62+
)
63+
64+
def fetch(self, customer_id):
65+
path = '/customers/' + quote(customer_id)
66+
67+
return self.request(
68+
path
69+
)
70+
71+
def update(self, customer):
72+
path = '/customers/'
73+
74+
return self.request(
75+
path,
76+
data=json.dumps(customer),
77+
method='PUT'
78+
)
79+
80+
def delete(self, customer_id):
81+
path = '/customers/' + quote(customer_id)
82+
83+
return self.request(
84+
path,
85+
method='DELETE'
86+
)
87+
88+
5189
class Client(VoucherifyRequest):
5290
def __init__(self, *args, **kwargs):
5391
super(Client, self).__init__(*args, **kwargs)
92+
self.customer = Customer(*args, **kwargs)
5493

5594
def list(self, query):
5695
path = '/vouchers/'

0 commit comments

Comments
 (0)