webmention-verification 1.1.0 → 4.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: 66b22219ff7225b01af23a17fea1b9e1eaa7a0030f277aaab6eae432431d2985
4
- data.tar.gz: 9a07439c13437f0abe28e6a39476c62f8e4404626e16562a75e7b072e712b988
3
+ metadata.gz: 2063cd50c99a812e53c8dbeb25b5ad18ff41dd3fb2b8038041b69a69aa50e4a7
4
+ data.tar.gz: 4c5461865432816ae6c9fdd6244fe96494ee749b9b060a2fce17215beb7ca591
5
5
  SHA512:
6
- metadata.gz: 93120d7e665aca4d13616f94edbee5f7953edb8a0abb7e4a3f0c900c07da5597cf2f89da39b001132bf6daf17dbee7f70342a669d29390a0dc94b64c22db7abd
7
- data.tar.gz: e741360306cbdbace9ab13d6bc17d5b2437b031a0b453b142024707b656aee7807d60122d7d3ff89ce3be2a562b691106e424de95530d42d26d0dc141009674e
6
+ metadata.gz: 41e456ed1fdac332e76d1acb4b3b62b52a1d648e7c40113c65b03f35cf66d605f282a8601040bcc931b1c2b24391a0f68bf7fb4f55e2d3a40803997c5e0264f3
7
+ data.tar.gz: 39864e52e855443a515e160013beb9352e798c028c3786c7fd17672f2645508695a94c180676e6f0fb7d1713e3f54bf2a74c85f02057b75edc3fcdfa0d148a11
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,17 +2,19 @@ require:
2
2
  - rubocop-performance
3
3
  - rubocop-rspec
4
4
 
5
- Layout/AlignHash:
5
+ AllCops:
6
+ NewCops: enable
7
+
8
+ Layout/HashAlignment:
6
9
  EnforcedColonStyle: table
7
- EnforcedHashRocketStyle: table
10
+
11
+ Layout/LineLength:
12
+ Enabled: false
8
13
 
9
14
  Metrics/BlockLength:
10
15
  Exclude:
11
16
  - spec/**/*.rb
12
17
 
13
- Metrics/LineLength:
14
- Enabled: false
15
-
16
18
  Naming/RescuedExceptionsVariableName:
17
19
  PreferredName: exception
18
20
 
@@ -1 +1 @@
1
- 2.4.6
1
+ 2.5.8
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,13 +1,10 @@
1
+ dist: bionic
1
2
  language: ruby
2
3
  rvm:
3
- - 2.4.6
4
- - 2.5.5
5
- - 2.6.3
6
- cache:
7
- - bundler
8
- before_install:
9
- - gem update --system
10
- - gem install bundler
4
+ - 2.5
5
+ - 2.6
6
+ - 2.7
7
+ cache: bundler
11
8
  before_script:
12
9
  - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
13
10
  - chmod +x ./cc-test-reporter
