Class: PostcodeAnywhere::EmailValidation::Response
- Inherits:
-
Object
- Object
- PostcodeAnywhere::EmailValidation::Response
- Defined in:
- lib/postcode_anywhere/email_validation/response.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.parse(json) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/postcode_anywhere/email_validation/response.rb', line 7 def self.parse(json) response = JSON.parse(json)['Items'].first error = if response['Error'] ValidationError.new(response['Description'], code: response['Error'], cause: response['Cause'], resolution: response['Resolution']) end new(response['ValidFormat'], response['FoundDnsRecord'], error) end |
Instance Method Details
#valid? ⇒ Boolean
19 20 21 22 23 |
# File 'lib/postcode_anywhere/email_validation/response.rb', line 19 def valid? raise error if error? valid_format? && valid_dns_record? end |