indieweb-endpoints 7.1.0 → 8.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 +12 -0
- data/CONTRIBUTING.md +3 -3
- data/README.md +5 -5
- data/indieweb-endpoints.gemspec +3 -3
- data/lib/indieweb/endpoints/client.rb +7 -4
- data/lib/indieweb/endpoints/parser.rb +1 -0
- data/lib/indieweb/endpoints/response_headers_parser.rb +4 -4
- data/lib/indieweb/endpoints/version.rb +1 -1
- data/lib/indieweb/endpoints.rb +6 -3
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: efd7555091687973a996b1914f1a739e7933381dc149d7b67babdf739f8c7c0b
|
4
|
+
data.tar.gz: 744cf8171f987add528d18713c2869c954fa9f227c84508ae1d7ad30ea4cba17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a799aaede4a422adf01c660b7a7ed7b88b6d5907c7f30fef7bf6a12c1b50b2eba64c055ba7b47a3cb899e865552ae6ae124be657ebf7539dba6206baf7457c36
|
7
|
+
data.tar.gz: b6ebbaed9561e1b8773329f1782dad87c1a8415bd2849593ec529734eb07930bd9df52e55a9881cc3706003f7479f367cd001ab40802c216aee56c7c30e7926a
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 8.0.0 / unreleased
|
4
|
+
|
5
|
+
- Refactor `ResponseHeadersParser#results_for` to use `Enumerable#filter_map` (946ff3d)
|
6
|
+
- Update link-header-parser dependency constraint (4f093fb)
|
7
|
+
- **Breaking change:** Update development Ruby to 2.7.6 and minimum Ruby to 2.7 (593455d)
|
8
|
+
|
9
|
+
## 7.2.0 / 2022-10-04
|
10
|
+
|
11
|
+
- Add support for `indieauth-metadata` endpoint (35cc950)
|
12
|
+
- Switch from pry-byebug to Ruby's debug gem (7ad8925)
|
13
|
+
- Update development Ruby version to 2.6.10 (f105752)
|
14
|
+
|
3
15
|
## 7.1.0 / 2022-03-08
|
4
16
|
|
5
17
|
- Refactor gem code (eba8115)
|
data/CONTRIBUTING.md
CHANGED
@@ -8,9 +8,9 @@ There are a couple ways you can help improve indieweb-endpoints-ruby:
|
|
8
8
|
|
9
9
|
## Getting Started
|
10
10
|
|
11
|
-
indieweb-endpoints-ruby is developed using Ruby 2.6
|
11
|
+
indieweb-endpoints-ruby is developed using Ruby 2.7.6 and is additionally tested against Ruby 3.0 and 3.1 using [GitHub Actions](https://github.com/indieweb/indieweb-endpoints-ruby/actions).
|
12
12
|
|
13
|
-
Before making changes to indieweb-endpoints-ruby, you'll want to install Ruby 2.6.
|
13
|
+
Before making changes to indieweb-endpoints-ruby, you'll want to install Ruby 2.7.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.7.6 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 `
|
25
|
+
1. If your changes would benefit from testing, add the necessary tests and verify everything passes by running `bundle exec rspec`.
|
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
@@ -12,13 +12,13 @@
|
|
12
12
|
|
13
13
|
- Compliant with [Section 4.1](https://www.w3.org/TR/indieauth/#discovery-by-clients) and [Section 4.2.2](https://www.w3.org/TR/indieauth/#redirect-url) of [the W3C's IndieAuth Working Group Note](https://www.w3.org/TR/indieauth/), [Section 5.3](https://www.w3.org/TR/micropub/#endpoint-discovery) of [the W3C's Micropub Recommendation](https://www.w3.org/TR/micropub/), and [Section 3.1.2](https://www.w3.org/TR/webmention/#sender-discovers-receiver-webmention-endpoint) of [the W3C's Webmention Recommendation](https://www.w3.org/TR/webmention/).
|
14
14
|
- Passes all Endpoint Discovery tests on [webmention.rocks](https://webmention.rocks).
|
15
|
-
- Supports Ruby 2.
|
15
|
+
- Supports Ruby 2.7 and newer.
|
16
16
|
|
17
17
|
## Getting Started
|
18
18
|
|
19
|
-
Before installing and using indieweb-endpoints-ruby, you'll want to have [Ruby](https://www.ruby-lang.org) 2.
|
19
|
+
Before installing and using indieweb-endpoints-ruby, you'll want to have [Ruby](https://www.ruby-lang.org) 2.7 (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
|
-
indieweb-endpoints-ruby is developed using Ruby 2.6
|
21
|
+
indieweb-endpoints-ruby is developed using Ruby 2.7.6 and is additionally tested against Ruby 3.0 and 3.1 using [GitHub Actions](https://github.com/indieweb/indieweb-endpoints-ruby/actions).
|
22
22
|
|
23
23
|
## Installation
|
24
24
|
|
@@ -46,7 +46,7 @@ With indieweb-endpoints-ruby added to your project's `Gemfile` and installed, yo
|
|
46
46
|
require 'indieweb/endpoints'
|
47
47
|
|
48
48
|
IndieWeb::Endpoints.get('https://aaronparecki.com')
|
49
|
-
#=> { authorization_endpoint: "https://aaronparecki.com/auth", micropub: "https://aaronparecki.com/micropub", microsub: "https://aperture.p3k.io/microsub/1", redirect_uri: nil, token_endpoint: "https://aaronparecki.com/auth/token", webmention: "https://webmention.io/aaronpk/webmention" }
|
49
|
+
#=> { authorization_endpoint: "https://aaronparecki.com/auth", "indieauth-metadata": "https://aaronparecki.com/.well-known/oauth-authorization-server", micropub: "https://aaronparecki.com/micropub", microsub: "https://aperture.p3k.io/microsub/1", redirect_uri: nil, token_endpoint: "https://aaronparecki.com/auth/token", webmention: "https://webmention.io/aaronpk/webmention" }
|
50
50
|
```
|
51
51
|
|
52
52
|
This example will search `https://aaronparecki.com` for valid IndieAuth, Micropub, and Webmention endpoints and return a `Hash` of results. Each key in the returned `Hash` will have a value of either a `String` representing a URL or `nil`. The `redirect_uri` key's value will be either an `Array` or `nil` since a given URL may register multiple callback URLs.
|
@@ -80,7 +80,7 @@ From [httprb/http](https://github.com/httprb/http):
|
|
80
80
|
|
81
81
|
- `IndieWeb::Endpoints::HttpError`
|
82
82
|
|
83
|
-
From the Ruby Standard Library's [`OpenSSL::SSL::SSLError`](https://ruby-doc.org/stdlib-2.6
|
83
|
+
From the Ruby Standard Library's [`OpenSSL::SSL::SSLError`](https://ruby-doc.org/stdlib-2.7.6/libdoc/openssl/rdoc/OpenSSL/SSL/SSLError.html):
|
84
84
|
|
85
85
|
- `IndieWeb::Endpoints::SSLError`
|
86
86
|
|
data/indieweb-endpoints.gemspec
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
require_relative 'lib/indieweb/endpoints/version'
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
|
-
spec.required_ruby_version = '>= 2.
|
6
|
+
spec.required_ruby_version = '>= 2.7', '< 4'
|
7
7
|
|
8
8
|
spec.name = 'indieweb-endpoints'
|
9
9
|
spec.version = IndieWeb::Endpoints::VERSION
|
@@ -28,6 +28,6 @@ Gem::Specification.new do |spec|
|
|
28
28
|
}
|
29
29
|
|
30
30
|
spec.add_runtime_dependency 'http', '~> 5.0'
|
31
|
-
spec.add_runtime_dependency 'link-header-parser', '~>
|
32
|
-
spec.add_runtime_dependency 'nokogiri', '
|
31
|
+
spec.add_runtime_dependency 'link-header-parser', '~> 5.0'
|
32
|
+
spec.add_runtime_dependency 'nokogiri', '>= 1.13'
|
33
33
|
end
|
@@ -8,8 +8,11 @@ module IndieWeb
|
|
8
8
|
user_agent: 'IndieWeb Endpoint Discovery (https://rubygems.org/gems/indieweb-endpoints)'
|
9
9
|
}.freeze
|
10
10
|
|
11
|
-
|
11
|
+
private_constant :HTTP_HEADERS_OPTS
|
12
|
+
|
13
|
+
# Create a new client with a URL to parse for IndieWeb endpoints.
|
12
14
|
#
|
15
|
+
# @example
|
13
16
|
# client = IndieWeb::Endpoints::Client.new('https://aaronparecki.com')
|
14
17
|
#
|
15
18
|
# @param url [String, HTTP::URI, #to_s] an absolute URL
|
@@ -25,17 +28,17 @@ module IndieWeb
|
|
25
28
|
%(#<#{self.class.name}:#{format('%#0x', object_id)} uri: "#{uri}">)
|
26
29
|
end
|
27
30
|
|
28
|
-
# A Hash of the discovered IndieWeb endpoints from the provided URL
|
31
|
+
# A Hash of the discovered IndieWeb endpoints from the provided URL.
|
29
32
|
#
|
30
33
|
# @return [Hash{Symbol => String, Array, nil}]
|
31
34
|
def endpoints
|
32
35
|
@endpoints ||= Parser.new(response).results
|
33
36
|
end
|
34
37
|
|
35
|
-
# The HTTP::Response object returned by the provided URL
|
38
|
+
# The +HTTP::Response+ object returned by the provided URL.
|
36
39
|
#
|
37
40
|
# @return [HTTP::Response]
|
38
|
-
# @raise [IndieWeb::Endpoints::HttpError]
|
41
|
+
# @raise [IndieWeb::Endpoints::HttpError, IndieWeb::Endpoints::SSLError]
|
39
42
|
def response
|
40
43
|
@response ||= HTTP.follow(max_hops: 20)
|
41
44
|
.headers(HTTP_HEADERS_OPTS)
|
@@ -13,6 +13,7 @@ module IndieWeb
|
|
13
13
|
def results
|
14
14
|
{
|
15
15
|
authorization_endpoint: result_for(:authorization_endpoint),
|
16
|
+
'indieauth-metadata': result_for(:'indieauth-metadata'),
|
16
17
|
micropub: result_for(:micropub),
|
17
18
|
microsub: result_for(:microsub),
|
18
19
|
redirect_uri: results_for(:redirect_uri),
|
@@ -10,13 +10,13 @@ module IndieWeb
|
|
10
10
|
@uri = response.uri
|
11
11
|
end
|
12
12
|
|
13
|
-
# @param
|
13
|
+
# @param identifier [Symbol]
|
14
14
|
# @return [Array<String>, nil]
|
15
15
|
def results_for(identifier)
|
16
|
-
return unless parsed_headers.key?(identifier)
|
17
|
-
|
18
16
|
# Reject endpoints that contain a fragment identifier
|
19
|
-
parsed_headers[identifier]
|
17
|
+
parsed_headers[identifier]&.filter_map do |header|
|
18
|
+
header.target_uri unless HTTP::URI.parse(header.target_uri).fragment
|
19
|
+
end
|
20
20
|
end
|
21
21
|
|
22
22
|
private
|
data/lib/indieweb/endpoints.rb
CHANGED
@@ -18,12 +18,15 @@ module IndieWeb
|
|
18
18
|
class InvalidURIError < Error; end
|
19
19
|
class SSLError < Error; end
|
20
20
|
|
21
|
-
# Discover a URL's IndieAuth, Micropub, Microsub, and Webmention endpoints
|
21
|
+
# Discover a URL's IndieAuth, Micropub, Microsub, and Webmention endpoints.
|
22
22
|
#
|
23
|
+
# Convenience method for {IndieWeb::Endpoints::Client#endpoints}.
|
24
|
+
#
|
25
|
+
# @example
|
23
26
|
# IndieWeb::Endpoints.get('https://aaronparecki.com')
|
24
27
|
#
|
25
|
-
# @param
|
26
|
-
# @return
|
28
|
+
# @param (see IndieWeb::Endpoints::Client#endpoints)
|
29
|
+
# @return (see IndieWeb::Endpoints::Client#endpoints)
|
27
30
|
def self.get(url)
|
28
31
|
Client.new(url).endpoints
|
29
32
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: indieweb-endpoints
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 8.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: 2022-
|
11
|
+
date: 2022-11-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|
@@ -30,26 +30,26 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '5.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '5.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: nokogiri
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '1.13'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.13'
|
55
55
|
description: Discover a URL’s IndieAuth, Micropub, Microsub, and Webmention endpoints.
|
@@ -76,7 +76,7 @@ licenses:
|
|
76
76
|
- MIT
|
77
77
|
metadata:
|
78
78
|
bug_tracker_uri: https://github.com/indieweb/indieweb-endpoints-ruby/issues
|
79
|
-
changelog_uri: https://github.com/indieweb/indieweb-endpoints-ruby/blob/
|
79
|
+
changelog_uri: https://github.com/indieweb/indieweb-endpoints-ruby/blob/v8.0.0/CHANGELOG.md
|
80
80
|
rubygems_mfa_required: 'true'
|
81
81
|
post_install_message:
|
82
82
|
rdoc_options: []
|
@@ -86,7 +86,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '2.
|
89
|
+
version: '2.7'
|
90
90
|
- - "<"
|
91
91
|
- !ruby/object:Gem::Version
|
92
92
|
version: '4'
|
@@ -96,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: '0'
|
98
98
|
requirements: []
|
99
|
-
rubygems_version: 3.
|
99
|
+
rubygems_version: 3.3.16
|
100
100
|
signing_key:
|
101
101
|
specification_version: 4
|
102
102
|
summary: Discover a URL’s IndieAuth, Micropub, Microsub, and Webmention endpoints.
|