Sha256: c53f531c3be000ecec49ea06d6eaaacb6eff197e9b3d6050945dcdc3c999ab5a

Contents?: true

Size: 769 Bytes

Versions: 3

Compression:

Stored size: 769 Bytes

Contents

# frozen_string_literal: true

module Webmention
  module Verification
    class Verifier
      class << self
        attr_reader :mime_types
      end

      def initialize(response, target, **options)
        @response = response
        @target = target.to_str
        @options = options
      end

      def results
        @results ||= parse_response_body
      end

      def verified?
        results.any?
      end

      private

      def response_body
        @response_body ||= @response.body.to_s
      end

      def target_regexp
        @target_regexp ||= /^#{target_regexp_str}$/
      end

      def target_regexp_str
        return @target if @options.fetch(:strict, true)

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
webmention-verification-6.0.2 lib/webmention/verification/verifier.rb
webmention-verification-6.0.1 lib/webmention/verification/verifier.rb
webmention-verification-6.0.0 lib/webmention/verification/verifier.rb