def write(self):
        """
        Create or update the Ticket on Assembla
        """
        if not hasattr(self, 'space'):
            raise AttributeError("A ticket must have a 'space' attribute before you can write it to Assembla.")

        if self.get('number'):  # Modifying an existing ticket
            method = self.space.api._put_json
        else:  # Creating a new ticket
            method = self.space.api._post_json

        return method(
            self,
            space=self.space,
            rel_path=self.space._build_rel_path('tickets'),
        )