Class: Valvat::Lookup::HMRC
Constant Summary collapse
- PRODUCTION_ENDPOINT_URL =
'https://api.service.hmrc.gov.uk/organisations/vat/check-vat-number/lookup'- SANDBOX_ENDPOINT_URL =
'https://test-api.service.hmrc.gov.uk/organisations/vat/check-vat-number/lookup'- HEADERS =
{ # https://developer.service.hmrc.gov.uk/api-documentation/docs/reference-guide#versioning 'Accept' => 'application/vnd.hmrc.2.0+json' }.freeze
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Valvat::Lookup::Base
Instance Method Details
#perform ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/valvat/lookup/hmrc.rb', line 19 def perform return { valid: false } unless [:uk].is_a?(Hash) parse(fetch(endpoint_uri).body) rescue Valvat::HMRC::AccessToken::Error => e { error: e } end |