diff --git a/lib/geocoder/results/opencagedata.rb b/lib/geocoder/results/opencagedata.rb index fb3f9ad4c3f7781a5dc5403fcc8d9eab5a45e596..94407dbc135128df84c96d9cacf634bcf6c79cce 100644 --- a/lib/geocoder/results/opencagedata.rb +++ b/lib/geocoder/results/opencagedata.rb @@ -36,12 +36,13 @@ module Geocoder::Result @data['components']['village'] end - def state @data['components']['state'] end - alias_method :state_code, :state + def state_code + @data['components']['state_code'] + end def postal_code @data['components']['postcode'].to_s diff --git a/test/fixtures/opencagedata_madison_square_garden b/test/fixtures/opencagedata_madison_square_garden index f5ff5df9d252d1dae1abdd12a222d1355d82f618..b5f1da03c42a1bd3f23f36173ff3879d196ca4a2 100644 --- a/test/fixtures/opencagedata_madison_square_garden +++ b/test/fixtures/opencagedata_madison_square_garden @@ -49,6 +49,7 @@ "city": "New York City", "stadium" : "Madison Square Garden", "state" : "New York", + "state_code" : "NY", "state_district" : "New York City" }, "confidence" : 10, @@ -70,4 +71,4 @@ }, "total_results" : 1, "we_are_hiring" : "http://lokku.com/#jobs" -} \ No newline at end of file +}