webmention 3.0.0 → 6.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 +41 -0
- 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 +28 -0
- data/lib/webmention/parsers/html_parser.rb +33 -19
- data/lib/webmention/parsers/json_parser.rb +43 -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 +16 -13
- metadata +24 -57
- data/.editorconfig +0 -10
- data/.gitignore +0 -34
- data/.reek.yml +0 -8
- data/.rubocop +0 -3
- data/.rubocop.yml +0 -28
- data/.ruby-version +0 -1
- data/.simplecov +0 -12
- data/.travis.yml +0 -16
- data/Gemfile +0 -15
- 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,114 +1,80 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webmention
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 6.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
8
|
-
- Nat Welch
|
7
|
+
- Jason Garber
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2022-05-13 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
|
-
- !ruby/object:Gem::Dependency
|
15
|
-
name: absolutely
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
requirements:
|
18
|
-
- - "~>"
|
19
|
-
- !ruby/object:Gem::Version
|
20
|
-
version: '4.0'
|
21
|
-
type: :runtime
|
22
|
-
prerelease: false
|
23
|
-
version_requirements: !ruby/object:Gem::Requirement
|
24
|
-
requirements:
|
25
|
-
- - "~>"
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
version: '4.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
13
|
- !ruby/object:Gem::Dependency
|
43
14
|
name: http
|
44
15
|
requirement: !ruby/object:Gem::Requirement
|
45
16
|
requirements:
|
46
17
|
- - "~>"
|
47
18
|
- !ruby/object:Gem::Version
|
48
|
-
version: '
|
19
|
+
version: '5.0'
|
49
20
|
type: :runtime
|
50
21
|
prerelease: false
|
51
22
|
version_requirements: !ruby/object:Gem::Requirement
|
52
23
|
requirements:
|
53
24
|
- - "~>"
|
54
25
|
- !ruby/object:Gem::Version
|
55
|
-
version: '
|
26
|
+
version: '5.0'
|
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: '7.1'
|
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: '7.1'
|
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.
|
54
|
+
version: '1.13'
|
84
55
|
description: A Ruby gem for sending 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,7 +82,8 @@ 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/
|
85
|
+
changelog_uri: https://github.com/indieweb/webmention-client-ruby/blob/v6.0.0/CHANGELOG.md
|
86
|
+
rubygems_mfa_required: 'true'
|
120
87
|
post_install_message:
|
121
88
|
rdoc_options: []
|
122
89
|
require_paths:
|
@@ -125,17 +92,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
125
92
|
requirements:
|
126
93
|
- - ">="
|
127
94
|
- !ruby/object:Gem::Version
|
128
|
-
version: '2.
|
95
|
+
version: '2.6'
|
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.
|
105
|
+
rubygems_version: 3.3.12
|
139
106
|
signing_key:
|
140
107
|
specification_version: 4
|
141
108
|
summary: Webmention notification client
|
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,28 +0,0 @@
|
|
1
|
-
require:
|
2
|
-
- rubocop-performance
|
3
|
-
|
4
|
-
AllCops:
|
5
|
-
NewCops: enable
|
6
|
-
|
7
|
-
Layout/HashAlignment:
|
8
|
-
EnforcedColonStyle: table
|
9
|
-
EnforcedHashRocketStyle: table
|
10
|
-
|
11
|
-
Layout/LineLength:
|
12
|
-
Enabled: false
|
13
|
-
|
14
|
-
Metrics/BlockLength:
|
15
|
-
Exclude:
|
16
|
-
- test/**/*
|
17
|
-
|
18
|
-
Naming/RescuedExceptionsVariableName:
|
19
|
-
PreferredName: exception
|
20
|
-
|
21
|
-
Style/Documentation:
|
22
|
-
Enabled: false
|
23
|
-
|
24
|
-
Style/FrozenStringLiteralComment:
|
25
|
-
Enabled: false
|
26
|
-
|
27
|
-
Style/SymbolArray:
|
28
|
-
Enabled: false
|
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
2.4.10
|
data/.simplecov
DELETED
data/.travis.yml
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
dist: bionic
|
2
|
-
language: ruby
|
3
|
-
rvm:
|
4
|
-
- 2.4
|
5
|
-
- 2.5
|
6
|
-
- 2.6
|
7
|
-
- 2.7
|
8
|
-
cache: bundler
|
9
|
-
before_script:
|
10
|
-
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
11
|
-
- chmod +x ./cc-test-reporter
|
12
|
-
- ./cc-test-reporter before-build
|
13
|
-
after_script:
|
14
|
-
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
15
|
-
notifications:
|
16
|
-
email: false
|
data/Gemfile
DELETED
@@ -1,15 +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', '~> 0.83.0'
|
12
|
-
gem 'rubocop-performance', '~> 1.5'
|
13
|
-
gem 'simplecov', '~> 0.18.5'
|
14
|
-
gem 'simplecov-console', '~> 0.7.2'
|
15
|
-
gem 'webmock', '~> 3.8'
|
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
|