Class: VAProfile::AddressValidation::Service
- Inherits:
-
Service
- Object
- Common::Client::Base
- Service
- VAProfile::AddressValidation::Service
- Defined in:
- lib/va_profile/address_validation/service.rb
Overview
Wrapper for the VA profile address validation/suggestions API
Constant Summary
Constants inherited from Service
Instance Method Summary collapse
-
#address_suggestions(address) ⇒ VAProfile::AddressValidation::AddressSuggestionsResponse
Get address suggestions and override key from the VA profile API.
-
#candidate(address) ⇒ Hash
Raw data from VA profile address validation API including address suggestions, validation key, and address errors.
-
#initialize ⇒ Service
constructor
A new instance of Service.
Methods inherited from Service
Methods inherited from Common::Client::Base
configuration, #raise_backend_exception
Methods included from SentryLogging
#log_exception_to_sentry, #log_message_to_sentry, #non_nil_hash?, #normalize_level, #rails_logger
Constructor Details
#initialize ⇒ Service
Returns a new instance of Service.
14 |
# File 'lib/va_profile/address_validation/service.rb', line 14 def initialize; end |
Instance Method Details
#address_suggestions(address) ⇒ VAProfile::AddressValidation::AddressSuggestionsResponse
Get address suggestions and override key from the VA profile API
19 20 21 22 23 |
# File 'lib/va_profile/address_validation/service.rb', line 19 def address_suggestions(address) candidate_res = candidate(address) AddressSuggestionsResponse.new(candidate_res) end |
#candidate(address) ⇒ Hash
Returns raw data from VA profile address validation API including address suggestions, validation key, and address errors.
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/va_profile/address_validation/service.rb', line 27 def candidate(address) begin res = perform( :post, 'candidate', address.address_validation_req.to_json ) rescue => e handle_error(e) end res.body end |