Class: Geocoder::Result::BaiduIp

Inherits:
Base
  • Object
show all
Defined in:
lib/geocoder/results/baidu_ip.rb

Instance Attribute Summary

Attributes inherited from Base

#cache_hit, #data

Instance Method Summary collapse

Methods inherited from Base

#initialize, #latitude, #longitude, #province_code

Constructor Details

This class inherits a constructor from Geocoder::Result::Base

Instance Method Details

#addressObject


9
10
11
# File 'lib/geocoder/results/baidu_ip.rb', line 9

def address
  @data['address']
end

#cityObject


21
22
23
# File 'lib/geocoder/results/baidu_ip.rb', line 21

def city
  address_detail['city']
end

#coordinatesObject


5
6
7
# File 'lib/geocoder/results/baidu_ip.rb', line 5

def coordinates
  [point['y'].to_f, point['x'].to_f]
end

#countryObject


45
46
47
# File 'lib/geocoder/results/baidu_ip.rb', line 45

def country
  "China"
end

#country_codeObject


49
50
51
# File 'lib/geocoder/results/baidu_ip.rb', line 49

def country_code
  "CN"
end

#districtObject


25
26
27
# File 'lib/geocoder/results/baidu_ip.rb', line 25

def district
  address_detail['district']
end

#postal_codeObject


41
42
43
# File 'lib/geocoder/results/baidu_ip.rb', line 41

def postal_code
  ""
end

#provinceObject


17
18
19
# File 'lib/geocoder/results/baidu_ip.rb', line 17

def province
  address_detail['province']
end

#stateObject


13
14
15
# File 'lib/geocoder/results/baidu_ip.rb', line 13

def state
  province
end

#state_codeObject


37
38
39
# File 'lib/geocoder/results/baidu_ip.rb', line 37

def state_code
  ""
end

#streetObject


29
30
31
# File 'lib/geocoder/results/baidu_ip.rb', line 29

def street
  address_detail['street']
end

#street_numberObject


33
34
35
# File 'lib/geocoder/results/baidu_ip.rb', line 33

def street_number
  address_detail['street_number']
end