Last active
August 29, 2015 14:09
-
-
Save ch1ago/5e4cf88e7ae1b985ecaa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Geocoder | |
module Lookup | |
class Base | |
private | |
def read_fixture(file) | |
File.read(File.join("spec", "fixtures", "geocoder", file)).strip.gsub(/\n\s*/, "") | |
end | |
end | |
class Google < Base | |
private | |
def fetch_raw_data(query, reverse = false) | |
raise TimeoutError if query == "timeout" | |
raise SocketError if query == "socket_error" | |
file = case query | |
when "no results"; :no_results | |
when "no locality"; :no_locality | |
when "no city data"; :no_city_data | |
else :madison_square_garden | |
end | |
read_fixture "google_data.json" | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment