Skip to content
Snippets Groups Projects
Commit 2ab17e6d authored by Alex Reisner's avatar Alex Reisner
Browse files

Clean up state/province code.

parent 1a2ea730
No related branches found
No related tags found
No related merge requests found
......@@ -34,19 +34,14 @@ module Geocoder::Result
end
def country_code
prov = @data['prov']
return nil if prov.nil? || prov == ""
canadian_province_abbreviations.include?(@data['prov']) ? "CA" : "US"
end
def canadian_province_abbreviations
%w[ON QC NS NB MB BC PE SK AB NL]
return nil if state.nil? || state == ""
canadian_province_abbreviations.include?(state) ? "CA" : "US"
end
def self.response_attributes
%w[latt longt inlatt inlongt betweenRoad1 betweenRoad2 distance
stnumber staddress prov postal
NearRoad NearRoadDistance intersection major_intersection]
%w[latt longt inlatt inlongt distance stnumber staddress prov
NearRoad NearRoadDistance betweenRoad1 betweenRoad2
intersection major_intersection]
end
response_attributes.each do |a|
......@@ -54,5 +49,12 @@ module Geocoder::Result
@data[a]
end
end
private # ----------------------------------------------------------------
def canadian_province_abbreviations
%w[ON QC NS NB MB BC PE SK AB NL]
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment