public void Init()
        {
            ValidWeight = new WeightPastModel
            {
                Weight = 10
            };

            ValidWeightNew = new WeightNewModel
            {
                Timestamp      = DateTime.Now,
                Weight         = 10,
                PostToFacebook = null,
                PostToTwitter  = null
            };
        }
        /// <summary>
        /// Prepares the request object to update an existing model.
        /// </summary>
        /// <param name="weightToUpdate"></param>
        /// <returns></returns>
        private IRestRequest PrepareWeightUpdateRequest(WeightPastModel weightToUpdate)
        {
            var request = new RestRequest(Method.PUT);

            request.Resource = weightToUpdate.Uri;

            ValidateModel(weightToUpdate);

            //Add body to the request
            request.AddParameter(WeightPastModel.ContentType, _tokenManager.DefaultJsonSerializer.Serialize(new
            {
                bmi         = weightToUpdate.Bmi,
                fat_percent = weightToUpdate.FatPercent,
                free_mass   = weightToUpdate.FreeMass,
                mass_weight = weightToUpdate.MassWeight,
                weight      = weightToUpdate.Weight
            }), ParameterType.RequestBody);
            return(request);
        }
        public void UpdateWeightAsync(Action <WeightPastModel> success, Action <HealthGraphException> failure, WeightPastModel weightToUpdate)
        {
            var request = PrepareWeightUpdateRequest(weightToUpdate);

            _tokenManager.ExecuteAsync <WeightPastModel>(request, success, failure);
        }
        public WeightPastModel UpdateWeight(WeightPastModel weightToUpdate)
        {
            var request = PrepareWeightUpdateRequest(weightToUpdate);

            return(_tokenManager.Execute <WeightPastModel>(request));
        }