From e41bd39995592fdeb4056a058a1f69484e0abd7b Mon Sep 17 00:00:00 2001
From: vyrak bunleang <vyrak.bunleang@gmail.com>
Date: Thu, 4 May 2017 14:41:16 -0600
Subject: [PATCH] return state_code instead of alias state

---
 lib/geocoder/results/opencagedata.rb             | 5 +++--
 test/fixtures/opencagedata_madison_square_garden | 3 ++-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/lib/geocoder/results/opencagedata.rb b/lib/geocoder/results/opencagedata.rb
index fb3f9ad4..94407dbc 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 f5ff5df9..b5f1da03 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
+}
-- 
GitLab