module PostcodeSoftware
Provides postcode look up service for postcodesoftware.net
PostcodeSoftware.account = 'myaccount' PostcodeSoftware.password = 'mypassword' response = PostcodeSoftware.look_up('LS18 4AB')
Attributes
account[RW]
Account for the service
password[RW]
Password for the service
Public Class Methods
look_up(postcode)
click to toggle source
Looks up the given postcode
and returns found addresses in a PostcodeSoftware::Response
.
# File lib/postcode_software.rb, line 24 def self.look_up(postcode) Response.new(URI.open(sdk_url(postcode))) end
sdk_url(postcode)
click to toggle source
Returns the web SDK URL for the given postcode.
# File lib/postcode_software.rb, line 29 def self.sdk_url(postcode) [ 'http://ws1.postcodesoftware.co.uk/lookup.asmx/getAddress?account=', CGI::escape(account.to_s), '&password=', CGI::escape(password), '&postcode=', CGI.escape(postcode) ].join end