Skip to content
Snippets Groups Projects
Commit 484f5b92 authored by Thu Trang Pham's avatar Thu Trang Pham
Browse files

Support maxminddb gem v0.1.7

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