lib/geocoder/results/geocodio.rb in geocoder-1.3.7 vs lib/geocoder/results/geocodio.rb in geocoder-1.4.0
- old
+ new
@@ -22,19 +22,27 @@
address_components["state"]
end
alias_method :state_code, :state
def zip
- address_components["zip"]
+ # Postal code is not returned for Canada geocode results
+ address_components["zip"] || ""
end
alias_method :postal_code, :zip
def country
- "United States" # Geocodio only supports the US
+ # Geocodio supports US and Canada, however they don't return the full
+ # country name.
+
+ if country_code == "CA"
+ "Canada"
+ else
+ "United States"
+ end
end
def country_code
- "US" # Geocodio only supports the US
+ address_components['country']
end
def city
address_components["city"]
end