def token(**params): requestor = api_requestor.APIRequestor(api_base=connect_api_base) params['grant_type'] = 'client_credentials' response, access_token = requestor.request('post', '/authentication/token/', params, None) return response
def list(cls, access_token=None, **params): requestor = api_requestor.APIRequestor(access_token, api_base=cls.api_base()) url = cls.class_logs_url() response, access_token = requestor.request('get', url, params) gpayments_object = util.convert_to_gpayments_object( response, access_token) return gpayments_object
def subscribe(self, client_id, access_token=None): requestor = api_requestor.APIRequestor(access_token) url = '/v1/plans/subscribe/' params = {'customer_key': client_id, 'plan_key': self.key} headers = None response, access_token = requestor.request('post', url, params, headers) return util.convert_to_gpayments_object(response, access_token)
def create(cls, access_token=None, **params): requestor = api_requestor.APIRequestor(access_token) url = cls.class_url() headers = None response, access_token = requestor.request('post', url, params, headers) return util.convert_to_gpayments_object(response, access_token)
def cancel_subscription(self, idempotency_key=None, **params): warnings.warn( 'The `cancel_subscription` method is deprecated. Instead, use the ' '`subscriptions` resource on the customer object to cancel a ' 'subscription', DeprecationWarning) requestor = api_requestor.APIRequestor(self.api_key) url = self.instance_url() + '/subscription' headers = None response, api_key = requestor.request('delete', url, params, headers) self.refresh_from({'subscription': response}, api_key, True) return self.subscription
def deauthorize(**params): requestor = api_requestor.APIRequestor(api_base=connect_api_base) OAuth._set_client_id(params) response, access_token = requestor.request( 'post', '/authentication/deauthorize', params, None) return response
def nested_resource_request(cls, method, url, api_key=None, **params): requestor = api_requestor.APIRequestor(api_key) headers = None response, api_key = requestor.request(method, url, params, headers) return util.convert_to_gpayments_object(response, api_key)