Ejemplo n.º 1
0
        public override HttpWebRequest Create(IHttpRequestProxy proxy)
        {
            if (Limit > 50)
            {
                throw new FourSquareException("Default limit is 10 and maximum 50 is allowed.");
            }

            return Create(this, proxy);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates the web request target request.
        /// </summary>
        /// <param name="target">Target request object</param>
        /// <param name="proxy">Target proxy</param>
        /// <returns>Expected web request</returns>
        internal HttpWebRequest Create(object target, IHttpRequestProxy proxy)
        {
            var processor = new EndpointProcessor(target);

            string url = processor.GetBaseUrl() + "?";

            foreach (var parameter in processor.GetParameters())
                url += string.Format("{0}={1}&", parameter.Name, parameter.Value);

            if (url.IndexOf('&') >= 0 || url[url.Length - 1] == '?')
                url = url.Substring(0, url.Length - 1);

            return proxy.Create(url);
        }
Ejemplo n.º 3
0
        public override HttpWebRequest Create(IHttpRequestProxy proxy)
        {
            if (VenueId == 0)
            {
                if (string.IsNullOrEmpty(Shout) && string.IsNullOrEmpty(Venue))
                {
                    throw new FourSquareException("Must have a venue id");
                }
                else if (!string.IsNullOrEmpty(Venue))
                {
                    if (string.IsNullOrEmpty(Latitude) || string.IsNullOrEmpty(Longitude))
                    {
                        throw new FourSquareException("Must provide a latidue and longitude to make a check-in into an orphan venue");
                    }
                }
            }

            if (!string.IsNullOrEmpty(Shout) && Shout.Length > 140)
            {
                throw new FourSquareException("Shout text must be within 140 charecters");
            }

            return Create(this, proxy);
        }
Ejemplo n.º 4
0
 public override HttpWebRequest Create(IHttpRequestProxy proxy)
 {
     return Create(this, proxy);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Creates the web request for a target proxy.
 /// </summary>
 /// <param name="proxy">Target proxy</param>
 /// <returns><see cref="HttpWebRequest"/> instance</returns>
 public abstract HttpWebRequest Create(IHttpRequestProxy proxy);