Module: PostcodeSoftware
- Defined in:
- lib/postcode_software.rb,
lib/postcode_software/response.rb
Overview
Defined Under Namespace
Classes: Response
Class Attribute Summary collapse
-
.account ⇒ Object
Account for the service.
-
.password ⇒ Object
Password for the service.
Class Method Summary collapse
-
.look_up(postcode) ⇒ Object
Looks up the given
postcodeand returns found addresses in aPostcodeSoftware::Response. -
.sdk_url(postcode) ⇒ Object
Returns the web SDK URL for the given postcode.
Class Attribute Details
.account ⇒ Object
Account for the service
14 15 16 |
# File 'lib/postcode_software.rb', line 14 def account @account end |
.password ⇒ Object
Password for the service
16 17 18 |
# File 'lib/postcode_software.rb', line 16 def password @password end |
Class Method Details
.look_up(postcode) ⇒ Object
Looks up the given postcode and returns found addresses in a PostcodeSoftware::Response.
24 25 26 |
# File 'lib/postcode_software.rb', line 24 def self.look_up(postcode) Response.new(URI.open(sdk_url(postcode))) end |
.sdk_url(postcode) ⇒ Object
Returns the web SDK URL for the given postcode.
29 30 31 32 33 34 35 36 37 38 |
# 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 |