⚠️ Deprecation Notice (2019-04-25) ⚠️ This gem is deprecated in favor of indieweb/indieweb-endpoints-ruby and will no longer receive updates.
A Ruby gem for discovering a URL's Webmention endpoint.
- Compliant with Section 3.1.2 of the W3C's Webmention Recommendation.
- Passes all Endpoint Discovery tests on webmention.rocks.
- Supports Ruby 2.4 and newer.
webmention-endpoint-ruby is developed using Ruby 2.4.6 and is additionally tested against Ruby 2.5.5 and 2.6.2 using Travis CI.
If you're using Bundler, add webmention-endpoint-ruby to your project's
source 'https://rubygems.org' gem 'webmention-endpoint'
…and hop over to your command prompt and run…
$ bundle install
With webmention-endpoint-ruby added to your project's
Gemfile and installed, you may discover a URL's Webmention endpoint by doing:
require 'webmention/endpoint' endpoint = ::.('https://webmention.rocks/test/1') puts endpoint # returns String: 'https://webmention.rocks/test/1/webmention'
This example will search
https://webmention.rocks/test/1 for a valid Webmention endpoint in accordance with the rules described in the W3C's Webmention Recommendation. In this case, the program returns a string:
If no endpoint is discovered at the provided URL, the program will return
require 'webmention/endpoint' endpoint = ::.('https://example.com') puts endpoint.nil? # returns Boolean: true
Should the need arise, you may work directly with the
require 'webmention/endpoint' client = ::::.('https://webmention.rocks/test/1') puts client.response # returns HTTP::Response puts client.endpoint # returns String: 'https://webmention.rocks/test/1/webmention'
There are several exceptions that may be raised by webmention-endpoint-ruby's underlying dependencies. These errors are raised as subclasses of
Webmention::Endpoint::Error (which itself is a subclass of
Interested in helping improve webmention-endpoint-ruby? Awesome! Your help is greatly appreciated. See CONTRIBUTING.md for details.
webmention-endpoint-ruby wouldn't exist without Webmention and the hard work put in by everyone involved in the IndieWeb movement. Additionally, the comprehensive Endpoint Discovery test suite at webmention.rocks was invaluable in the development of this Ruby gem.
webmention-endpoint-ruby is written and maintained by Jason Garber.
webmention-endpoint-ruby is freely available under the MIT License. Use it, learn from it, fork it, improve it, change it, tailor it to your needs.