Class: PostcodeAnywhere::Lookup

Inherits:
Object
  • Object
show all
Defined in:
lib/postcode_anywhere/lookup.rb

Class Method Summary collapse

Class Method Details

.lookup(options) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/postcode_anywhere/lookup.rb', line 10

def self.lookup(options)
  results = PostcodeAnywhere.get(SERVICE_ADDRESS+"?Key=#{PostcodeAnywhere.key}&Postcode=#{CGI::escape(options[:postcode])}&Building=#{options[:number]}")
  address = Address.new
  address.line1 = results["Table"]["Row"]["Line1"]
  address.company = results["Table"]["Row"]["Company"]
  address
end