def __init__(self, attrs={}, client=API.client()): self.client = client self._do_attributes(attrs)
def retrieve(cls, id, client=API.client()): return cls(attrs={"id":id},client=client).refresh()
def create(cls, checkout_token, client=API.client()): response = client.make_request("/charges", "post", checkout_token=checkout_token) if response.is_success(): return cls(attrs=response.body(), client=client) else: raise ChargeError.from_response(response)