webmention-verification 2.0.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '09e77592a6a96292e3b0b0ab4453112c681b96cf44512a419ddf5a70dc426637'
4
- data.tar.gz: d7db1a6e009564e05f64d50ce824a5f95ed89fb80b48ad3b93c71d04aa7648dd
3
+ metadata.gz: 68a408b3f4b87517a6e11e188bc99c63d6eebbb40578a590a199550fe7014b87
4
+ data.tar.gz: 73abb9d6dda65e8d7dbda04a984fd9374db2334b9d45a653453553c7f121f978
5
5
  SHA512:
6
- metadata.gz: e976b1ce78d916a84009b17809b3e5590041f3148a1b20d24334186f0a04a2366327d3340f3cf240d9d40dfc47e069ec9e08346b6083297dc6bc29a84a6a0bd9
7
- data.tar.gz: be97ac43a36458b96ab290f4a9954dc9b1989511c1cc89fc829eb27e7ca7e8001ba8cfa65d758fa05f554aa85941f0b2527d353ab50cd880a11583b4dad9b537
6
+ metadata.gz: 43a6a1b80371c4cc2cdf9430e335733694f3e9ad9e93f1856a19048988b55c77b175786ad7a43c26fb5c497d367dd561fbf5d1f73ab696b065b1711258ff40c4
7
+ data.tar.gz: 4fe2a26b715e7cf50692e77a1c8319af395bcacbbeaddf26476c05badb8b135f6356972f38c07752c4f46b834b30fb8e0f57585855d4f2b15803e527f9981479
data/.reek.yml CHANGED
@@ -3,9 +3,6 @@ detectors:
3
3
  max_calls: 3
4
4
  IrresponsibleModule:
5
5
  enabled: false
6
- UtilityFunction:
7
- exclude:
8
- - FixtureHelpers#read_fixture
9
6
 
10
7
  exclude_paths:
11
8
  - vendor/
@@ -2,16 +2,17 @@ require:
2
2
  - rubocop-performance
3
3
  - rubocop-rspec
4
4
 
5
+ AllCops:
6
+ NewCops: enable
7
+
5
8
  Layout/HashAlignment:
6
9
  EnforcedColonStyle: table
7
- EnforcedHashRocketStyle: table
8
10
 
9
11
  Layout/LineLength:
10
12
  Enabled: false
11
13
 
12
14
  Metrics/BlockLength:
13
15
  Exclude:
14
- - webmention-verification.gemspec
15
16
  - spec/**/*.rb
16
17
 
17
18
  Naming/RescuedExceptionsVariableName:
@@ -1 +1 @@
1
- 2.4.9
1
+ 2.4.10
data/.simplecov CHANGED
@@ -2,9 +2,11 @@ require 'simplecov-console'
2
2
 
3
3
  formatters = [SimpleCov::Formatter::HTMLFormatter]
4
4
 
5
+ # rubocop:disable Style/IfUnlessModifier
5
6
  if RSpec.configuration.files_to_run.length > 1
6
7
  formatters << SimpleCov::Formatter::Console
7
8
  end
9
+ # rubocop:enable Style/IfUnlessModifier
8
10
 
9
11
  SimpleCov.start do
10
12
  formatter SimpleCov::Formatter::MultiFormatter.new(formatters)
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.0.0 / unreleased
4
+
5
+ - **Breaking Change:** Remove `Webmention::Verification.client` convenience method (af575d7)
6
+ - **Breaking Change:** Remove `HttpRequest` class (112f9d3)
7
+ - Move development dependencies to `Gemfile` (81cdfdf)
8
+ - Update development Ruby version to 2.4.10 (a13bca0)
9
+
3
10
  ## 2.0.0 / 2020-01-25
4
11
 
