Class: Graticule::Geocoder::FreeThePostcode
- Defined in:
- lib/graticule/geocoder/freethepostcode.rb
Overview
freethepostcode.org (www.freethepostcode.org/) is a
free service to convert UK postcodes into geolocation data.
gg = Graticule.service(:FreeThePostcode).new
location = gg.locate 'W1A 1AA'
location.coordinates
#=> [51.52093, -0.13714]
Constant Summary
Constants inherited from Base
Instance Method Summary collapse
-
#initialize ⇒ FreeThePostcode
constructor
A new instance of FreeThePostcode.
- #locate(postcode) ⇒ Object
Constructor Details
#initialize ⇒ FreeThePostcode
Returns a new instance of FreeThePostcode.
14 15 16 |
# File 'lib/graticule/geocoder/freethepostcode.rb', line 14 def initialize @url = URI.parse 'http://www.freethepostcode.org/geocode' end |
Instance Method Details
#locate(postcode) ⇒ Object
18 19 20 |
# File 'lib/graticule/geocoder/freethepostcode.rb', line 18 def locate(postcode) get :postcode => postcode end |