@@ -1,31 +1,51 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.0.0 / 2020-08-23
4
+
5
+ - **Breaking Change:** Update minimum supported Ruby version to 2.5 (096012e)
6
+ - Update development Ruby version to 2.5.8 (3b3f38e)
7
+
8
+ ## 3.0.0 / 2020-05-14
9
+
10
+ - **Breaking Change:** Remove `Webmention::Verification.client` convenience method (af575d7)
11
+ - **Breaking Change:** Remove `HttpRequest` class (112f9d3)
12
+ - Move development dependencies to `Gemfile` (81cdfdf)
13
+ - Update development Ruby version to 2.4.10 (a13bca0)
14
+
15
+ ## 2.0.0 / 2020-01-25
16
+
17
+ - Downgrade [HTTP](https://github.com/httprb/http) gem constraint to ~> 4.3 (090f590)
18
+
19
+ ## 1.2.0 / 2020-01-20
20
+
21
+ - Expand supported Ruby versions to include 2.7 (48d9b7b)
22
+
23
+ ## 1.1.1 / 2019-08-31
24
+
25
+ - Update Addressable gem (0c9368e)
26
+ - Update development dependencies
27
+
3
28
  ## 1.1.0 / 2019-05-01
4
29
 
5
- - Add `Webmention::Verification.client` method.
6
- - Rename base `Error` class to `WebmentionVerificationError` ([0eb3a9a](https://github.com/jgarber623/webmention-verification-ruby/commit/0eb3a9a)).
7
- - Add `HttpRequest` class ([c7602c9](https://github.com/jgarber623/webmention-verification-ruby/commit/c7602c9)).
30
+ - Add `Webmention::Verification.client` method
31
+ - Rename base `Error` class to `WebmentionVerificationError` (0eb3a9a)
32
+ - Add `HttpRequest` class (c7602c9)
8
33
 
9
34
  ## 1.0.0 / 2019-04-25
10
35
 
11
- - Use pre-release HTTP gem (see @httprb/http#489) ([bdcfdad](https://github.com/jgarber623/webmention-verification-ruby/commit/bdcfdad)).
12
- - Refactor verifiers:
13
- - ([7eef7bd](https://github.com/jgarber623/webmention-verification-ruby/commit/7eef7bd))
14
- - ([55eb17e](https://github.com/jgarber623/webmention-verification-ruby/commit/55eb17e))
15
- - ([bcdf3b4](https://github.com/jgarber623/webmention-verification-ruby/commit/bcdf3b4))
16
- - Refactor `Client#response` exception handling ([29afcb0](https://github.com/jgarber623/webmention-verification-ruby/commit/29afcb0)).
17
- - Rename `errors` to `exceptions` ([2bca96b](https://github.com/jgarber623/webmention-verification-ruby/commit/2bca96b)).
18
- - Spec cleanup:
19
- - ([4b84f16](https://github.com/jgarber623/webmention-verification-ruby/commit/4b84f16))
20
- - ([4940e9c](https://github.com/jgarber623/webmention-verification-ruby/commit/4940e9c))
36
+ - Use pre-release HTTP gem (see @httprb/http#489) (bdcfdad)
37
+ - Refactor verifiers (7eef7bd, 55eb17e, bcdf3b4)
38
+ - Refactor `Client#response` exception handling (29afcb0)
39
+ - Rename `errors` to `exceptions` (2bca96b)
40
+ - Spec cleanup (4b84f16, 4940e9c)
21
41
 
22
42
  ## 0.1.2 / 2019-01-03
23
43
 
24
- - Expand supported Ruby versions to include 2.6 ([1d61fea](https://github.com/jgarber623/webmention-verification-ruby/commit/1d61fea)).
44
+ - Expand supported Ruby versions to include 2.6 (1d61fea)
25
45
 
26
46
  ## 0.1.1 / 2018-11-11
27
47
 
28
- - Liberalize gemspec dependency constraints ([063c7f1](https://github.com/jgarber623/webmention-verification-ruby/commit063c7f1)).
48
+ - Liberalize gemspec dependency constraints (063c7f1)
29
49
 
30
50
  ## 0.1.0 / 2018-07-11
31
51
 
@@ -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.6 and is additionally tested against Ruby 2.5.5 and 2.6.3 using [Travis CI](https://travis-ci.com/jgarber623/webmention-verification-ruby).
11
+ webmention-verification-ruby is developed using Ruby 2.5.8 and is additionally tested against Ruby 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.6. 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.6 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.5.8. 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.5.8 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.89.1'
11
+ gem 'rubocop-performance', '~> 1.7'
12
+ gem 'rubocop-rspec', '~> 1.43'
13
+ gem 'simplecov', '~> 0.19.0'
14
+ gem 'simplecov-console', '~> 0.7.2'
15
+ gem 'webmock', '~> 3.8'
data/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  [![Gem](https://img.shields.io/gem/v/webmention-verification.svg?style=for-the-badge)](https://rubygems.org/gems/webmention-verification)
6
6
  [![Downloads](https://img.shields.io/gem/dt/webmention-verification.svg?style=for-the-badge)](https://rubygems.org/gems/webmention-verification)
7
- [![Build](https://img.shields.io/travis/com/jgarber623/webmention-verification-ruby/master.svg?style=for-the-badge)](https://travis-ci.com/jgarber623/webmention-verification-ruby)
7
+ [![Build](https://img.shields.io/travis/com/jgarber623/webmention-verification-ruby/main.svg?style=for-the-badge)](https://travis-ci.com/jgarber623/webmention-verification-ruby)
8
8
  [![Dependencies](https://img.shields.io/depfu/jgarber623/webmention-verification-ruby.svg?style=for-the-badge)](https://depfu.com/github/jgarber623/webmention-verification-ruby)
9
9
  [![Maintainability](https://img.shields.io/codeclimate/maintainability/jgarber623/webmention-verification-ruby.svg?style=for-the-badge)](https://codeclimate.com/github/jgarber623/webmention-verification-ruby)
10
10
  [![Coverage](https://img.shields.io/codeclimate/c/jgarber623/webmention-verification-ruby.svg?style=for-the-badge)](https://codeclimate.com/github/jgarber623/webmention-verification-ruby/code)
@@ -12,13 +12,13 @@
12
12
  ## Key Features
13
13
 
14
14
  - Compliant with [Section 3.2.2](https://www.w3.org/TR/webmention/#webmention-verification) of [the W3C's Webmention Recommendation](https://www.w3.org/TR/webmention/).
15
- - Supports Ruby 2.4 and newer.
15
+ - Supports Ruby 2.5 and newer.
16
16
 
17
17
  ## Getting Started
18
18
 
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).
19
+ Before installing and using webmention-verification-ruby, you'll want to have [Ruby](https://www.ruby-lang.org) 2.5 (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.6 and is additionally tested against Ruby 2.5.5 and 2.6.3 using [Travis CI](https://travis-ci.com/jgarber623/webmention-verification-ruby).
21
+ webmention-verification-ruby is developed using Ruby 2.5.8 and is additionally tested against Ruby 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
  ```
@@ -155,7 +155,7 @@ webmention-verification-ruby will also raise a `Webmention::Verification::Unsupp
155
155
 
156
156
  ## Contributing
157
157
 
158
- Interested in helping improve webmention-verification-ruby? Awesome! Your help is greatly appreciated. See [CONTRIBUTING.md](https://github.com/jgarber623/webmention-verification-ruby/blob/master/CONTRIBUTING.md) for details.
158
+ Interested in helping improve webmention-verification-ruby? Awesome! Your help is greatly appreciated. See [CONTRIBUTING.md](https://github.com/jgarber623/webmention-verification-ruby/blob/main/CONTRIBUTING.md) for details.
159
159
 
160
160
  ## Acknowledgments
161
161
 
@@ -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 = '1.1.0'.freeze
3
+ VERSION = '4.0.0'.freeze
4
4
  end
5
5
  end
@@ -1,11 +1,7 @@
1
- lib = File.expand_path('lib', __dir__)
2
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
1
+ require_relative 'lib/webmention/verification/version'
3
2
 
4
- require 'webmention/verification/version'
5
-
6
- # rubocop:disable Metrics/BlockLength
7
3
  Gem::Specification.new do |spec|
8
- spec.required_ruby_version = ['>= 2.4', '< 2.7']
4
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.5', '< 2.8')
9
5
 
10
6
  spec.name = 'webmention-verification'
11
7
  spec.version = Webmention::Verification::VERSION
@@ -17,27 +13,16 @@ Gem::Specification.new do |spec|
17
13
  spec.homepage = 'https://github.com/jgarber623/webmention-verification-ruby'
18
14
  spec.license = 'MIT'
19
15
 
20
- 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
21
19
 
22
20
  spec.require_paths = ['lib']
23
21
 
24
- spec.metadata = {
25
- 'bug_tracker_uri' => "#{spec.homepage}/issues",
26
- 'changelog_uri' => "#{spec.homepage}/blob/v#{spec.version}/CHANGELOG.md"
27
- }
28
-
29
- spec.add_development_dependency 'rake', '~> 12.3'
30
- spec.add_development_dependency 'reek', '~> 5.4'
31
- spec.add_development_dependency 'rspec', '~> 3.8'
32
- spec.add_development_dependency 'rubocop', '~> 0.68.1'
33
- spec.add_development_dependency 'rubocop-performance', '~> 1.1'
34
- spec.add_development_dependency 'rubocop-rspec', '~> 1.32'
35
- spec.add_development_dependency 'simplecov', '~> 0.16.1'
36
- spec.add_development_dependency 'simplecov-console', '~> 0.4.2'
37
- spec.add_development_dependency 'webmock', '~> 3.5'
22
+ spec.metadata['bug_tracker_uri'] = "#{spec.homepage}/issues"
23
+ spec.metadata['changelog_uri'] = "#{spec.homepage}/blob/v#{spec.version}/CHANGELOG.md"
38
24
 
39
- spec.add_runtime_dependency 'addressable', '~> 2.6'
40
- spec.add_runtime_dependency 'http', '~> 5.0.0.pre'
25
+ spec.add_runtime_dependency 'addressable', '~> 2.7'
26
+ spec.add_runtime_dependency 'http', '~> 4.4'
41
27
  spec.add_runtime_dependency 'nokogiri', '~> 1.10'
42
28
  end
43
- # rubocop:enable Metrics/BlockLength
metadata CHANGED
@@ -1,169 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webmention-verification
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 4.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: 2019-05-02 00:00:00.000000000 Z
11
+ date: 2020-08-24 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: '12.3'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '12.3'
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.4'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '5.4'
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.8'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '3.8'
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.68.1
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: 0.68.1
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.1'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '1.1'
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.32'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: '1.32'
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.16.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.16.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.4.2
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - "~>"
123
- - !ruby/object:Gem::Version
124
- version: 0.4.2
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.5'
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - "~>"
137
- - !ruby/object:Gem::Version
138
- version: '3.5'
139
13
  - !ruby/object:Gem::Dependency
140
14
  name: addressable
141
15
  requirement: !ruby/object:Gem::Requirement
142
16
  requirements:
143
17
  - - "~>"
144
18
  - !ruby/object:Gem::Version
145
- version: '2.6'
19
+ version: '2.7'
146
20
  type: :runtime
147
21
  prerelease: false
148
22
  version_requirements: !ruby/object:Gem::Requirement
149
23
  requirements:
150
24
  - - "~>"
151
25
  - !ruby/object:Gem::Version
152
- version: '2.6'
26
+ version: '2.7'
153
27
  - !ruby/object:Gem::Dependency
154
28
  name: http
155
29
  requirement: !ruby/object:Gem::Requirement
156
30
  requirements:
157
31
  - - "~>"
158
32
  - !ruby/object:Gem::Version
159
- version: 5.0.0.pre
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: 5.0.0.pre
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/v1.1.0/CHANGELOG.md
92
+ changelog_uri: https://github.com/jgarber623/webmention-verification-ruby/blob/v4.0.0/CHANGELOG.md
220
93
  post_install_message:
221
94
  rdoc_options: []
222
95
  require_paths:
@@ -225,17 +98,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
225
98
  requirements:
226
99
  - - ">="
227
100
  - !ruby/object:Gem::Version
228
- version: '2.4'
101
+ version: '2.5'
229
102
  - - "<"
230
103
  - !ruby/object:Gem::Version
231
- version: '2.7'
104
+ version: '2.8'
232
105
  required_rubygems_version: !ruby/object:Gem::Requirement
233
106
  requirements:
234
107
  - - ">="
235
108
  - !ruby/object:Gem::Version
236
109
  version: '0'
237
110
  requirements: []
238
- rubygems_version: 3.0.3
111
+ rubygems_version: 3.1.2
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