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

Merge pull request #837 from TrangPham/master

Support maxminddb gem v0.1.7
parents 7143136f 484f5b92
No related branches found
No related tags found
No related merge requests found
...@@ -13,35 +13,35 @@ module Geocoder ...@@ -13,35 +13,35 @@ module Geocoder
end end
def latitude def latitude
@data.fetch('location',{}).fetch('latitude',0.0) data.fetch('location',{}).fetch('latitude',0.0)
end end
def longitude def longitude
@data.fetch('location',{}).fetch('longitude',0.0) data.fetch('location',{}).fetch('longitude',0.0)
end end
def city def city
@data.fetch('city', {}).fetch('names', {}).fetch('en', '') data.fetch('city', {}).fetch('names', {}).fetch('en', '')
end end
def state def state
@data.fetch('subdivisions',[]).fetch(0,{}).fetch('names',{}).fetch('en','') data.fetch('subdivisions',[]).fetch(0,{}).fetch('names',{}).fetch('en','')
end end
def state_code def state_code
@data.fetch('subdivisions',[]).fetch(0,{}).fetch('iso_code','') data.fetch('subdivisions',[]).fetch(0,{}).fetch('iso_code','')
end end
def country def country
@data.fetch('country', {}).fetch('names',{}).fetch('en','') data.fetch('country', {}).fetch('names',{}).fetch('en','')
end end
def country_code def country_code
@data.fetch('country',{}).fetch('iso_code','') data.fetch('country',{}).fetch('iso_code','')
end end
def postal_code def postal_code
@data.fetch('postal',{}).fetch('code','') data.fetch('postal',{}).fetch('code','')
end end
def self.response_attributes def self.response_attributes
...@@ -53,6 +53,12 @@ module Geocoder ...@@ -53,6 +53,12 @@ module Geocoder
@data[a] @data[a]
end end
end end
private
def data
@data.to_hash
end
end end
end 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