Exemplo n.º 1
0
    def create(cls, template_id, template_fields_model_dict):
        """
        Create new Pass from specified template.

        API call used is v1/pass/<template_id> (POST)

        @type template_id: int
        @param template_id: ID of the template used to create new pass
        @type template_fields_model_dict: dict
        @param template_fields_model_dict: template_fields_model dict of the template used to create new pass
        @return: json form of template full-form description
        """

        request_url = "/pass/%d" % int(template_id)
        request_dict = {"json": json.dumps(template_fields_model_dict, encoding="ISO-8859-1")}
        return pt_client.pt_post(request_url, request_dict)
Exemplo n.º 2
0
    def add_locations(cls, pass_id, location_list):
        """
        add locations to an existing pass

        API call used is v1/pass/<pass_id>/locations (POST)

        @type pass_id: int
        @param pass_id: ID of the pass to add locations to
        @type location_list: list
        @param location_list: list of locations to add
        @return: json form of response data
        """

        request_url = "/pass/%d/locations" % int(pass_id)
        request_dict = {"json": json.dumps(location_list, encoding="ISO-8859-1")}
        return pt_client.pt_post(request_url, request_dict)