def findParkingRatesById(parkingIdentificationCode, id): r = None request = __getFindParkingRatesByIdRequest(parkingIdentificationCode, id) logging.info(object2json(request)) dataEncrypted = encrypt.encrypted(object2json(request)) response = sendRequest(URL_FIND_BY_ID + PARKING_RATES_REQUEST, dataEncrypted) logging.info(response) data = json.loads(response) obj = edict(data) return json2object(obj)
def findFrequencyTypeById(parkingIdentificationCode, id): r = None request = __getFindFrequencyTypeByIdRequest(parkingIdentificationCode, id) logging.info(object2json(request)) dataEncrypted = encrypt.encrypted(object2json(request)) response = sendRequest(URL_FIND_BY_ID + FREQUENCY_TYPE_REQUEST, dataEncrypted) logging.info(response) data = json.loads(response) obj = edict(data) return json2object(obj)
def getAllParkingRates(parkingIdentificationCode): request = __getAllParkingRatesRequest(parkingIdentificationCode) dataEncrypted = encrypt.encrypted(object2json(request)) response = sendRequest(URL_FIND + PARKING_RATES_REQUEST, dataEncrypted) logging.info(response) data = json.loads(response) return json2object(edict(data))
def getAllVehicleType(parkingIdentificationCode): request = __getAllVehicleTypeRequest(parkingIdentificationCode) dataEncrypted = encrypt.encrypted(object2json(request)) response = sendRequest(URL_FIND + VEHICLE_TYPE_REQUEST, dataEncrypted) logging.info(response) data = json.loads(response) return json2object(edict(data))
def removeParkingRate(parkingIdentificationCode, id): r = None request = __getRemoveParkingRateRequest(parkingIdentificationCode, id) logging.info(object2json(request)) dataEncrypted = encrypt.encrypted(object2json(request)) response = sendRequest(URL_REMOVE + PARKING_RATES_REQUEST, dataEncrypted) logging.info(response) data = json.loads(response) obj = edict(data) if (obj.status == "success"): r = obj.status else: r = json2object(obj) return r
def login(user, password): request = getRequest(user, password) dataEncrypted = encrypt.encrypted(object2json(request)) response = sendRequest(URL, dataEncrypted) logging.info(response) data = json.loads(response) obj = json2object(edict(data)) if type(obj) != Error: return obj else: raise LoginException(obj.message)
def updateParkingRates(parkingIdentificationCode, id, vehicleTypeId, frequencyTypeId, amount): r = None request = __getUpdateParkingRatesRequest(parkingIdentificationCode, id, vehicleTypeId, frequencyTypeId, amount) dataEncrypted = encrypt.encrypted(object2json(request)) response = sendRequest(URL_UPDATE + PARKING_RATES_REQUEST, dataEncrypted) logging.info(response) data = json.loads(response) obj = edict(data) if (obj.status == "success"): r = obj.status else: r = json2object(obj) return r
def updateVehicleType(parkingIdentificationCode, id, description): r = None request = __getUpdateVehicleTypeRequest(parkingIdentificationCode, id, description) dataEncrypted = encrypt.encrypted(object2json(request)) response = sendRequest(URL_UPDATE + VEHICLE_TYPE_REQUEST, dataEncrypted) logging.info(response) data = json.loads(response) obj = edict(data) if (obj.status == "success"): r = obj.status else: r = json2object(obj) return r
def saveParkingRate(parkingIdentificationCode, idVehicleSelected, idFrequencySelected, amount): result = None request = __getSaveParkingRateRequest(parkingIdentificationCode, idVehicleSelected, idFrequencySelected, amount) dataEncrypted = encrypt.encrypted(object2json(request)) response = sendRequest(URL_SAVE + PARKING_RATES_REQUEST, dataEncrypted) logging.info(response) data = json.loads(response) obj = edict(data) if (obj.status == "success"): result = obj.status else: result = json2object(obj) return result
def updateFrequencyType(parkingIdentificationCode, id, description, timeType, time, type, priority, combinablePreviousFrequency): r = None request = __getUpdateFrequencyTypeRequest(parkingIdentificationCode, id, description, timeType, time, type, priority, combinablePreviousFrequency) dataEncrypted = encrypt.encrypted(object2json(request)) response = sendRequest(URL_UPDATE + FREQUENCY_TYPE_REQUEST, dataEncrypted) logging.info(response) data = json.loads(response) obj = edict(data) if (obj.status == "success"): r = obj.status else: r = json2object(obj) return r
def createRequestToApplicationRest(): payload = Payload('') request = Request(payload, buildMac(object2json('')), 'HASH-PUBLIC-WEB') return encrypt.encrypted(object2json(request))
def getRequest(user, password): loginRequest = LoginRequest(user, password) payload = Payload(loginRequest) request = Request(payload, buildMac(object2json(loginRequest)), 'HASH-PUBLIC-WEB') return request
def __getFindFrequencyTypeByIdRequest(parkingIdentificationCode, idFrequencyType): frequencyRequest = FrequencyTypeRequest(parkingIdentificationCode=parkingIdentificationCode, idFrequencyType=idFrequencyType) payload = Payload(frequencyRequest) request = Request(payload, buildMac(object2json(frequencyRequest)), 'HASH-PUBLIC-WEB') return request
def __getRemoveVehicleTypeRequest(parkingIdentificationCode, id): vehiclerequest = VehicleTypeRequest(parkingIdentificationCode=parkingIdentificationCode, idFrequencyType=id) payload = Payload(vehiclerequest) request = Request(payload, buildMac(object2json(vehiclerequest)), 'HASH-PUBLIC-WEB') return request
def __getUpdateParkingRatesRequest(parkingIdentificationCode, id, vehicleTypeId, frequencyTypeId, amount): parkingRatesRequest = ParkingRatesRequest(parkingIdentificationCode, id, vehicleTypeId, frequencyTypeId, amount) payload = Payload(parkingRatesRequest) request = Request(payload, buildMac(object2json(parkingRatesRequest)), 'HASH-PUBLIC-WEB') return request
def __getUpdateVehicleTypeRequest(parkingIdentificationCode, id, description): vehiclerequest = VehicleTypeRequest(parkingIdentificationCode, description, id) payload = Payload(vehiclerequest) request = Request(payload, buildMac(object2json(vehiclerequest)), 'HASH-PUBLIC-WEB') return request
def __getAllVehicleTypeRequest(parkingIdentificationCode): vehiclerequest = VehicleTypeRequest(parkingIdentificationCode) payload = Payload(vehiclerequest) request = Request(payload, buildMac(object2json(vehiclerequest)), 'HASH-PUBLIC-WEB') return request
def __getFindParkingRatesByIdRequest(parkingIdentificationCode, idParkingRate): parkingRatesRequest = ParkingRatesRequest(parkingIdentificationCode=parkingIdentificationCode, idParkingRate=idParkingRate) payload = Payload(parkingRatesRequest) request = Request(payload, buildMac(object2json(parkingRatesRequest)), 'HASH-PUBLIC-WEB') return request
def __getAllFrequencyTypeRequest(parkingIdentificationCode): frequencyrequest = FrequencyTypeRequest(parkingIdentificationCode) payload = Payload(frequencyrequest) request = Request(payload, buildMac(object2json(frequencyrequest)), 'HASH-PUBLIC-WEB') return request
def __getSaveParkingRateRequest(parkingIdentificationCode, idVehicleSelected, idFrequencySelected, amount): parkingRateRequest = ParkingRatesRequest(parkingIdentificationCode, None, idVehicleSelected, idFrequencySelected, amount) payload = Payload(parkingRateRequest) request = Request(payload, buildMac(object2json(parkingRateRequest)), 'HASH-PUBLIC-WEB') return request
def __getUpdateFrequencyTypeRequest(parkingIdentificationCode, id, description, timeType, time, type, priority, combinablePreviousFrequency): frequencyRequest = FrequencyTypeRequest(parkingIdentificationCode, id, description, timeType, time, type, priority, combinablePreviousFrequency) payload = Payload(frequencyRequest) request = Request(payload, buildMac(object2json(frequencyRequest)), 'HASH-PUBLIC-WEB') return request