/// <summary>
        ///     Gets the specified spec.
        /// </summary>
        /// <param name="spec">The spec.</param>
        /// <returns>StructuredHttpExchange.</returns>
        public static StructuredHttpExchange Get(CallSpec spec)
        {
            var retVal = new StructuredHttpExchange(spec)
            {
                Method = HttpMethod.Get
            };

            return(retVal);
        }
        /// <summary>
        ///     Posts the specified spec.
        /// </summary>
        /// <param name="spec">The spec.</param>
        /// <param name="body">The body.</param>
        /// <returns>StructuredHttpExchange.</returns>
        public static StructuredHttpExchange Post(CallSpec spec, string body)
        {
            var retVal = new StructuredHttpExchange(spec)
            {
                Method = HttpMethod.Post,
                Body   = body
            };

            return(retVal);
        }
        /// <summary>
        ///     Patches the specified spec.
        /// </summary>
        /// <param name="spec">The spec.</param>
        /// <param name="body">The body.</param>
        /// <returns>StructuredHttpExchange.</returns>
        public static StructuredHttpExchange Patch(CallSpec spec, string body)
        {
            var retVal = new StructuredHttpExchange(spec)
            {
                Method = new HttpMethod("PATCH"),
                Body   = body
            };

            return(retVal);
        }
        /// <summary>
        ///     Initializes a new instance of the <see cref="StructuredHttpExchange" /> class.
        /// </summary>
        /// <param name="spec">The spec.</param>
        private StructuredHttpExchange(CallSpec spec)
        {
            string temp = spec.Template;

            if (temp.StartsWith("{project}/_apis"))
            {
                temp = temp.Replace("{project}/_apis", "");
            }
            if (temp.StartsWith("_apis"))
            {
                temp = temp.Replace("_apis", "");
            }
            RelativeRoute     = temp;
            r_RouteDictionary = StringFormatter.Parse(RelativeRoute);
        }