Skip to content

Instantly share code, notes, and snippets.

@postazure
Last active August 29, 2015 14:17
Show Gist options
  • Select an option

  • Save postazure/c4008ff59afaa04de1bf to your computer and use it in GitHub Desktop.

Select an option

Save postazure/c4008ff59afaa04de1bf to your computer and use it in GitHub Desktop.
# lib/harvesters/yelp_harvester.rb
class YelpHarvester
def initialize restaurant
yelp_business_id = get_yelp_id(restaurant.yelp_url)
@yelp_data = Yelp.client.business(yelp_business_id)
end
def get_yelp_id url
url.slice!("http://www.yelp.com/biz/")
return url
end
def populate_data
yelp_info = YelpInfo.new({
rating: @yelp_data.rating,
})
yelp_info.save
end
def populate_tags
# Saves Tags to restaurant
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment