/// <summary>
        /// Get transit times.
        /// </summary>
        /// <param name="transitTime">TransitTime.</param>
        /// <returns>TimeResponse or null.</returns>
        public static List<TransitTime> GetTimes(TransitTime transitTime)
        {
            // serialize shipment
            string postBody = JsonConvert.SerializeObject(transitTime,
                new JsonSerializerSettings {DefaultValueHandling = DefaultValueHandling.Ignore});

            // https://api.postmaster.io/v1/times
            string url = "{0}/{1}/{2}";
            url = string.Format(url, Config.BaseUri, Config.Version, Resource);

            string response = Request.Post(url, postBody);

            return response != null ? JsonConvert.DeserializeObject<TransitTimeResponse>(response).Services : null;
        }
Пример #2
0
        /// <summary>
        /// Get transit times.
        /// </summary>
        /// <param name="transitTime">TransitTime.</param>
        /// <returns>TimeResponse or null.</returns>
        public static List <TransitTime> GetTimes(TransitTime transitTime)
        {
            // serialize shipment
            string postBody = JsonConvert.SerializeObject(transitTime,
                                                          new JsonSerializerSettings {
                DefaultValueHandling = DefaultValueHandling.Ignore
            });

            // https://api.postmaster.io/v1/times
            string url = "{0}/{1}/{2}";

            url = string.Format(url, Config.BaseUri, Config.Version, Resource);

            string response = Request.Post(url, postBody);

            return(response != null?JsonConvert.DeserializeObject <TransitTimeResponse>(response).Services : null);
        }