Esempio n. 1
0
        private static Uri GetQLocationUri(PlaceBy request, string location)
        {
            const string template = "q={location}";

            var urlBuilder = new StringBuilder(GetBaseUrl(request, template));

            urlBuilder.Replace("{location}", location);

            return(new Uri(urlBuilder.ToString()));
        }
        private static void EnsureContractsAreSatisfied(PlaceBy request)
        {
            if (request.Flags.Contains(Flag.StreetDetail))
                request.Flags.Remove(Flag.StreetDetail);

            if (!request.Flags.Contains(Flag.Json))
                request.Flags.Add(Flag.Json);

            if (request.Flags.Contains(Flag.Php))
                request.Flags.Remove(Flag.Php);

            if (request is PlaceByCoordinates && !request.GFlags.Contains(GFlag.Reverse))
                request.GFlags.Add(GFlag.Reverse);
        }
Esempio n. 3
0
        private static string GetBaseUrl(PlaceBy request, string template)
        {
            var urlBuilder = new StringBuilder(template);

            urlBuilder.Append("&locale={locale}&start={start}&count={count}");
            urlBuilder.Append("&offset={offset}&flags={flags}&gflags={gFlags}");

            urlBuilder.Replace("{locale}", request.Locale);
            urlBuilder.Replace("{start}", request.Start.ToString(CultureInfo.InvariantCulture));
            urlBuilder.Replace("{count}", request.Count.ToString(CultureInfo.InvariantCulture));
            urlBuilder.Replace("{offset}", request.Offset.ToString(CultureInfo.InvariantCulture));
            urlBuilder.Replace("{flags}", request.GetFlagsAsString());
            urlBuilder.Replace("{gFlags}", request.GetGFlagsAsString());

            urlBuilder.Insert(0, "http://yboss.yahooapis.com/geo/placefinder?");
            return(urlBuilder.ToString());
        }
Esempio n. 4
0
        private static string GetBaseUrl(PlaceBy request, string template)
        {
            var urlBuilder = new StringBuilder(template);

            urlBuilder.Append("&locale={locale}&start={start}&count={count}");
            urlBuilder.Append("&offset={offset}&flags={flags}&gflags={gFlags}");

            urlBuilder.Replace("{locale}", request.Locale);
            urlBuilder.Replace("{start}", request.Start.ToString(CultureInfo.InvariantCulture));
            urlBuilder.Replace("{count}", request.Count.ToString(CultureInfo.InvariantCulture));
            urlBuilder.Replace("{offset}", request.Offset.ToString(CultureInfo.InvariantCulture));
            urlBuilder.Replace("{flags}", request.GetFlagsAsString());
            urlBuilder.Replace("{gFlags}", request.GetGFlagsAsString());

            urlBuilder.Insert(0, "http://yboss.yahooapis.com/geo/placefinder?");
            return urlBuilder.ToString();
        }
Esempio n. 5
0
        private static void EnsureContractsAreSatisfied(PlaceBy request)
        {
            if (request.Flags.Contains(Flag.StreetDetail))
            {
                request.Flags.Remove(Flag.StreetDetail);
            }

            if (!request.Flags.Contains(Flag.Json))
            {
                request.Flags.Add(Flag.Json);
            }

            if (request.Flags.Contains(Flag.Php))
            {
                request.Flags.Remove(Flag.Php);
            }

            if (request is PlaceByCoordinates && !request.GFlags.Contains(GFlag.Reverse))
            {
                request.GFlags.Add(GFlag.Reverse);
            }
        }
Esempio n. 6
0
        private static Uri GetQLocationUri(PlaceBy request, string location)
        {
            const string template = "q={location}";

            var urlBuilder = new StringBuilder(GetBaseUrl(request, template));
            urlBuilder.Replace("{location}", location);

            return new Uri(urlBuilder.ToString());
        }