def save(self): """Persist pending changes """ endpoint = make_endpoint(self) encoded = self.encode() prepared_data = self.prepare_save(encoded) self.api.put(endpoint, prepared_data) self._persisted_data = encoded
def refresh(self): data = self.api.get(make_endpoint(self)) decoded = self.__class__.decode(data) self._update(decoded)
def test_make_endpoint_child(self): from repose.utilities import make_endpoint user = User(**USER_DATA) post = Post(**USER_DATA['posts'][0]) post.parent_resource = user self.assertEqual(make_endpoint(post), '/user/1/post/10')
def test_make_endpoint(self): from repose.utilities import make_endpoint user = User(**USER_DATA) self.assertEqual(make_endpoint(user), '/user/1')