class Webmention::Verification::BaseVerifier

Attributes

mime_types[R]

Public Class Methods

new(response, target, **options) click to toggle source
# File lib/webmention/verification/verifiers/base_verifier.rb, line 8
def initialize(response, target, **options)
  @response = response
  @target = target.to_str
  @options = options

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

Public Instance Methods

results() click to toggle source
# File lib/webmention/verification/verifiers/base_verifier.rb, line 16
def results
  @results ||= parse_response_body
end
verified?() click to toggle source
# File lib/webmention/verification/verifiers/base_verifier.rb, line 20
def verified?
  results.any?
end

Private Instance Methods

response_body() click to toggle source
# File lib/webmention/verification/verifiers/base_verifier.rb, line 26
def response_body
  @response_body ||= @response.body.to_s
end
target_regexp() click to toggle source
# File lib/webmention/verification/verifiers/base_verifier.rb, line 30
def target_regexp
  @target_regexp ||= /^#{target_regexp_str}$/
end
target_regexp_str() click to toggle source
# File lib/webmention/verification/verifiers/base_verifier.rb, line 34
def target_regexp_str
  return @target if @options.fetch(:strict, true)

  @target.sub(%r{https?://}, 'https?://')
end