10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/dhs/concerns/item/validation.rb', line 10
def valid?(options = {})
options ||= {}
errors.clear
endpoint = validation_endpoint
raise 'No endpoint found to perform validations! See here: https://github.com/DePayFi/dhs#validation' unless endpoint
record = DHS::Record.for_url(endpoint.url)
params = merge_validation_params!(endpoint).merge options.fetch(:params, {})
url = validation_url(endpoint)
run_validation!(record, options, url, params)
true
rescue DHC::Error => e
self.errors = DHS::Problems::Errors.new(e.response, record)
false
end
|