def update_restaurant(self, name, main_image, description=None, city=None): """ Update a restaurant. :return: SdkResponse """ params = parse_args(name=name, description=description, city=city) files = parse_args(mainImage=main_image) return self._http_request("PUT", self.API_RESTAURANTS_URL_PATH, body_params=params, files=files, render=MultiPartRenderer())
def create_restaurant(self, name, description=None, city=None): """ Create a restaurant. :return: SdkResponse """ params = parse_args(name=name, description=description, city=city) return self._http_request("POST", self.API_RESTAURANTS_URL_PATH, body_params=params, render=FormRenderer())
def create_item(self, name, description=None, city=None): """ Create an item. :return: SdkResponse """ params = parse_args(name=name, description=description) return self.post(self.API_ITEMS_URL_PATH, body_params=params)
def update_item(self, item_id, name, description=None): """ Update an item. :return: SdkResponse """ params = parse_args(name=name, description=description) return self.put(self.API_ITEMS_URL_PATH + safe_add_end_slash(item_id), body_params=params)
def create_item(self, name, description=None): """ Create an item. :param name: str :param description: str (optional) :return: SdkResponse """ params = parse_args(name=name, description=description) return self._http_request("POST", self.API_ITEMS_URL_PATH, body_params=params)
def update_item(self, item_id, name, description=None): """ Update an item. :param item_id: int :param name: str :param description: str (optional) :return: SdkResponse """ params = parse_args(name=name, description=description) return self._http_request("PUT", "%s%d/" % (self.API_ITEMS_URL_PATH, item_id), body_params=params)
def login(self, **kwargs): """ Login abstract method with default implementation. :param kwargs: parameters :return: SdkResponse """ assert self.LOGIN_URL_PATH is not None render_name = kwargs.pop("render", "json") render = get_renderer(render_name) params = parse_args(**kwargs) return self.post(self.LOGIN_URL_PATH, body_params=params, render=render)
def create_file_11paths_auth(self, filename, file_stream, app_id, secret, description=None, name=None): """ Create a file using 11paths authentication. :return: SdkResponse """ auth = (X11PathsAuthentication(app_id, secret), ) params = parse_args(name=name, description=description) return self.post(self.API_FILE_URL_PATH, body_params=params, files={"file": (filename, file_stream)}, authentication_instances=auth, host="https://latch.elevenpaths.com")