Class: BizRatr::GooglePlacesConnector
- Defined in:
- lib/bizratr/connector.rb
Instance Method Summary collapse
- #make_business(item) ⇒ Object
- #make_client(config) ⇒ Object
- #search_location(location, query) ⇒ Object
Methods inherited from Connector
Constructor Details
This class inherits a constructor from BizRatr::Connector
Instance Method Details
#make_business(item) ⇒ Object
93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/bizratr/connector.rb', line 93 def make_business(item) b = Business.new(@uberclient, item.lat, item.lng, item.name) b.add_id(:google_places, item.id) b.add_categories(:google_places, item.types) b.phone = (item.formatted_phone_number || "").gsub(/[\ ()-]*/, '') b.city = item.city || item.vicinity.split(',').last b.country = item.country b.website = item.website b.zip = item.postal_code b.address = item.vicinity.split(',').first b.(:google_places, item.) b.add_review_counts(:google_places, item.reviews.length) b end |
#make_client(config) ⇒ Object
84 85 86 |
# File 'lib/bizratr/connector.rb', line 84 def make_client(config) GooglePlaces::Client.new(config[:key]) end |
#search_location(location, query) ⇒ Object
88 89 90 91 |
# File 'lib/bizratr/connector.rb', line 88 def search_location(location, query) results = @client.spots(location[0], location[1], :name => query) results.map { |item| make_business(item) } end |