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

Refactor for consistency with other Results.

parent aac79d33
No related branches found
No related tags found
No related merge requests found
......@@ -4,48 +4,45 @@ module Geocoder::Result
class Bing < Base
def address(format = :full)
data_address['formattedAddress']
@data['address']['formattedAddress']
end
def city
data_address['locality']
@data['address']['locality']
end
def country
data_address['countryRegion']
def state_code
@data['address']['adminDistrict']
end
def country_code
# Bing does not return a contry code
""
alias_method :state, :state_code
def country
@data['address']['countryRegion']
end
alias_method :country_code, :country
def postal_code
data_address['postalCode']
@data['address']['postalCode']
end
def coordinates
data_coordinates['coordinates']
@data['point']['coordinates']
end
def data_address
def address_data
@data['address']
end
def data_coordinates
@data['point']
end
def address_line
data_address['addressLine']
end
def state
data_address['adminDistrict']
def self.response_attributes
%w[bbox name confidence entityType]
end
def confidence
@data['confidence']
response_attributes.each do |a|
define_method a do
@data[a]
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