@@ -27,20 +27,20 @@ class Client(object):
27
27
])
28
28
29
29
@staticmethod
30
- def validateApiEndpoint (api_endpoint ):
30
+ def validate_api_endpoint (api_endpoint ):
31
31
return api_endpoint .strip ().rstrip ('/' )
32
32
33
33
@staticmethod
34
- def validateApiKey (api_key ):
34
+ def validate_api_key (api_key ):
35
35
api_key = api_key .strip ()
36
36
if not re .compile (r'^(live|test)_\w+$' ).match (api_key ):
37
37
raise Error ('Invalid API key: "%s". An API key must start with "test_" or "live_".' % api_key )
38
38
return api_key
39
39
40
40
def __init__ (self , api_key = None , api_endpoint = None ):
41
- self .api_endpoint = self .validateApiEndpoint (api_endpoint or self .API_ENDPOINT )
41
+ self .api_endpoint = self .validate_api_endpoint (api_endpoint or self .API_ENDPOINT )
42
42
self .api_version = self .API_VERSION
43
- self .api_key = self .validateApiKey (api_key ) if api_key else None
43
+ self .api_key = self .validate_api_key (api_key ) if api_key else None
44
44
self .payments = resources .Payments (self )
45
45
self .payment_refunds = resources .PaymentRefunds (self )
46
46
self .payment_chargebacks = resources .PaymentChargebacks (self )
@@ -53,22 +53,22 @@ def __init__(self, api_key=None, api_endpoint=None):
53
53
self .customer_subscriptions = resources .CustomerSubscriptions (self )
54
54
self .customer_payments = resources .CustomerPayments (self )
55
55
56
- def getApiEndpoint (self ):
56
+ def get_api_endpoint (self ):
57
57
return self .api_endpoint
58
58
59
- def setApiEndpoint (self , api_endpoint ):
60
- self .api_endpoint = self .validateApiEndpoint (api_endpoint )
59
+ def set_api_endpoint (self , api_endpoint ):
60
+ self .api_endpoint = self .validate_api_endpoint (api_endpoint )
61
61
62
- def setApiKey (self , api_key ):
63
- self .api_key = self .validateApiKey (api_key )
62
+ def set_api_key (self , api_key ):
63
+ self .api_key = self .validate_api_key (api_key )
64
64
65
- def getCACert (self ):
65
+ def get_cacert (self ):
66
66
cacert = pkg_resources .resource_filename ('mollie.api' , 'cacert.pem' )
67
67
if not cacert or len (cacert ) < 1 :
68
68
raise Error ('Unable to load cacert.pem' )
69
69
return cacert
70
70
71
- def performHttpCall (self , http_method , path , data = None , params = None ):
71
+ def perform_http_call (self , http_method , path , data = None , params = None ):
72
72
if not self .api_key :
73
73
raise Error ('You have not set an API key. Please use setApiKey() to set the API key.' )
74
74
url = '%s/%s/%s' % (self .api_endpoint , self .api_version , path )
@@ -82,7 +82,7 @@ def performHttpCall(self, http_method, path, data=None, params=None):
82
82
try :
83
83
response = requests .request (
84
84
http_method , url ,
85
- verify = self .getCACert (),
85
+ verify = self .get_cacert (),
86
86
headers = {
87
87
'Accept' : 'application/json' ,
88
88
'Authorization' : 'Bearer ' + self .api_key ,
0 commit comments