public void LocationWithCoordinates() { var o = GetOptions(); var yelp = new Yelp(o); var searchOptions = new YelpSharp.Data.Options.SearchOptions() { GeneralOptions = new GeneralOptions() { term = "food" }, LocationOptions = new LocationOptions() { location = "bellevue", coordinates = new CoordinateOptions() { latitude = 37.788022, longitude = -122.399797 } } }; var results = yelp.Search(searchOptions); Console.WriteLine(results); }
// // GET: /Business/ public ActionResult Details(string id) { Yelp y = new Yelp(MvcApplication.Options); var result = y.GetBusiness(id); return(View(result)); }
public void BusinessTest() { var y = new Yelp(Config.Options); var results = y.GetBusiness("yelp-san-francisco").Result; Assert.IsTrue(results != null); }
/// <summary> /// /// </summary> /// <param name="model"></param> /// <returns></returns> public ActionResult Results(SimpleSearchModel model) { Yelp yelp = new Yelp(MvcApplication.Options); var results = yelp.Search(model.Term, model.Location); return(View(results)); }
public void LocationWithCoordinates() { var yelp = new Yelp(Config.Options); var searchOptions = new YelpSharp.Data.Options.SearchOptions() { GeneralOptions = new GeneralOptions() { term = "food" }, LocationOptions = new LocationOptions() { location = "bellevue", coordinates = new CoordinateOptions() { latitude = 37.788022, longitude = -122.399797 } } }; var results = yelp.Search(searchOptions).Result; Assert.IsTrue(results.businesses.Count > 0); }
// // GET: /Business/ public ActionResult Details(string id) { Yelp y = new Yelp(Config.Options); var result = y.GetBusiness(id).Result; return(View(result)); }
public static YelpReviewModel GetYelpBiz(BizInfo vBiz) { YelpReviewModel yrm = new YelpReviewModel(); Yelp yelp = new Yelp(Config.Options); // var results = yelp.Search("Restaurants " + vBiz.BizCuisines.FirstOrDefault().CuisineTypeName, vBiz.BizAddressString).Result; YelpSharp.Data.Business biz = new YelpSharp.Data.Business(); // biz=results.businesses.FirstOrDefault(e => e.phone == vBiz.ContactInfo.Phone); // biz = (biz == null) ? null : yelp.GetBusiness(biz.id).Result; biz = string.IsNullOrEmpty(vBiz.YelpBizId)? null: yelp.GetBusiness(vBiz.YelpBizId).Result; yrm.Biz = biz; if (biz != null) { if (biz.reviews != null && biz.reviews.Count > 0) { int lRandIndex = Helper.GetRandItem(0, biz.reviews.Count - 1); yrm.Review = biz.reviews[lRandIndex]; if (yrm.Review.user != null) { yrm.User = yrm.Review.user; } } } return(yrm); }
public void ErrorTest_UNAVAILABLE_BUSINESS() { Yelp y = new Yelp(Config.Options); Business business = y.GetBusiness("foo-bar").Result; Assert.IsNull(business); }
public void LimitTest() { var y = new Yelp(Config.Options); var searchOptions = new SearchOptions() { GeneralOptions = new GeneralOptions() { term = "coffee", limit = 15, }, LocationOptions = new LocationOptions() { location = "seattle, wa" } }; var results = y.Search(searchOptions).Result; if (results.error != null) { Assert.Fail(results.error.text); } if (results.businesses.Count != 15) { Assert.Fail(string.Format("Limit test returned {0} results instead of 15", results.businesses.Count)); } Console.WriteLine(results); }
public void BusinessTest() { var o = GetOptions(); var y = new Yelp(o); var results = y.GetBusiness("yelp-san-francisco"); Console.WriteLine(results); }
public async void GetBusiness(string businessId) { this.Business = null; Yelp yelp = new Yelp(Config.Options); this.Business = await yelp.GetBusiness(businessId); }
public void BasicTest() { var o = GetOptions(); var y = new Yelp(o); var results = y.Search("coffee", "seattle, wa"); Console.WriteLine(results); }
public Venue(Yelp.Business theBusiness) { id = theBusiness.id; title = theBusiness.name; image = theBusiness.image_url; rating = theBusiness.rating; ratingImage = theBusiness.rating_img_url_large; }
public Venue(Yelp.Business theBusiness) { id = theBusiness.id; title = theBusiness.name; image = theBusiness.image_url; rating = theBusiness.rating; ratingImage = theBusiness.rating_img_url_large; address = theBusiness.location.address[0]; }
public void GetJsonAsyncTest2() { Dictionary <string, string> dict = new Dictionary <string, string>(); dict.Add("term", "delis"); Yelp yelp = new Yelp(); var json = yelp.GetJsonAsync(dict); Assert.IsNotNull(json); }
public void SearchByPhoneTest() { var y = new Yelp(Config.Options); var results = y.SearchByPhone("4159083801").Result; Assert.IsNotNull(results); Assert.IsNotNull(results.businesses); Assert.IsNotNull(results.businesses.FirstOrDefault()); Assert.AreEqual <string>("yelp-san-francisco", results.businesses.First().id); }
private void Button_Click_1(object sender, RoutedEventArgs e) { var yelp = new Yelp(Config.Options); var task = yelp.Search(txtSearch.Text, txtLocation.Text); task.ContinueWith((results) => { App.ViewModel = new ViewModels.SearchResultViewModel(results.Result); NavigationService.Navigate(new Uri("/SearchResultsPage.xaml")); }); }
public void BasicTest() { var y = new Yelp(Config.Options); var results = y.Search("coffee", "seattle, wa").Result; if (results.error != null) { Assert.Fail(results.error.text); } Console.WriteLine(results); }
public void ErrorTest_UNSPECIFIED_LOCATION() { var y = new Yelp(Config.Options); var searchOptions = new SearchOptions(); var results = y.Search(searchOptions).Result; Assert.IsTrue(results.error != null); Assert.IsTrue(results.error.id == YelpSharp.Data.ErrorId.UNSPECIFIED_LOCATION); Console.WriteLine(results); }
public void LocationByBounds() { var yelp = new Yelp(Config.Options); var searchOptions = new YelpSharp.Data.Options.SearchOptions() { LocationOptions = new CoordinateOptions() { latitude = 37.788022, longitude = -122.399797 } }; var results = yelp.Search(searchOptions).Result; Assert.IsTrue(results.businesses.Count > 0); }
public async Task <IActionResult> Details(string businessId) { var googleKey = _configuration.GetSection("API_KEY").GetSection("GoogleKey").Value; var httpClient = HttpClientFactory.Create(); string detailSearch = $"https://maps.googleapis.com/maps/api/place/details/json?place_id={businessId}&fields=name,formatted_phone_number&key={googleKey}"; HttpResponseMessage httpResponseMessage = await httpClient.GetAsync(detailSearch); try { if (httpResponseMessage.IsSuccessStatusCode) { var content = httpResponseMessage.Content; string data = await content.ReadAsStringAsync(); BusinessDetail detail = ConvertToDetail(data); ViewBag.detailData = detail; var client = new HttpClient(); var apiKey = _configuration.GetSection("API_KEY").GetSection("YelpKey").Value; var YelpSearch = $"https://api.yelp.com/v3/businesses/search/phone?phone=+1{detail.PhoneNumber}"; client.DefaultRequestHeaders.Add("Authorization", "Bearer " + apiKey); string response = await client.GetStringAsync(YelpSearch); Yelp yelpUrl = ConvertToYelpUrl(response); if (yelpUrl.Url == "Null") { ViewBag.url = "Null"; } ViewBag.url = yelpUrl.Url; return(View()); } else { return(View("Index")); } } catch (HttpRequestException) { return(View("Index")); } }
public async void Search() { this.Businesses.Clear(); Yelp yelp = new Yelp(Config.Options); SearchResults searchResults = await yelp.Search(this.SearchOptions); if (searchResults != null && searchResults.businesses != null) { for (int count = 0; count < searchResults.businesses.Count; count++) { this.Businesses.Add(searchResults.businesses[count]); } } }
public void VerifyLocationInResult() { var y = new Yelp(Config.Options); var results = y.Search("coffee", "seattle, wa").Result; if (results.error != null) { Assert.Fail(results.error.text); } var bus = results.businesses[0]; if (bus.location.coordinate == null) { Assert.Fail("No coordinate found on location for business"); } }
public void LocationWithRadius() { var yelp = new Yelp(Config.Options); var searchOptions = new YelpSharp.Data.Options.SearchOptions() { GeneralOptions = new GeneralOptions() { term = "food", radius_filter = 5 }, LocationOptions = new LocationOptions() { location = "bellevue" } }; var results = yelp.Search(searchOptions).Result; Assert.IsTrue(results.businesses.Count > 0); }
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); } }
public void MultipleCategories() { var yelp = new Yelp(Config.Options); var searchOptions = new YelpSharp.Data.Options.SearchOptions() { GeneralOptions = new GeneralOptions() { category_filter = "climbing,bowling" }, LocationOptions = new LocationOptions() { location = "Seattle" } }; var results = yelp.Search(searchOptions).Result; Assert.IsTrue(results.businesses.Count > 0); }
public void BusinessReviewTest() { var y = new Yelp(Config.Options); var results = y.GetBusiness("yelp-san-francisco").Result; Assert.IsTrue(results != null); Assert.IsNotNull(results.reviews); Assert.AreNotEqual(0, results.review_count); Assert.AreNotEqual(0, results.reviews.Count); var firstReview = results.reviews[0]; Assert.IsNotNull(firstReview.rating_image_url); Assert.IsNotNull(firstReview.rating_image_small_url); Assert.IsNotNull(firstReview.rating_image_large_url); }
public void ErrorTest_UNAVAILABLE_FOR_LOCATION() { var y = new Yelp(Config.Options); var searchOptions = new SearchOptions() { LocationOptions = new CoordinateOptions() { latitude = 1, longitude = 1 } }; var results = y.Search(searchOptions).Result; Assert.IsTrue(results.error != null); Assert.IsTrue(results.error.id == YelpSharp.Data.ErrorId.UNAVAILABLE_FOR_LOCATION); Console.WriteLine(results); }
public void VerifyCoordinatesWithRadius() { var yelp = new Yelp(Config.Options); var searchOptions = new YelpSharp.Data.Options.SearchOptions() { GeneralOptions = new GeneralOptions() { radius_filter = 3000 }, LocationOptions = new CoordinateOptions() { latitude = 47.603525, longitude = -122.329580 } }; var results = yelp.Search(searchOptions).Result; Assert.IsTrue(results.businesses.Count > 0); }
public void ErrorTest_INVALID_SIGNATURE() { var o = GetOptions(); var y = new Yelp(o); var searchOptions = new SearchOptions() { GeneralOptions = new GeneralOptions() { term = "coffee + tea" } }; var results = y.Search(searchOptions); Assert.IsTrue(results.error != null); Assert.IsTrue(results.error.id == YelpSharp.Data.ErrorId.INVALID_SIGNATURE); Console.WriteLine(results); }
public void MultipleCategories() { var o = GetOptions(); var yelp = new Yelp(o); var searchOptions = new YelpSharp.Data.Options.SearchOptions() { GeneralOptions = new GeneralOptions() { category_filter = "climbing,bowling" }, LocationOptions = new LocationOptions() { location = "Seattle" } }; var results = yelp.Search(searchOptions); Console.WriteLine(results); }
public void LocationWithRadius() { var o = GetOptions(); var yelp = new Yelp(o); var searchOptions = new YelpSharp.Data.Options.SearchOptions() { GeneralOptions = new GeneralOptions() { term = "food", radius_filter = 5 }, LocationOptions = new LocationOptions() { location = "bellevue" } }; var results = yelp.Search(searchOptions); Console.WriteLine(results); }