Class: Graticule::Geocoder::FreeThePostcode

Inherits:
Base
  • Object
show all
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

Base::USER_AGENT

Instance Method Summary collapse

Constructor Details

#initializeFreeThePostcode

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