Class: Vatsense::Resources::Validate
- Inherits:
-
Object
- Object
- Vatsense::Resources::Validate
- Defined in:
- lib/vatsense/resources/validate.rb
Overview
VAT and EORI number validation
Instance Method Summary collapse
-
#check(eori_number: nil, requester_vat_number: nil, vat_number: nil, request_options: {}) ⇒ Vatsense::Models::ValidateCheckResponse
Some parameter documentations has been truncated, see Models::ValidateCheckParams for more details.
-
#initialize(client:) ⇒ Validate
constructor
private
A new instance of Validate.
Constructor Details
#initialize(client:) ⇒ Validate
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Validate.
51 52 53 |
# File 'lib/vatsense/resources/validate.rb', line 51 def initialize(client:) @client = client end |
Instance Method Details
#check(eori_number: nil, requester_vat_number: nil, vat_number: nil, request_options: {}) ⇒ Vatsense::Models::ValidateCheckResponse
Some parameter documentations has been truncated, see Models::ValidateCheckParams for more details.
Check whether a given VAT number or EORI number is valid against live government records.
**VAT validation** checks against UK (HMRC), EU (VIES), Australia, Norway, Switzerland, South Africa, and Brazil records.
**EORI validation** checks against UK and EU records only.
If the external validation service is temporarily unavailable, the API returns a ‘412` error and the request does not count against your usage quota.
Provide either ‘vat_number` or `eori_number`, but not both.
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/vatsense/resources/validate.rb', line 36 def check(params = {}) parsed, = Vatsense::ValidateCheckParams.dump_request(params) query = Vatsense::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "validate", query: query, model: Vatsense::Models::ValidateCheckResponse, options: ) end |