Skip to content

martymcguire/mention-client-ruby

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Webmention Client

A Ruby gem for sending webmention (and pingback) notifications.

Build Status

Installation

gem install webmention

Usage

Send webmentions to all links on a page

client = Webmention::Client.new url
sent = client.send_mentions

puts "Sent #{sent} mentions"

This will find all absolute links on the page at url and will attempt to send mentions to each. This is accomplished by doing a HEAD request and looking at the headers for supported servers, if none are found, then it searches the body of the page.

After finding either webmention or pingback endpoints, the request is sent to each.

Send webmention to a specific URL

# Discover the webmention endpoint of a target and send the mention

source = "http://source.example.com/post/100"   # For example, your page
target = "http://indiewebcamp.com/"             # The page you linked to

if endpoint = Webmention::Client.supports_webmention?(target)
  Webmention::Client.send_mention endpoint, source, target
end

Command Line Utility

For testing or for sending webmentions manually, you can use the command-line utility provided.

$ webmention http://source.example.com/post/100

This will look for an h-entry on the given URL and attempt to send webmentions to each URL in the entry.

Webmention

To learn more about Webmention, see webmention.org and indiewebcamp.com/webmention.

License

Copyright 2013 by Aaron Parecki

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

About

A Ruby gem for sending webmention (and pingback) notifications

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 100.0%