private void GetYelpData(Guid id, string yelpId)
        {
            var options = new Options
            {
                AccessToken = ConfigurationManager.AppSettings["YelpAPIToken"],
                AccessTokenSecret = ConfigurationManager.AppSettings["YelpAPITokenSecret"],
                ConsumerKey = ConfigurationManager.AppSettings["YelpAPIConsumerKey"],
                ConsumerSecret = ConfigurationManager.AppSettings["YelpAPIConsumerSecret"]
            };

            var yelp = new Yelp(options);
            Business business = yelp.GetBusiness(yelpId).Result;
            if (business != null)
                UpdateAccount(id, business.rating);
        }
Esempio n. 2
0
 /// <summary>
 /// Driver for the Yelp API
 /// </summary>
 /// <param name="options">OAuth options for using the Yelp API</param>
 public Yelp(Options options)
 {
     this.options = options;
 }
Esempio n. 3
0
        public GeoJson.PointLayer GetPointLayerByBounds(double neLat, double neLng, double swLat, double swLng, int page = 1, string[] ds = null, string[] tags = null)
        {
            //Consumer Key:	kVvCwX0ocRhDHbA9LfdLrQ
            //Consumer Secret:	RCJdVyZ5R3pVoc3hzyXIy-0ILQ0
            //Token:	ZgOH_PB5SkKIOIIeI3_9vYRE5ZNTZiIn
            //Token Secret:	rSn8bgTH44an2XYJTgqQQqcDubs

            PointLayer layer = new PointLayer(this.DataSource);

            var options = new Options()
            {
                AccessToken = "ZgOH_PB5SkKIOIIeI3_9vYRE5ZNTZiIn",
                AccessTokenSecret = "rSn8bgTH44an2XYJTgqQQqcDubs",
                ConsumerKey = "kVvCwX0ocRhDHbA9LfdLrQ",
                ConsumerSecret = "RCJdVyZ5R3pVoc3hzyXIy-0ILQ0"
            };

            Yelp yelp = new Yelp(options);

            SearchOptions searchOptions = new SearchOptions()
            {
                LocationOptions = new BoundOptions()
                {
                    sw_latitude = swLat,
                    sw_longitude = swLng,
                    ne_latitude = neLat,
                    ne_longitude = neLng
                }
            };

            //VectorLocation vLocation = Util.VectorLocationFromBounds(neLat, neLng, swLat, swLng);

            //LocationOptions location = new LocationOptions();
            //CoordinateOptions coords = new CoordinateOptions();
            //coords.latitude = vLocation.Latitude;
            //coords.longitude = vLocation.Longitude;
            //location.coordinates = coords;
            //// location.location = coords;

            //searchOptions.LocationOptions = location;

            GeneralOptions generalOptions = new GeneralOptions();
            //generalOptions.radius_filter = vLocation.Radius;
            generalOptions.limit = pageSize;

            if(page > 1)
            {
                generalOptions.offset = (page - 1) * pageSize;
            }

            searchOptions.GeneralOptions = generalOptions;

            SearchResults results = yelp.Search(searchOptions).Result;

            layer.TotalResults = results.total;
            layer.Page = page;
            layer.PageCount = layer.TotalResults % pageSize;
            layer.Points = PointsFromBusinessList(results.businesses);
            layer.PageSize = pageSize;

            return layer;
        }