Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ The following is a depiction of our Database Schema
## Endpoints
### 1. Search Open Restaurants by Zip Code
`GET https://back-end-wwe.herokuapp.com/restaurants?zip=<5-digit-code>`
- **Required** params: valid 5-digit zip code
- **Required** params: valid 5-digit zip code/latitude and longitude
- **Required** headers: unique event ID
- **Limited** results: 15 restaurants

Expand Down
14 changes: 9 additions & 5 deletions app/controllers/restaurants_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@ def index

def valid?
zip = params[:zip]

return true if zip.present? &&
zip.length == 5 &&
zip.to_i > 0
invalid_params
if zip.present?
if zip.split(',') == Array && zip.split(',').count == 2
return true
elsif zip.length == 5 && zip.to_i > 0
return true
end
else
invalid_params
end
end
end
2 changes: 1 addition & 1 deletion app/facades/restaurant_facade.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class RestaurantFacade
class << self
def open_restaurants(zip)
restaurants = RestaurantService.fetch_open_restaurants(zip)[:businesses]

restaurants.map do |dining|
YelpRestaurant.new(dining)
end
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading