Class: PostcodeValidation::Gateway::PCAPotentialAddressMatch
- Inherits:
-
Object
- Object
- PostcodeValidation::Gateway::PCAPotentialAddressMatch
- Includes:
- HTTParty
- Defined in:
- lib/postcode_validation/gateway/pca_potential_address_match.rb
Defined Under Namespace
Classes: PCARequestError
Constant Summary collapse
- KEY =
ENV['POSTCODE_ANYWHERE_KEY']
Instance Method Summary collapse
Instance Method Details
#query(search_term:, country:) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/postcode_validation/gateway/pca_potential_address_match.rb', line 11 def query(search_term:, country:) response = find_postcode(country, search_term) response.map do |row| raise PCARequestError, (row) if row.key?('Error') PostcodeValidation::Domain::PotentialAddressMatch.new(text: row['Text'], description: row['Description']) end end |