Ejemplo n.º 1
0
def readThermostat(thermostat_id=False):
    requestparams={'thermostat_id' :thermostat_id}
    contextparams={}
    if thermostat_id is False:
        raise Exception("thermostat_id cannot be empty")
    result = invoke( 'GET', 'thermostat', requestparams,contextparams)
    return result
Ejemplo n.º 2
0
def updateThermostat(thermostat_id=None,guid=None):
    requestparams={'thermostat_id':thermostat_id}
    requestparams.update(request.json)
    contextparams={'guid' : requestparams.pop('guid', 0)}
    if request.json is None:
        return Error(10004).render()
#     result = validate_update_thermostat(requestparams)
#     if result is not None:
#         return result
    result =invoke( 'PUT', 'thermostat',requestparams,contextparams)
    return result
Ejemplo n.º 3
0
def POST(request_params,context_params):
    logger.info("Start of user onboarding")
    location_params = {}
    location_params['locations']= request_params.pop('locations')
    user_params = request_params
    
    try:
        user_response = invoke('POST','user',user_params,context_params)
        location_params['user_id'] = user_response['user_id']
        location_response = invoke('PUT','location',location_params,context_params)
    except ServiceException as ex:
        logger.error("Onboarding failed for user %s %s" %(user_params,location_params))
        return Error(ex.errorCode)

    response={}
    response.update(location_response)
    response.update(user_response)
    logger.info("User onboarding succesful")
    
    return response
Ejemplo n.º 4
0
def POST(request_params, context_params):
    logger.info("Start of user onboarding")
    location_params = {}
    location_params['locations'] = request_params.pop('locations')
    user_params = request_params

    try:
        user_response = invoke('POST', 'user', user_params, context_params)
        location_params['user_id'] = user_response['user_id']
        location_response = invoke('PUT', 'location', location_params,
                                   context_params)
    except ServiceException as ex:
        logger.error("Onboarding failed for user %s %s" %
                     (user_params, location_params))
        return Error(ex.errorCode)

    response = {}
    response.update(location_response)
    response.update(user_response)
    logger.info("User onboarding succesful")

    return response
def create_user_location():
    request_params,context_params=get_param()
    context_params['partner_id']=8
    logger.info("Inside create_user_location")
    result = invoke("POST", "onboarding", request_params,context_params)
    return result
Ejemplo n.º 6
0
def create_user_location():
    request_params, context_params = get_param()
    context_params['partner_id'] = 8
    logger.info("Inside create_user_location")
    result = invoke("POST", "onboarding", request_params, context_params)
    return result