def _build_instance_url(cls, sid): if not sid: return "/v1/accounts/me/" sid = util.utf8(sid) base = cls.class_url() extn = quote_plus(sid) return "%s/%s" % (base, extn)
def retrieve(self, id, **params): base = self.get('url') id = util.utf8(id) extn = quote_plus(id) url = "%s/%s" % (base, extn) return self.request('get', url, params)
def _build_instance_url(cls, sid): if not sid: return cls.class_url() base = cls.class_logs_url() sid = util.utf8(sid) extn = quote_plus(sid) if sid is not None: extn = extn + "/" return "%s/%s" % (base, extn)
def _build_instance_url(cls, sid): if not sid: return "/v1/accounts/customers/" base = "/v1/accounts/customer" sid = util.utf8(sid) extn = quote_plus(sid) if sid is not None: extn = extn + "/" return "%s/%s" % (base, extn)
def _build_instance_url(cls, sid): if not sid: return "/v1/plans/subscriptions/" base = cls.class_url() sid = util.utf8(sid) extn = quote_plus(sid) if sid is not None: extn = extn + "/" return "%s/%s" % (base, extn)
def delete(self, **params): base = '/v1/plans/un-subscribe' sid = self.get('subscription_id') sid = util.utf8(sid) extn = quote_plus(sid) if sid is not None: extn = extn + "/" url = "%s/%s" % (base, extn) self.refresh_from(self.request('delete', url, params)) return self
def instance_url(self): id = self.get('id') if not isinstance(id, six.string_types): raise error.InvalidRequestError( 'Could not determine which URL to request: %s instance ' 'has invalid ID: %r, %s. ID should be of type `str` (or' ' `unicode`)' % (type(self).__name__, id, type(id)), 'id') id = util.utf8(id) base = self.class_url() extn = quote_plus(id) if id is not None: extn = extn + "/" return "%s%s" % (base, extn)
def nested_resource_url(cls, id, nested_id=None): url = "%s/%s/%s" % (cls.class_url(), quote_plus(id), quote_plus(path)) if nested_id is not None: url += "/%s" % quote_plus(nested_id) return url
def class_name(cls): if cls == APIResource: raise NotImplementedError( 'APIResource is an abstract class. You should perform ' 'actions on its subclasses (e.g. Charge, Customer)') return str(quote_plus(cls.__name__.lower()))