Skip to content
ideal-postcodesPublic

About

Ideal Postcodes Ruby SDK

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

Ideal Postcodes Ruby SDK

Calls to the Ideal Postcodes API from Ruby 3.3 or later, with no runtime dependencies.

gem install ideal_postcodes
require "ideal_postcodes"

client = IdealPostcodes::Client.new(api_key: "ak_test")

lookup = client.lookup("BR8 7RE")
lookup.addresses.each do |address|
  puts "#{address.line_1}, #{address.post_town}, #{address.postcode}"
end

response = client.find_address(query: "9 Malyons Road")
response.result.hits.each { |hit| puts hit.suggestion }

Each API operation is one method on the client, named from its operation ID, such as postcodes, address_cleanse or key_usage. Path parameters are positional and everything else is a keyword argument. Every response is an object with one reader per field under the API's own name, [] for any key and to_h for the decoded body, unknown fields included. An HTTP error raises IdealPostcodes::ApiError, with the HTTP status in status and the API error code in code.

Key, licensee and configuration operations need your Management Key: pass management_key: to Client.new. Keep it on your server.

Documentation covers setup, postcode and UPRN lookup, autocomplete, address cleanse, email and phone validation, keys, licensees, responses, errors and a reference page for every operation. Coding agents can install the ideal-postcodes-ruby-sdk skill with npx skills add ideal-postcodes/skills.

License

SEE LICENSE IN LICENSE

About

Ideal Postcodes Ruby SDK

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages