webmention 5.0.0 → 7.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +42 -3
- data/CONTRIBUTING.md +2 -2
- data/README.md +27 -69
- data/USAGE.md +153 -0
- data/lib/webmention/client.rb +116 -37
- data/lib/webmention/error_response.rb +40 -0
- data/lib/webmention/parser.rb +30 -0
- data/lib/webmention/parsers/html_parser.rb +36 -28
- data/lib/webmention/parsers/json_parser.rb +31 -0
- data/lib/webmention/parsers/plaintext_parser.rb +17 -0
- data/lib/webmention/request.rb +107 -0
- data/lib/webmention/response.rb +64 -0
- data/lib/webmention/url.rb +46 -0
- data/lib/webmention/verification.rb +79 -0
- data/lib/webmention/version.rb +3 -1
- data/lib/webmention.rb +85 -23
- data/webmention.gemspec +17 -14
- metadata +29 -62
- data/.editorconfig +0 -10
- data/.gitignore +0 -34
- data/.reek.yml +0 -8
- data/.rubocop +0 -3
- data/.rubocop.yml +0 -30
- data/.ruby-version +0 -1
- data/.simplecov +0 -12
- data/.travis.yml +0 -15
- data/Gemfile +0 -17
- data/Rakefile +0 -21
- data/lib/webmention/exceptions.rb +0 -15
- data/lib/webmention/parsers/base_parser.rb +0 -27
- data/lib/webmention/parsers.rb +0 -11
- data/lib/webmention/services/http_request_service.rb +0 -47
metadata
CHANGED
@@ -1,18 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webmention
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 7.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
8
|
-
|
9
|
-
autorequire:
|
7
|
+
- Jason Garber
|
8
|
+
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2022-11-10 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
14
|
+
name: http
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
16
|
requirements:
|
18
17
|
- - "~>"
|
@@ -25,90 +24,57 @@ dependencies:
|
|
25
24
|
- - "~>"
|
26
25
|
- !ruby/object:Gem::Version
|
27
26
|
version: '5.0'
|
28
|
-
- !ruby/object:Gem::Dependency
|
29
|
-
name: addressable
|
30
|
-
requirement: !ruby/object:Gem::Requirement
|
31
|
-
requirements:
|
32
|
-
- - "~>"
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: '2.7'
|
35
|
-
type: :runtime
|
36
|
-
prerelease: false
|
37
|
-
version_requirements: !ruby/object:Gem::Requirement
|
38
|
-
requirements:
|
39
|
-
- - "~>"
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
version: '2.7'
|
42
|
-
- !ruby/object:Gem::Dependency
|
43
|
-
name: http
|
44
|
-
requirement: !ruby/object:Gem::Requirement
|
45
|
-
requirements:
|
46
|
-
- - "~>"
|
47
|
-
- !ruby/object:Gem::Version
|
48
|
-
version: '4.4'
|
49
|
-
type: :runtime
|
50
|
-
prerelease: false
|
51
|
-
version_requirements: !ruby/object:Gem::Requirement
|
52
|
-
requirements:
|
53
|
-
- - "~>"
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
version: '4.4'
|
56
27
|
- !ruby/object:Gem::Dependency
|
57
28
|
name: indieweb-endpoints
|
58
29
|
requirement: !ruby/object:Gem::Requirement
|
59
30
|
requirements:
|
60
31
|
- - "~>"
|
61
32
|
- !ruby/object:Gem::Version
|
62
|
-
version: '
|
33
|
+
version: '8.0'
|
63
34
|
type: :runtime
|
64
35
|
prerelease: false
|
65
36
|
version_requirements: !ruby/object:Gem::Requirement
|
66
37
|
requirements:
|
67
38
|
- - "~>"
|
68
39
|
- !ruby/object:Gem::Version
|
69
|
-
version: '
|
40
|
+
version: '8.0'
|
70
41
|
- !ruby/object:Gem::Dependency
|
71
42
|
name: nokogiri
|
72
43
|
requirement: !ruby/object:Gem::Requirement
|
73
44
|
requirements:
|
74
|
-
- - "
|
45
|
+
- - ">="
|
75
46
|
- !ruby/object:Gem::Version
|
76
|
-
version: '1.
|
47
|
+
version: '1.13'
|
77
48
|
type: :runtime
|
78
49
|
prerelease: false
|
79
50
|
version_requirements: !ruby/object:Gem::Requirement
|
80
51
|
requirements:
|
81
|
-
- - "
|
52
|
+
- - ">="
|
82
53
|
- !ruby/object:Gem::Version
|
83
|
-
version: '1.
|
84
|
-
description: A Ruby gem for sending Webmention notifications.
|
54
|
+
version: '1.13'
|
55
|
+
description: A Ruby gem for sending and verifying Webmention notifications.
|
85
56
|
email:
|
86
|
-
-
|
57
|
+
- jason@sixtwothree.org
|
87
58
|
executables: []
|
88
59
|
extensions: []
|
89
60
|
extra_rdoc_files: []
|
90
61
|
files:
|
91
|
-
- ".editorconfig"
|
92
|
-
- ".gitignore"
|
93
|
-
- ".reek.yml"
|
94
|
-
- ".rubocop"
|
95
|
-
- ".rubocop.yml"
|
96
|
-
- ".ruby-version"
|
97
|
-
- ".simplecov"
|
98
|
-
- ".travis.yml"
|
99
62
|
- CHANGELOG.md
|
100
63
|
- CONTRIBUTING.md
|
101
|
-
- Gemfile
|
102
64
|
- LICENSE
|
103
65
|
- README.md
|
104
|
-
-
|
66
|
+
- USAGE.md
|
105
67
|
- lib/webmention.rb
|
106
68
|
- lib/webmention/client.rb
|
107
|
-
- lib/webmention/
|
108
|
-
- lib/webmention/
|
109
|
-
- lib/webmention/parsers/base_parser.rb
|
69
|
+
- lib/webmention/error_response.rb
|
70
|
+
- lib/webmention/parser.rb
|
110
71
|
- lib/webmention/parsers/html_parser.rb
|
111
|
-
- lib/webmention/
|
72
|
+
- lib/webmention/parsers/json_parser.rb
|
73
|
+
- lib/webmention/parsers/plaintext_parser.rb
|
74
|
+
- lib/webmention/request.rb
|
75
|
+
- lib/webmention/response.rb
|
76
|
+
- lib/webmention/url.rb
|
77
|
+
- lib/webmention/verification.rb
|
112
78
|
- lib/webmention/version.rb
|
113
79
|
- webmention.gemspec
|
114
80
|
homepage: https://github.com/indieweb/webmention-client-ruby
|
@@ -116,8 +82,9 @@ licenses:
|
|
116
82
|
- Apache-2.0
|
117
83
|
metadata:
|
118
84
|
bug_tracker_uri: https://github.com/indieweb/webmention-client-ruby/issues
|
119
|
-
changelog_uri: https://github.com/indieweb/webmention-client-ruby/blob/
|
120
|
-
|
85
|
+
changelog_uri: https://github.com/indieweb/webmention-client-ruby/blob/v7.0.0/CHANGELOG.md
|
86
|
+
rubygems_mfa_required: 'true'
|
87
|
+
post_install_message:
|
121
88
|
rdoc_options: []
|
122
89
|
require_paths:
|
123
90
|
- lib
|
@@ -125,18 +92,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
125
92
|
requirements:
|
126
93
|
- - ">="
|
127
94
|
- !ruby/object:Gem::Version
|
128
|
-
version: '2.
|
95
|
+
version: '2.7'
|
129
96
|
- - "<"
|
130
97
|
- !ruby/object:Gem::Version
|
131
|
-
version: '
|
98
|
+
version: '4'
|
132
99
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
133
100
|
requirements:
|
134
101
|
- - ">="
|
135
102
|
- !ruby/object:Gem::Version
|
136
103
|
version: '0'
|
137
104
|
requirements: []
|
138
|
-
rubygems_version: 3.
|
139
|
-
signing_key:
|
105
|
+
rubygems_version: 3.3.16
|
106
|
+
signing_key:
|
140
107
|
specification_version: 4
|
141
108
|
summary: Webmention notification client
|
142
109
|
test_files: []
|
data/.editorconfig
DELETED
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
data/.rubocop
DELETED
data/.rubocop.yml
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
require:
|
2
|
-
- rubocop-minitest
|
3
|
-
- rubocop-performance
|
4
|
-
- rubocop-rake
|
5
|
-
|
6
|
-
AllCops:
|
7
|
-
NewCops: enable
|
8
|
-
|
9
|
-
Layout/HashAlignment:
|
10
|
-
EnforcedColonStyle: table
|
11
|
-
EnforcedHashRocketStyle: table
|
12
|
-
|
13
|
-
Layout/LineLength:
|
14
|
-
Enabled: false
|
15
|
-
|
16
|
-
Metrics/BlockLength:
|
17
|
-
Exclude:
|
18
|
-
- test/**/*
|
19
|
-
|
20
|
-
Naming/RescuedExceptionsVariableName:
|
21
|
-
PreferredName: exception
|
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.5.8
|
data/.simplecov
DELETED
data/.travis.yml
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
dist: bionic
|
2
|
-
language: ruby
|
3
|
-
rvm:
|
4
|
-
- 2.5
|
5
|
-
- 2.6
|
6
|
-
- 2.7
|
7
|
-
cache: bundler
|
8
|
-
before_script:
|
9
|
-
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
10
|
-
- chmod +x ./cc-test-reporter
|
11
|
-
- ./cc-test-reporter before-build
|
12
|
-
after_script:
|
13
|
-
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
14
|
-
notifications:
|
15
|
-
email: false
|
data/Gemfile
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
# Specify gem's dependencies in webmention.gemspec
|
4
|
-
gemspec
|
5
|
-
|
6
|
-
gem 'minitest', '~> 5.14'
|
7
|
-
gem 'minitest-reporters', '~> 1.4'
|
8
|
-
gem 'pry-byebug', '~> 3.9'
|
9
|
-
gem 'rake', '~> 13.0'
|
10
|
-
gem 'reek', '~> 6.0'
|
11
|
-
gem 'rubocop', '~> 1.6'
|
12
|
-
gem 'rubocop-minitest', '~> 0.10.1'
|
13
|
-
gem 'rubocop-performance', '~> 1.9'
|
14
|
-
gem 'rubocop-rake', '~> 0.5.1'
|
15
|
-
gem 'simplecov', '~> 0.20.0'
|
16
|
-
gem 'simplecov-console', '~> 0.8.0'
|
17
|
-
gem 'webmock', '~> 3.10'
|
data/Rakefile
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'bundler/gem_tasks'
|
2
|
-
|
3
|
-
require 'rake/testtask'
|
4
|
-
require 'reek/rake/task'
|
5
|
-
require 'rubocop/rake_task'
|
6
|
-
|
7
|
-
Rake::TestTask.new(:test) do |t|
|
8
|
-
t.libs << 'test'
|
9
|
-
t.libs << 'lib'
|
10
|
-
t.test_files = FileList['test/**/*_test.rb']
|
11
|
-
end
|
12
|
-
|
13
|
-
Reek::Rake::Task.new do |task|
|
14
|
-
task.fail_on_error = false
|
15
|
-
end
|
16
|
-
|
17
|
-
RuboCop::RakeTask.new do |task|
|
18
|
-
task.fail_on_error = false
|
19
|
-
end
|
20
|
-
|
21
|
-
task default: [:rubocop, :reek, :test]
|
@@ -1,15 +0,0 @@
|
|
1
|
-
module Webmention
|
2
|
-
class WebmentionClientError < StandardError; end
|
3
|
-
|
4
|
-
class ArgumentError < WebmentionClientError; end
|
5
|
-
|
6
|
-
class ConnectionError < WebmentionClientError; end
|
7
|
-
|
8
|
-
class InvalidURIError < WebmentionClientError; end
|
9
|
-
|
10
|
-
class TimeoutError < WebmentionClientError; end
|
11
|
-
|
12
|
-
class TooManyRedirectsError < WebmentionClientError; end
|
13
|
-
|
14
|
-
class UnsupportedMimeTypeError < WebmentionClientError; end
|
15
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
module Webmention
|
2
|
-
module Parsers
|
3
|
-
class BaseParser
|
4
|
-
class << self
|
5
|
-
attr_reader :mime_types
|
6
|
-
end
|
7
|
-
|
8
|
-
def initialize(response)
|
9
|
-
raise ArgumentError, "response must be an HTTP::Response (given #{response.class.name})" unless response.is_a?(HTTP::Response)
|
10
|
-
|
11
|
-
@response = response
|
12
|
-
|
13
|
-
raise UnsupportedMimeTypeError, "Unsupported MIME Type: #{response.mime_type}" unless self.class.mime_types.include?(response.mime_type)
|
14
|
-
end
|
15
|
-
|
16
|
-
private
|
17
|
-
|
18
|
-
def response_body
|
19
|
-
@response_body ||= @response.body.to_s
|
20
|
-
end
|
21
|
-
|
22
|
-
def response_url
|
23
|
-
@response_url ||= @response.uri.to_s
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
data/lib/webmention/parsers.rb
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
module Webmention
|
2
|
-
module Services
|
3
|
-
module HttpRequestService
|
4
|
-
# Defaults derived from Webmention specification examples
|
5
|
-
# https://www.w3.org/TR/webmention/#limits-on-get-requests
|
6
|
-
# rubocop:disable Layout/HashAlignment
|
7
|
-
HTTP_CLIENT_OPTS = {
|
8
|
-
follow: {
|
9
|
-
max_hops: 20
|
10
|
-
},
|
11
|
-
headers: {
|
12
|
-
accept: '*/*',
|
13
|
-
user_agent: 'Webmention Client (https://rubygems.org/gems/webmention)'
|
14
|
-
},
|
15
|
-
timeout_options: {
|
16
|
-
connect_timeout: 5,
|
17
|
-
read_timeout: 5
|
18
|
-
}
|
19
|
-
}.freeze
|
20
|
-
# rubocop:enable Layout/HashAlignment
|
21
|
-
|
22
|
-
class << self
|
23
|
-
def get(uri)
|
24
|
-
request(:get, uri)
|
25
|
-
end
|
26
|
-
|
27
|
-
def post(uri, **options)
|
28
|
-
request(:post, uri, form: options)
|
29
|
-
end
|
30
|
-
|
31
|
-
private
|
32
|
-
|
33
|
-
def client
|
34
|
-
@client ||= HTTP::Client.new(HTTP_CLIENT_OPTS)
|
35
|
-
end
|
36
|
-
|
37
|
-
def request(method, uri, **options)
|
38
|
-
client.request(method, uri, options)
|
39
|
-
rescue HTTP::ConnectionError,
|
40
|
-
HTTP::TimeoutError,
|
41
|
-
HTTP::Redirector::TooManyRedirectsError => exception
|
42
|
-
raise Webmention.const_get(exception.class.name.split('::').last), exception
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|