Examples of SleepLog


Examples of com.fitbit.api.common.model.sleep.SleepLog

        String startTime = request.getParameter("startTime");
        String duration = request.getParameter("duration");

        log.info("Log sleep :: date =  " + logDate + ", startTime = " + startTime + ", duration = " + duration);
        List<String> messages = new ArrayList<String>();
        SleepLog sleepLog;
        try {
            sleepLog = context.getApiClientService().getClient().logSleep(
                    context.getOurUser(),
                    FitbitApiService.getValidLocalDateOrNull(logDate),
                    FitbitApiService.getValidTimeOrNull(startTime),
                    Long.valueOf(duration)
            );
            String message = "Log sleep added. logId =  " + sleepLog.getLogId() + ".";
            messages.add(message);
            log.info(message);
        } catch (FitbitAPIException e) {
            populateMessages(messages, e);
            log.error("Error during log sleep.", e);
View Full Code Here

Examples of com.fitbit.api.common.model.sleep.SleepLog

        String url = APIUtil.contextualizeUrl(getApiBaseUrl(), getApiVersion(), "/user/-/sleep", APIFormat.JSON);

        Response response = httpPost(url, params.toArray(new PostParameter[params.size()]), true);

        try {
            return new SleepLog(response.asJSONObject().getJSONObject("sleep"));
        } catch (JSONException e) {
            throw new FitbitAPIException("Error parsing json response to SleepLog object: ", e);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.