webmention-verification 1.1.1 → 5.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: 10cd01814d4daade81554a7224dce8439e95b82382b49d0d5a768db64b27b9cc
4
- data.tar.gz: 181132c149e3c86ac7f93ce7e05391c88c37fd42fe340cb22765b6a1fb5ce30f
3
+ metadata.gz: f857c41d6b22400c2fe19dd21a170dd7309d20bb34a6e2c23d6aad50894e44f6
4
+ data.tar.gz: 938305729f91102b6c7c8d372975e12a0724be00a43313cd1a715affcc9e9fbf
5
5
  SHA512:
6
- metadata.gz: d73f1c43ef9adb8a8df7348d495e38e5440a2b097dc1730f14c68328b518f9aab23ffaa5d9524e519d95ab3c9295dc9434e1520a647746fe896ac7315b3734a0
7
- data.tar.gz: 83f12d65eb52f66d51e9208961ce809f96adf61d9d68ee3ebfeb3670b23c62c678f1551f66d2c8f153cff6156558d5107b31649c2b313dff56719e950926ecc9
6
+ metadata.gz: 7b67afd1e2f1397439a465eba1cc9d639c959888e82b64de83fb85273bff2eb0ec0623103377504970a269948e214d5db117a938f7d7eb6d90bc24a991444654
7
+ data.tar.gz: 000c06f6b3951d487c8b5bbfd7a36e63be5bda7cf1c3d104861814bacd3088830b7e1c439ecb5cf93f4d7fd393bf527f7424fc4c7c8eb9ba15dbf329ac6c4d6d
data/CHANGELOG.md CHANGED
@@ -1,5 +1,34 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.0.0 / 2021-06-08
4
+
5
+ - Add `Webmention::Verification::Client#inspect` method (361c437)
6
+ - Update [HTTP](https://github.com/httprb/http) gem constraint to ~> 5.0 (4063764)
7
+ - Simplify exception handling (3f8f12c)
8
+ - Rename base `WebmentionVerificationError` class to `Error` (2b12338)
9
+ - Add support for Ruby 3.0 (05baf08)
10
+ - Update development Ruby version to 2.5.9 (821a488)
11
+
12
+ ## 4.0.0 / 2020-08-23
13
+
14
+ - **Breaking Change:** Update minimum supported Ruby version to 2.5 (096012e)
15
+ - Update development Ruby version to 2.5.8 (3b3f38e)
16
+
17
+ ## 3.0.0 / 2020-05-14
18
+
19
+ - **Breaking Change:** Remove `Webmention::Verification.client` convenience method (af575d7)
20
+ - **Breaking Change:** Remove `HttpRequest` class (112f9d3)
21
+ - Move development dependencies to `Gemfile` (81cdfdf)
22
+ - Update development Ruby version to 2.4.10 (a13bca0)
23
+
24
+ ## 2.0.0 / 2020-01-25
25
+
26
+ - Downgrade [HTTP](https://github.com/httprb/http) gem constraint to ~> 4.3 (090f590)
27
+
28
+ ## 1.2.0 / 2020-01-20
29
+
30
+ - Expand supported Ruby versions to include 2.7 (48d9b7b)
31
+
3
32
  ## 1.1.1 / 2019-08-31
4
33
 
5
34
  - Update Addressable gem (0c9368e)
data/CONTRIBUTING.md CHANGED
@@ -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.7 and is additionally tested against Ruby 2.5 and 2.6 using [Travis CI](https://travis-ci.com/jgarber623/webmention-verification-ruby).
11
+ webmention-verification-ruby is developed using Ruby 2.5.9 and is additionally tested against Ruby 2.6, 2.7, and 3.0 using [CircleCI](https://app.circleci.com/pipelines/github/jgarber623/webmention-verification-ruby).
12
12
 
13
- Before making changes to webmention-verification-ruby, you'll want to install Ruby 2.4.7. 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.7 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.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.5.9 using your method of choice, install the project's gems by running:
14
14
 
15
15
  ```sh
16
16
  bundle install
@@ -22,7 +22,7 @@ bundle install
22
22
  1. Install development dependencies as outlined above.
23
23
  1. Create a feature branch for the code changes you're looking to make: `git checkout -b my-new-feature`.
24
24
  1. _Write some code!_
25
- 1. If your changes would benefit from testing, add the necessary tests and verify everything passes by running `bundle exec rspec`.
25
+ 1. If your changes would benefit from testing, add the necessary tests and verify everything passes by running `bin/ci`.
26
26
  1. Commit your changes: `git commit -am 'Add some new feature or fix some issue'`. _(See [this excellent article](https://chris.beams.io/posts/git-commit/) for tips on writing useful Git commit messages.)_
27
27
  1. Push the branch to your fork: `git push -u origin my-new-feature`.
28
28
  1. Create a new [pull request][pulls] and we'll review your changes.
data/README.md CHANGED
@@ -2,23 +2,22 @@
2
2
 
3
3
  **A Ruby gem for verifying a received [webmention](https://indieweb.org/Webmention).**
4
4
 
5
- [![Gem](https://img.shields.io/gem/v/webmention-verification.svg?style=for-the-badge)](https://rubygems.org/gems/webmention-verification)
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)
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
- [![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
- [![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)
5
+ [![Gem](https://img.shields.io/gem/v/webmention-verification.svg?logo=rubygems&style=for-the-badge)](https://rubygems.org/gems/webmention-verification)
6
+ [![Downloads](https://img.shields.io/gem/dt/webmention-verification.svg?logo=rubygems&style=for-the-badge)](https://rubygems.org/gems/webmention-verification)
7
+ [![Build](https://img.shields.io/circleci/build/github/jgarber623/webmention-verification-ruby?logo=circleci&style=for-the-badge)](https://app.circleci.com/pipelines/github/jgarber623/webmention-verification-ruby)
8
+ [![Maintainability](https://img.shields.io/codeclimate/maintainability/jgarber623/webmention-verification-ruby.svg?logo=code-climate&style=for-the-badge)](https://codeclimate.com/github/jgarber623/webmention-verification-ruby)
9
+ [![Coverage](https://img.shields.io/codeclimate/c/jgarber623/webmention-verification-ruby.svg?logo=code-climate&style=for-the-badge)](https://codeclimate.com/github/jgarber623/webmention-verification-ruby/code)
11
10
 
12
11
  ## Key Features
13
12
 
14
13
  - 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.
14
+ - Supports Ruby 2.5 and newer.
16
15
 
17
16
  ## Getting Started
18
17
 
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).
18
+ 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
19
 
21
- webmention-verification-ruby is developed using Ruby 2.4.7 and is additionally tested against Ruby 2.5 and 2.6 using [Travis CI](https://travis-ci.com/jgarber623/webmention-verification-ruby).
20
+ webmention-verification-ruby is developed using Ruby 2.5.9 and is additionally tested against Ruby 2.6, 2.7, and 3.0 using [CircleCI](https://app.circleci.com/pipelines/github/jgarber623/webmention-verification-ruby).
22
21
 
23
22
  ## Installation
24
23
 
@@ -65,7 +64,7 @@ require 'webmention/verification'
65
64
  source = 'https://source.example.com/post/100'
66
65
  target = 'https://target.example.com/post/100'
67
66
 
68
- client = Webmention::Verification.client(source, target)
67
+ client = Webmention::Verification::Client.new(source, target)
69
68
 
70
69
  puts client.source # => 'https://source.example.com/post/100'
71
70
  puts client.target # => 'https://target.example.com/post/100'
@@ -88,7 +87,7 @@ require 'webmention/verification'
88
87
  source = 'https://source.example.com/post/100'
89
88
  target = 'https://target.example.com/post/100'
90
89
 
91
- client = Webmention::Verification.client(source, target, strict: false)
90
+ client = Webmention::Verification::Client.new(source, target, strict: false)
92
91
 
93
92
  puts client.verified? # => Boolean true or false
94
93
  ```
@@ -139,7 +138,7 @@ In the example above, `verifier.results` will return an array of HTML elements t
139
138
 
140
139
  ### Exception Handling
141
140
 
142
- There are several exceptions that may be raised by webmention-verification-ruby's underlying dependencies. These errors are raised as subclasses of `WebmentionVerificationError` (which itself is a subclass of `StandardError`).
141
+ There are several exceptions that may be raised by webmention-verification-ruby's underlying dependencies. These errors are raised as subclasses of `Webmention::Verification::Error` (which itself is a subclass of `StandardError`).
143
142
 
144
143
  From [sporkmonger/addressable](https://github.com/sporkmonger/addressable):
145
144
 
@@ -147,15 +146,13 @@ From [sporkmonger/addressable](https://github.com/sporkmonger/addressable):
147
146
 
148
147
  From [httprb/http](https://github.com/httprb/http):
149
148
 
150
- - `Webmention::Verification::ConnectionError`
151
- - `Webmention::Verification::TimeoutError`
152
- - `Webmention::Verification::TooManyRedirectsError`
149
+ - `Webmention::Verification::HttpError`
153
150
 
154
151
  webmention-verification-ruby will also raise a `Webmention::Verification::UnsupportedMimeTypeError` when encountering an `HTTP::Response` instance with an unsupported MIME type.
155
152
 
156
153
  ## Contributing
157
154
 
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.
155
+ 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
156
 
160
157
  ## Acknowledgments
161
158
 
@@ -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,40 +1,72 @@
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
- raise ArgumentError, "source must be a String (given #{source.class.name})" unless source.is_a?(String)
8
- raise ArgumentError, "target must be a String (given #{target.class.name})" unless target.is_a?(String)
9
-
10
- @source = source
11
- @target = target
27
+ @source = source.to_str
28
+ @target = target.to_str
12
29
  @options = options
13
30
 
14
31
  raise ArgumentError, 'source must be an absolute URI (e.g. https://example.com/post/100)' unless source_uri.absolute?
15
32
  raise ArgumentError, 'target must be an absolute URI (e.g. https://example.com/post/100)' unless target_uri.absolute?
16
33
  end
17
34
 
35
+ # @return [String]
36
+ def inspect
37
+ format(%(#<#{self.class.name}:%#0x source: #{source.inspect} target: #{target.inspect} options: #{@options.inspect}>), object_id)
38
+ end
39
+
40
+ # @return [HTTP::Response]
41
+ # @raise [Webmention::Verification::ConnectionError, Webmention::Verification::TimeoutError, Webmention::Verification::TooManyRedirectsError]
18
42
  def response
19
- @response ||= HttpRequest.get(source_uri)
43
+ @response ||= HTTP.follow.headers(HTTP_CLIENT_HEADERS).timeout(connect: 10, read: 10).get(source_uri)
44
+ rescue HTTP::Error => exception
45
+ raise HttpError, 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
 
37
- verifier_for_mime_type.new(response, target, @options).verified?
69
+ verifier_for_mime_type.new(response, target, **@options).verified?
38
70
  end
39
71
 
40
72
  private
@@ -1,17 +1,13 @@
1
1
  module Webmention
2
2
  module Verification
3
- class WebmentionVerificationError < StandardError; end
3
+ class Error < StandardError; end
4
4
 
5
- class ArgumentError < WebmentionVerificationError; end
5
+ class ArgumentError < Error; end
6
6
 
7
- class ConnectionError < WebmentionVerificationError; end
7
+ class HttpError < Error; end
8
8
 
9
- class InvalidURIError < WebmentionVerificationError; end
9
+ class InvalidURIError < Error; end
10
10
 
11
- class TimeoutError < WebmentionVerificationError; end
12
-
13
- class TooManyRedirectsError < WebmentionVerificationError; end
14
-
15
- class UnsupportedMimeTypeError < WebmentionVerificationError; end
11
+ class UnsupportedMimeTypeError < Error; end
16
12
  end
17
13
  end
@@ -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,41 @@
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
+ @response = response
10
+ @target = target.to_str
11
+ @options = options
12
+
13
+ raise UnsupportedMimeTypeError, "Unsupported MIME Type: #{response.mime_type}" unless self.class.mime_types.include?(response.mime_type)
14
+ end
15
+
16
+ def results
17
+ @results ||= parse_response_body
18
+ end
19
+
20
+ def verified?
21
+ results.any?
22
+ end
23
+
24
+ private
25
+
26
+ def response_body
27
+ @response_body ||= @response.body.to_s
28
+ end
29
+
30
+ def target_regexp
31
+ @target_regexp ||= /^#{target_regexp_str}$/
32
+ end
33
+
34
+ def target_regexp_str
35
+ return @target if @options.fetch(:strict, true)
36
+
37
+ @target.sub(%r{https?://}, 'https?://')
38
+ end
39
+ end
40
+ end
41
+ 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.1'.freeze
3
+ VERSION = '5.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.7']
4
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.5', '< 4')
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['lib/**/*'].reject { |f| File.directory?(f) }
17
+ spec.files += %w[LICENSE CHANGELOG.md CONTRIBUTING.md README.md]
18
+ spec.files += %w[webmention-verification.gemspec]
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', '~> 12.3'
29
- spec.add_development_dependency 'reek', '~> 5.4'
30
- spec.add_development_dependency 'rspec', '~> 3.8'
31
- spec.add_development_dependency 'rubocop', '~> 0.74.0'
32
- spec.add_development_dependency 'rubocop-performance', '~> 1.4'
33
- spec.add_development_dependency 'rubocop-rspec', '~> 1.35'
34
- spec.add_development_dependency 'simplecov', '~> 0.17.0'
35
- spec.add_development_dependency 'simplecov-console', '~> 0.5.0'
36
- spec.add_development_dependency 'webmock', '~> 3.7'
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', '~> 5.0.0.pre'
40
- spec.add_runtime_dependency 'nokogiri', '~> 1.10'
26
+ spec.add_runtime_dependency 'http', '~> 5.0'
27
+ spec.add_runtime_dependency 'nokogiri', '~> 1.11'
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: 1.1.1
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Garber
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-31 00:00:00.000000000 Z
11
+ date: 2021-06-09 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.74.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.74.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.4'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '1.4'
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.35'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: '1.35'
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.0
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.0
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.5.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.5.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.7'
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - "~>"
137
- - !ruby/object:Gem::Version
138
- version: '3.7'
139
13
  - !ruby/object:Gem::Dependency
140
14
  name: addressable
141
15
  requirement: !ruby/object:Gem::Requirement
@@ -156,28 +30,28 @@ dependencies:
156
30
  requirements:
157
31
  - - "~>"
158
32
  - !ruby/object:Gem::Version
159
- version: 5.0.0.pre
33
+ version: '5.0'
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: '5.0'
167
41
  - !ruby/object:Gem::Dependency
168
42
  name: nokogiri
169
43
  requirement: !ruby/object:Gem::Requirement
170
44
  requirements:
171
45
  - - "~>"
172
46
  - !ruby/object:Gem::Version
173
- version: '1.10'
47
+ version: '1.11'
174
48
  type: :runtime
175
49
  prerelease: false
176
50
  version_requirements: !ruby/object:Gem::Requirement
177
51
  requirements:
178
52
  - - "~>"
179
53
  - !ruby/object:Gem::Version
180
- version: '1.10'
54
+ version: '1.11'
181
55
  description: Verify a received webmention.
182
56
  email:
183
57
  - jason@sixtwothree.org
@@ -185,27 +59,15 @@ executables: []
185
59
  extensions: []
186
60
  extra_rdoc_files: []
187
61
  files:
188
- - ".editorconfig"
189
- - ".gitignore"
190
- - ".reek.yml"
191
- - ".rspec"
192
- - ".rubocop"
193
- - ".rubocop.yml"
194
- - ".ruby-version"
195
- - ".simplecov"
196
- - ".travis.yml"
197
62
  - CHANGELOG.md
198
63
  - CONTRIBUTING.md
199
- - Gemfile
200
64
  - LICENSE
201
65
  - README.md
202
- - Rakefile
203
66
  - lib/webmention/verification.rb
204
67
  - lib/webmention/verification/client.rb
205
68
  - lib/webmention/verification/exceptions.rb
206
- - lib/webmention/verification/http_request.rb
207
- - lib/webmention/verification/registerable.rb
208
69
  - lib/webmention/verification/verifiers.rb
70
+ - lib/webmention/verification/verifiers/base_verifier.rb
209
71
  - lib/webmention/verification/verifiers/html_verifier.rb
210
72
  - lib/webmention/verification/verifiers/json_verifier.rb
211
73
  - lib/webmention/verification/verifiers/plaintext_verifier.rb
@@ -216,8 +78,8 @@ licenses:
216
78
  - MIT
217
79
  metadata:
218
80
  bug_tracker_uri: https://github.com/jgarber623/webmention-verification-ruby/issues
219
- changelog_uri: https://github.com/jgarber623/webmention-verification-ruby/blob/v1.1.1/CHANGELOG.md
220
- post_install_message:
81
+ changelog_uri: https://github.com/jgarber623/webmention-verification-ruby/blob/v5.0.0/CHANGELOG.md
82
+ post_install_message:
221
83
  rdoc_options: []
222
84
  require_paths:
223
85
  - lib
@@ -225,18 +87,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
225
87
  requirements:
226
88
  - - ">="
227
89
  - !ruby/object:Gem::Version
228
- version: '2.4'
90
+ version: '2.5'
229
91
  - - "<"
230
92
  - !ruby/object:Gem::Version
231
- version: '2.7'
93
+ version: '4'
232
94
  required_rubygems_version: !ruby/object:Gem::Requirement
233
95
  requirements:
234
96
  - - ">="
235
97
  - !ruby/object:Gem::Version
236
98
  version: '0'
237
99
  requirements: []
238
- rubygems_version: 3.0.6
239
- signing_key:
100
+ rubygems_version: 3.2.16
101
+ signing_key:
240
102
  specification_version: 4
241
103
  summary: Verify a received webmention.
242
104
  test_files: []
data/.editorconfig DELETED
@@ -1,14 +0,0 @@
1
- # EditorConfig is awesome: https://EditorConfig.org
2
- root = true
3
-
4
- [*]
5
- charset = utf-8
6
- end_of_line = lf
7
- insert_final_newline = true
8
- indent_size = 2
9
- indent_style = space
10
- trim_trailing_whitespace = true
11
-
12
- [*.md]
13
- indent_size = 4
14
- indent_style = tab
data/.gitignore DELETED
@@ -1,34 +0,0 @@
1
- *.gem
2
- *.rbc
3
- /.config
4
- /coverage/
5
- /InstalledFiles
6
- /pkg/
7
- /spec/reports/
8
- /spec/examples.txt
9
- /test/tmp/
10
- /test/version_tmp/
11
- /tmp/
12
-
13
- # Used by dotenv library to load environment variables.
14
- # .env
15
-
16
- # Documentation cache and generated files:
17
- /.yardoc/
18
- /_yardoc/
19
- /doc/
20
- /rdoc/
21
-
22
- # Environment normalization:
23
- /.bundle/
24
- /vendor/bundle
25
- /lib/bundler/man/
26
-
27
- # for a library or gem, you might want to ignore these files since the code is
28
- # intended to run in multiple environments; otherwise, check them in:
29
- Gemfile.lock
30
- # .ruby-version
31
- # .ruby-gemset
32
-
33
- # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
34
- .rvmrc
data/.reek.yml DELETED
@@ -1,11 +0,0 @@
1
- detectors:
2
- DuplicateMethodCall:
3
- max_calls: 3
4
- IrresponsibleModule:
5
- enabled: false
6
- UtilityFunction:
7
- exclude:
8
- - FixtureHelpers#read_fixture
9
-
10
- exclude_paths:
11
- - vendor/
data/.rspec DELETED
@@ -1,2 +0,0 @@
1
- --order random
2
- --require spec_helper
data/.rubocop DELETED
@@ -1,3 +0,0 @@
1
- --display-style-guide
2
- --extra-details
3
- --parallel
data/.rubocop.yml DELETED
@@ -1,30 +0,0 @@
1
- require:
2
- - rubocop-performance
3
- - rubocop-rspec
4
-
5
- Layout/AlignHash:
6
- EnforcedColonStyle: table
7
- EnforcedHashRocketStyle: table
8
-
9
- Metrics/BlockLength:
10
- Exclude:
11
- - webmention-verification.gemspec
12
- - spec/**/*.rb
13
-
14
- Metrics/LineLength:
15
- Enabled: false
16
-
17
- Naming/RescuedExceptionsVariableName:
18
- PreferredName: exception
19
-
20
- RSpec/NestedGroups:
21
- Max: 4
22
-
23
- Style/Documentation:
24
- Enabled: false
25
-
26
- Style/FrozenStringLiteralComment:
27
- Enabled: false
28
-
29
- Style/SymbolArray:
30
- Enabled: false
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- 2.4.7
data/.simplecov DELETED
@@ -1,11 +0,0 @@
1
- require 'simplecov-console'
2
-
3
- formatters = [SimpleCov::Formatter::HTMLFormatter]
4
-
5
- if RSpec.configuration.files_to_run.length > 1
6
- formatters << SimpleCov::Formatter::Console
7
- end
8
-
9
- SimpleCov.start do
10
- formatter SimpleCov::Formatter::MultiFormatter.new(formatters)
11
- end
data/.travis.yml DELETED
@@ -1,21 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.4
4
- - 2.5
5
- - 2.6
6
- cache:
7
- - bundler
8
- before_install:
9
- - gem update --system
10
- - gem install bundler
11
- before_script:
12
- - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
13
- - chmod +x ./cc-test-reporter
14
- - ./cc-test-reporter before-build
15
- after_script:
16
- - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
17
- notifications:
18
- email: false
19
- slack:
20
- rooms:
21
- secure: sZ7DfokMwpZOjZ1jHD4RF58PtNGu+knqrv194+WLmfqV+MVPU38L04EGP1c/Kj7rIOtTQnbkDC10TjJNfl+OcRbUKYT19SBN3OqJJbAe5H46nhvNCfISKG54fEpbEMTcOsljSLcKB6FR3o/RiJUorY2BwS3aMCsf8NDhm08Nnxub5abpFvpgiXCfGSRklxt/dfuJmHB0kt3B8EEH3UzuAeaJoFOiV5RYnCUG0z5GXgHeZqZBs5sxmsmQhrDh5o/Yr0FSd9vcHDLD8EgArw//KyV10cF84NSEWtvPpFCcTnMpcfIuzkN/vgLoIbgYbyhczktCXiySHZDOzYBsCngzLN6DjD+5SdQgrrvtUF/Qsi9JUc6ij1EVHhcZjis7x6kGGtPL35nsM3D0KYwTXzlDIfj/RybQpLCaLL78lrkTiL2OnR1CfKXPwS58+sv0raUJOlWJP50WIL6Fe3J4L+3NWNVfpHdU2SV1cP1/UIs+Pwn4LUOwhSUn+rGsG1UKB/ZDezUMLes9PNclOmDVs8GgT7Lkn2N43mIqVQOyeHrUAVvWiI6M8xOTiAbNGP9sjOj4yJzhOwOToP5Id3ts9GvMoayHd8d8cyECQ9dotNh3VlX73p+Yjkz6rEvo/bsXfzx8gmsl0QQ6P7b4afFRwm1GC+nIofm6BNUS6cfg0xPrmMs=
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in webmention-verification.gemspec
4
- gemspec
data/Rakefile DELETED
@@ -1,17 +0,0 @@
1
- require 'bundler/gem_tasks'
2
-
3
- require 'reek/rake/task'
4
- require 'rspec/core/rake_task'
5
- require 'rubocop/rake_task'
6
-
7
- Reek::Rake::Task.new do |task|
8
- task.fail_on_error = false
9
- end
10
-
11
- RSpec::Core::RakeTask.new
12
-
13
- RuboCop::RakeTask.new do |task|
14
- task.fail_on_error = false
15
- end
16
-
17
- task default: [:rubocop, :reek, :spec]
@@ -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