Class: Webmention::Verification::Verifiers::BaseVerifier

Inherits:
Object
  • Object
show all
Defined in:
lib/webmention/verification/verifiers.rb

Direct Known Subclasses

HtmlVerifier, JsonVerifier, PlaintextVerifier

Instance Method Summary collapse

Constructor Details

#initialize(response, target, **options) ⇒ BaseVerifier

Returns a new instance of BaseVerifier.

Raises:



7
8
9
10
11
12
13
14
15
16
# File 'lib/webmention/verification/verifiers.rb', line 7

def initialize(response, target, **options)
  raise ArgumentError, "response must be an HTTP::Response (given #{response.class.name})" unless response.is_a?(HTTP::Response)
  raise ArgumentError, "target must be a String (given #{target.class.name})" unless target.is_a?(String)

  @response = response
  @target = target
  @options = options

  raise UnsupportedMimeTypeError, "Unsupported MIME Type: #{response.mime_type}" unless self.class.mime_types.include?(response.mime_type)
end

Instance Method Details

#resultsObject



18
19
20
# File 'lib/webmention/verification/verifiers.rb', line 18

def results
  @results ||= parse_response_body
end

#verified?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/webmention/verification/verifiers.rb', line 22

def verified?
  results.any?
end