5
12
  - Downgrade [HTTP](https://github.com/httprb/http) gem constraint to ~> 4.3 (090f590)
@@ -8,9 +8,9 @@ There are a couple ways you can help improve webmention-verification-ruby:
8
8
 
9
9
  ## Getting Started
10
10
 
11
- webmention-verification-ruby is developed using Ruby 2.4.9 and is additionally tested against Ruby 2.5, 2.6, and 2.7 using [Travis CI](https://travis-ci.com/jgarber623/webmention-verification-ruby).
11
+ webmention-verification-ruby is developed using Ruby 2.4.10 and is additionally tested against Ruby 2.5, 2.6, and 2.7 using [Travis CI](https://travis-ci.com/jgarber623/webmention-verification-ruby).
12
12
 
13
- Before making changes to webmention-verification-ruby, you'll want to install Ruby 2.4.9. It's recommended that you use a Ruby version managment tool like [rbenv](https://github.com/rbenv/rbenv), [chruby](https://github.com/postmodern/chruby), or [rvm](https://github.com/rvm/rvm). Once you've installed Ruby 2.4.9 using your method of choice, install the project's gems by running:
13
+ Before making changes to webmention-verification-ruby, you'll want to install Ruby 2.4.10. It's recommended that you use a Ruby version managment tool like [rbenv](https://github.com/rbenv/rbenv), [chruby](https://github.com/postmodern/chruby), or [rvm](https://github.com/rvm/rvm). Once you've installed Ruby 2.4.10 using your method of choice, install the project's gems by running:
14
14
 
15
15
  ```sh
16
16
  bundle install
data/Gemfile CHANGED
@@ -2,3 +2,14 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in webmention-verification.gemspec
4
4
  gemspec
5
+
6
+ gem 'pry-byebug', '~> 3.9'
7
+ gem 'rake', '~> 13.0'
8
+ gem 'reek', '~> 6.0'
9
+ gem 'rspec', '~> 3.9'
10
+ gem 'rubocop', '~> 0.83.0'
11
+ gem 'rubocop-performance', '~> 1.5'
12
+ gem 'rubocop-rspec', '~> 1.39'
13
+ gem 'simplecov', '~> 0.18.5'
14
+ gem 'simplecov-console', '~> 0.7.2'
15
+ gem 'webmock', '~> 3.8'
data/README.md CHANGED
@@ -18,7 +18,7 @@
18
18
 
19
19
  Before installing and using webmention-verification-ruby, you'll want to have [Ruby](https://www.ruby-lang.org) 2.4 (or newer) installed. It's recommended that you use a Ruby version managment tool like [rbenv](https://github.com/rbenv/rbenv), [chruby](https://github.com/postmodern/chruby), or [rvm](https://github.com/rvm/rvm).
20
20
 
21
- webmention-verification-ruby is developed using Ruby 2.4.9 and is additionally tested against Ruby 2.5, 2.6, and 2.7 using [Travis CI](https://travis-ci.com/jgarber623/webmention-verification-ruby).
21
+ webmention-verification-ruby is developed using Ruby 2.4.10 and is additionally tested against Ruby 2.5, 2.6, and 2.7 using [Travis CI](https://travis-ci.com/jgarber623/webmention-verification-ruby).
22
22
 
23
23
  ## Installation
24
24
 
@@ -65,7 +65,7 @@ require 'webmention/verification'
65
65
  source = 'https://source.example.com/post/100'
66
66
  target = 'https://target.example.com/post/100'
67
67
 
68
- client = Webmention::Verification.client(source, target)
68
+ client = Webmention::Verification::Client.new(source, target)
69
69
 
70
70
  puts client.source # => 'https://source.example.com/post/100'
71
71
  puts client.target # => 'https://target.example.com/post/100'
@@ -88,7 +88,7 @@ require 'webmention/verification'
88
88
  source = 'https://source.example.com/post/100'
89
89
  target = 'https://target.example.com/post/100'
90
90
 
91
- client = Webmention::Verification.client(source, target, strict: false)
91
+ client = Webmention::Verification::Client.new(source, target, strict: false)
92
92
 
93
93
  puts client.verified? # => Boolean true or false
94
94
  ```
@@ -8,24 +8,30 @@ require 'webmention/verification/version'
8
8
  require 'webmention/verification/exceptions'
9
9
 
10
10
  require 'webmention/verification/client'
11
- require 'webmention/verification/http_request'
12
- require 'webmention/verification/registerable'
13
-
14
11
  require 'webmention/verification/verifiers'
12
+ require 'webmention/verification/verifiers/base_verifier'
15
13
  require 'webmention/verification/verifiers/html_verifier'
16
14
  require 'webmention/verification/verifiers/json_verifier'
17
15
  require 'webmention/verification/verifiers/plaintext_verifier'
18
16
 
19
17
  module Webmention
20
18
  module Verification
21
- class << self
22
- def client(*args)
23
- Client.new(*args)
24
- end
25
-
26
- def verified?(*args)
27
- client(*args).verified?
28
- end
19
+ # Determine whether or not source URI links to target URI.
20
+ #
21
+ # @example
22
+ # source = 'https://source.example.com/post/100'
23
+ # target = 'https://target.example.com/post/100'
24
+ #
25
+ # puts Webmention::Verification.verified?(source, target)
26
+ # #=> TrueClass or FalseClass
27
+ #
28
+ # @param source [String]
29
+ # @param target [String]
30
+ # @param options [Hash]
31
+ # @option options [Boolean] :strict (true)
32
+ # @return [Boolean]
33
+ def self.verified?(source, target, **options)
34
+ Client.new(source, target, **options).verified?
29
35
  end
30
36
  end
31
37
  end
@@ -1,8 +1,28 @@
1
1
  module Webmention
2
2
  module Verification
3
3
  class Client
4
+ HTTP_CLIENT_HEADERS = {
5
+ accept: '*/*',
6
+ user_agent: 'Webmention Verification Client (https://rubygems.org/gems/webmention-verification)'
7
+ }.freeze
8
+
4
9
  attr_reader :source, :target
5
10
 
11
+ # Create a client used to determine whether or not source URI links to target URI.
12
+ #
13
+ # @example
14
+ # source = 'https://source.example.com/post/100'
15
+ # target = 'https://target.example.com/post/100'
16
+ #
17
+ # client = Webmention::Verification::Client.new(source, target)
18
+ #
19
+ # puts client.verified?
20
+ # #=> TrueClass or FalseClass
21
+ #
22
+ # @param source [String]
23
+ # @param target [String]
24
+ # @param options [Hash]
25
+ # @option options [Boolean] :strict (true)
6
26
  def initialize(source, target, **options)
7
27
  raise ArgumentError, "source must be a String (given #{source.class.name})" unless source.is_a?(String)
8
28
  raise ArgumentError, "target must be a String (given #{target.class.name})" unless target.is_a?(String)
@@ -15,22 +35,34 @@ module Webmention
15
35
  raise ArgumentError, 'target must be an absolute URI (e.g. https://example.com/post/100)' unless target_uri.absolute?
16
36
  end
17
37
 
38
+ # @return [HTTP::Response]
39
+ # @raise [Webmention::Verification::ConnectionError, Webmention::Verification::TimeoutError, Webmention::Verification::TooManyRedirectsError]
18
40
  def response
19
- @response ||= HttpRequest.get(source_uri)
41
+ @response ||= HTTP.follow.headers(HTTP_CLIENT_HEADERS).timeout(connect: 10, read: 10).get(source_uri)
42
+ rescue HTTP::ConnectionError,
43
+ HTTP::TimeoutError,
44
+ HTTP::Redirector::TooManyRedirectsError => exception
45
+ raise Webmention::Verification.const_get(exception.class.name.split('::').last), exception
20
46
  end
21
47
 
48
+ # @return [Addressable::URI]
49
+ # @raise [Webmention::Verification::InvalidURIError]
22
50
  def source_uri
23
51
  @source_uri ||= Addressable::URI.parse(source)
24
52
  rescue Addressable::URI::InvalidURIError => exception
25
53
  raise InvalidURIError, exception
26
54
  end
27
55
 
56
+ # @return [Addressable::URI]
57
+ # @raise [Webmention::Verification::InvalidURIError]
28
58
  def target_uri
29
59
  @target_uri ||= Addressable::URI.parse(target)
30
60
  rescue Addressable::URI::InvalidURIError => exception
31
61
  raise InvalidURIError, exception
32
62
  end
33
63
 
64
+ # @return [Boolean]
65
+ # @raise [Webmention::Verification::UnsupportedMimeTypeError]
34
66
  def verified?
35
67
  raise UnsupportedMimeTypeError, "Unsupported MIME Type: #{response.mime_type}" unless verifier_for_mime_type
36
68
 
@@ -1,43 +1,12 @@
1
1
  module Webmention
2
2
  module Verification
3
3
  module Verifiers
4
- extend Registerable
5
-
6
- class BaseVerifier
7
- def initialize(response, target, **options)
8
- raise ArgumentError, "response must be an HTTP::Response (given #{response.class.name})" unless response.is_a?(HTTP::Response)
9
- raise ArgumentError, "target must be a String (given #{target.class.name})" unless target.is_a?(String)
10
-
11
- @response = response
12
- @target = target
13
- @options = options
14
-
15
- raise UnsupportedMimeTypeError, "Unsupported MIME Type: #{response.mime_type}" unless self.class.mime_types.include?(response.mime_type)
16
- end
17
-
18
- def results
19
- @results ||= parse_response_body
20
- end
21
-
22
- def verified?
23
- results.any?
24
- end
25
-
26
- private
27
-
28
- def response_body
29
- @response_body ||= @response.body.to_s
30
- end
31
-
32
- def target_regexp
33
- @target_regexp ||= /^#{target_regexp_str}$/
34
- end
35
-
36
- def target_regexp_str
37
- return @target if @options.fetch(:strict, true)
4
+ def self.register(klass)
5
+ klass.mime_types.each { |mime_type| registered[mime_type] = klass }
6
+ end
38
7
 
39
- @target.sub(%r{https?://}, 'https?://')
40
- end
8
+ def self.registered
9
+ @registered ||= {}
41
10
  end
42
11
  end
43
12
  end
@@ -0,0 +1,44 @@
1
+ module Webmention
2
+ module Verification
3
+ class BaseVerifier
4
+ class << self
5
+ attr_reader :mime_types
6
+ end
7
+
8
+ def initialize(response, target, **options)
9
+ raise ArgumentError, "response must be an HTTP::Response (given #{response.class.name})" unless response.is_a?(HTTP::Response)
10
+ raise ArgumentError, "target must be a String (given #{target.class.name})" unless target.is_a?(String)
11
+
12
+ @response = response
13
+ @target = target
14
+ @options = options
15
+
16
+ raise UnsupportedMimeTypeError, "Unsupported MIME Type: #{response.mime_type}" unless self.class.mime_types.include?(response.mime_type)
17
+ end
18
+
19
+ def results
20
+ @results ||= parse_response_body
21
+ end
22
+
23
+ def verified?
24
+ results.any?
25
+ end
26
+
27
+ private
28
+
29
+ def response_body
30
+ @response_body ||= @response.body.to_s
31
+ end
32
+
33
+ def target_regexp
34
+ @target_regexp ||= /^#{target_regexp_str}$/
35
+ end
36
+
37
+ def target_regexp_str
38
+ return @target if @options.fetch(:strict, true)
39
+
40
+ @target.sub(%r{https?://}, 'https?://')
41
+ end
42
+ end
43
+ end
44
+ end
@@ -2,9 +2,7 @@ module Webmention
2
2
  module Verification
3
3
  module Verifiers
4
4
  class HtmlVerifier < BaseVerifier
5
- def self.mime_types
6
- ['text/html']
7
- end
5
+ @mime_types = ['text/html']
8
6
 
9
7
  Verifiers.register(self)
10
8
 
@@ -2,9 +2,7 @@ module Webmention
2
2
  module Verification
3
3
  module Verifiers
4
4
  class JsonVerifier < BaseVerifier
5
- def self.mime_types
6
- ['application/json']
7
- end
5
+ @mime_types = ['application/json']
8
6
 
9
7
  Verifiers.register(self)
10
8
 
@@ -2,9 +2,7 @@ module Webmention
2
2
  module Verification
3
3
  module Verifiers
4
4
  class PlaintextVerifier < BaseVerifier
5
- def self.mime_types
6
- ['text/plain']
7
- end
5
+ @mime_types = ['text/plain']
8
6
 
9
7
  Verifiers.register(self)
10
8
 
@@ -1,5 +1,5 @@
1
1
  module Webmention
2
2
  module Verification
3
- VERSION = '2.0.0'.freeze
3
+ VERSION = '3.0.0'.freeze
4
4
  end
5
5
  end
@@ -1,10 +1,7 @@
1
- lib = File.expand_path('lib', __dir__)
2
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
-
4
- require 'webmention/verification/version'
1
+ require_relative 'lib/webmention/verification/version'
5
2
 
6
3
  Gem::Specification.new do |spec|
7
- spec.required_ruby_version = ['>= 2.4', '< 2.8']
4
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.4', '< 2.8')
8
5
 
9
6
  spec.name = 'webmention-verification'
10
7
  spec.version = Webmention::Verification::VERSION
@@ -16,26 +13,16 @@ Gem::Specification.new do |spec|
16
13
  spec.homepage = 'https://github.com/jgarber623/webmention-verification-ruby'
17
14
  spec.license = 'MIT'
18
15
 
19
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(bin|spec)/}) }
16
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
17
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(bin|spec)/}) }
18
+ end
20
19
 
21
20
  spec.require_paths = ['lib']
22
21
 
23
- spec.metadata = {
24
- 'bug_tracker_uri' => "#{spec.homepage}/issues",
25
- 'changelog_uri' => "#{spec.homepage}/blob/v#{spec.version}/CHANGELOG.md"
26
- }
27
-
28
- spec.add_development_dependency 'rake', '~> 13.0'
29
- spec.add_development_dependency 'reek', '~> 5.6'
30
- spec.add_development_dependency 'rspec', '~> 3.9'
31
- spec.add_development_dependency 'rubocop', '~> 0.79.0'
32
- spec.add_development_dependency 'rubocop-performance', '~> 1.5'
33
- spec.add_development_dependency 'rubocop-rspec', '~> 1.37'
34
- spec.add_development_dependency 'simplecov', '~> 0.17.1'
35
- spec.add_development_dependency 'simplecov-console', '~> 0.6.0'
36
- spec.add_development_dependency 'webmock', '~> 3.8'
22
+ spec.metadata['bug_tracker_uri'] = "#{spec.homepage}/issues"
23
+ spec.metadata['changelog_uri'] = "#{spec.homepage}/blob/v#{spec.version}/CHANGELOG.md"
37
24
 
38
25
  spec.add_runtime_dependency 'addressable', '~> 2.7'
39
- spec.add_runtime_dependency 'http', '~> 4.3'
26
+ spec.add_runtime_dependency 'http', '~> 4.4'
40
27
  spec.add_runtime_dependency 'nokogiri', '~> 1.10'
41
28
  end
metadata CHANGED
@@ -1,141 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webmention-verification
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Garber
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-25 00:00:00.000000000 Z
11
+ date: 2020-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: rake
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '13.0'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '13.0'
27
- - !ruby/object:Gem::Dependency
28
- name: reek
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '5.6'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '5.6'
41
- - !ruby/object:Gem::Dependency
42
- name: rspec
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '3.9'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '3.9'
55
- - !ruby/object:Gem::Dependency
56
- name: rubocop
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: 0.79.0
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: 0.79.0
69
- - !ruby/object:Gem::Dependency
70
- name: rubocop-performance
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '1.5'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '1.5'
83
- - !ruby/object:Gem::Dependency
84
- name: rubocop-rspec
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '1.37'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: '1.37'
97
- - !ruby/object:Gem::Dependency
98
- name: simplecov
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - "~>"
102
- - !ruby/object:Gem::Version
103
- version: 0.17.1
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - "~>"
109
- - !ruby/object:Gem::Version
110
- version: 0.17.1
111
- - !ruby/object:Gem::Dependency
112
- name: simplecov-console
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: 0.6.0
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - "~>"
123
- - !ruby/object:Gem::Version
124
- version: 0.6.0
125
- - !ruby/object:Gem::Dependency
126
- name: webmock
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - "~>"
130
- - !ruby/object:Gem::Version
131
- version: '3.8'
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - "~>"
137
- - !ruby/object:Gem::Version
138
- version: '3.8'
139
13
  - !ruby/object:Gem::Dependency
140
14
  name: addressable
141
15
  requirement: !ruby/object:Gem::Requirement
@@ -156,14 +30,14 @@ dependencies:
156
30
  requirements:
157
31
  - - "~>"
158
32
  - !ruby/object:Gem::Version
159
- version: '4.3'
33
+ version: '4.4'
160
34
  type: :runtime
161
35
  prerelease: false
162
36
  version_requirements: !ruby/object:Gem::Requirement
163
37
  requirements:
164
38
  - - "~>"
165
39
  - !ruby/object:Gem::Version
166
- version: '4.3'
40
+ version: '4.4'
167
41
  - !ruby/object:Gem::Dependency
168
42
  name: nokogiri
169
43
  requirement: !ruby/object:Gem::Requirement
@@ -203,9 +77,8 @@ files:
203
77
  - lib/webmention/verification.rb
204
78
  - lib/webmention/verification/client.rb
205
79
  - lib/webmention/verification/exceptions.rb
206
- - lib/webmention/verification/http_request.rb
207
- - lib/webmention/verification/registerable.rb
208
80
  - lib/webmention/verification/verifiers.rb
81
+ - lib/webmention/verification/verifiers/base_verifier.rb
209
82
  - lib/webmention/verification/verifiers/html_verifier.rb
210
83
  - lib/webmention/verification/verifiers/json_verifier.rb
211
84
  - lib/webmention/verification/verifiers/plaintext_verifier.rb
@@ -216,7 +89,7 @@ licenses:
216
89
  - MIT
217
90
  metadata:
218
91
  bug_tracker_uri: https://github.com/jgarber623/webmention-verification-ruby/issues
219
- changelog_uri: https://github.com/jgarber623/webmention-verification-ruby/blob/v2.0.0/CHANGELOG.md
92
+ changelog_uri: https://github.com/jgarber623/webmention-verification-ruby/blob/v3.0.0/CHANGELOG.md
220
93
  post_install_message:
221
94
  rdoc_options: []
222
95
  require_paths:
@@ -235,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
235
108
  - !ruby/object:Gem::Version
236
109
  version: '0'
237
110
  requirements: []
238
- rubygems_version: 3.0.6
111
+ rubygems_version: 3.1.3
239
112
  signing_key:
240
113
  specification_version: 4
241
114
  summary: Verify a received webmention.
@@ -1,18 +0,0 @@
1
- module Webmention
2
- module Verification
3
- class HttpRequest
4
- HTTP_HEADERS_OPTS = {
5
- accept: '*/*',
6
- user_agent: 'Webmention Verification Client (https://rubygems.org/gems/webmention-verification)'
7
- }.freeze
8
-
9
- def self.get(uri)
10
- HTTP.follow.headers(HTTP_HEADERS_OPTS).timeout(connect: 10, read: 10).get(uri)
11
- rescue HTTP::ConnectionError,
12
- HTTP::TimeoutError,
13
- HTTP::Redirector::TooManyRedirectsError => exception
14
- raise Webmention::Verification.const_get(exception.class.name.split('::').last), exception
15
- end
16
- end
17
- end
18
- end
@@ -1,13 +0,0 @@
1
- module Webmention
2
- module Verification
3
- module Registerable
4
- def register(klass)
5
- klass.mime_types.each { |mime_type| registered[mime_type] = klass }
6
- end
7
-
8
- def registered
9
- @registered ||= {}
10
- end
11
- end
12
- end
13
- end