Skip to content

Instantly share code, notes, and snippets.

@stefl
Forked from adrianshort/uk-postcodes.rb
Created April 12, 2010 14:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stefl/363614 to your computer and use it in GitHub Desktop.
Save stefl/363614 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'weary'
class Postie
def get(code)
(Weary.get "http://www.uk-postcodes.com/postcode/#{code.gsub(' ', '')}.json").perform
end
end
postie = Postie.new
my_area = postie.get("N1 1AA")
puts my_area["postcode"]
puts my_area["administrative"]["district"]["title"]
puts my_area["geo"]["lat"]
puts my_area["geo"]["lng"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment