class Geocoder::Result::Baidu

def self.response_attributes


:cityCode
:business

Baidu's Geocoding API documentation and include (among others):
Get address components of a given type. Valid types are defined in
#
def self.response_attributes
  %w[business cityCode]
end

def address_components

def address_components
  @data['addressComponent']
end

def city

def city
  @data['addressComponent'] and @data['addressComponent']['city'] or ""
end

def coordinates

def coordinates
  ['lat', 'lng'].map{ |i| @data['location'][i] }
end

def country

def country
  "China"
end

def country_code

def country_code
  "CN"
end

def district

def district
  @data['addressComponent'] and @data['addressComponent']['district'] or ""
end

def formatted_address

def formatted_address
  @data['formatted_address'] or ""
end

def postal_code

def postal_code
  ""
end

def province

def province
  @data['addressComponent'] and @data['addressComponent']['province'] or ""
end

def state_code

def state_code
  ""
end

def street

def street
  @data['addressComponent'] and @data['addressComponent']['street'] or ""
end

def street_number

def street_number
  @data['addressComponent'] and @data['addressComponent']['street_number']
end