All Projects → indieweb → Webmention Client Ruby

indieweb / Webmention Client Ruby

Licence: other
A Ruby gem for sending Webmention notifications.

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Webmention Client Ruby

Ehplainalert
Plain style IOS alert
Stars: ✭ 44 (-26.67%)
Mutual labels:  notifications
Native Notifier
Use native system notifications in node.js without third-party libraries
Stars: ✭ 53 (-11.67%)
Mutual labels:  notifications
Laravel Fcm
🌐 A Laravel package to send Push Notifications to one or many devices of the user.
Stars: ✭ 56 (-6.67%)
Mutual labels:  notifications
Potato Library
Easy to use Utility library for Android
Stars: ✭ 45 (-25%)
Mutual labels:  notifications
Onesignal Gradle Plugin
Use with OneSignal-Android-SDK to help integrate it into your Android Studio or Gradle project. https://onesignal.com
Stars: ✭ 49 (-18.33%)
Mutual labels:  notifications
Appraisal
A Ruby library for testing your library against different versions of dependencies.
Stars: ✭ 1,075 (+1691.67%)
Mutual labels:  rubygems
Ntfd
A lightweight notification daemon for fancy desktop integrations
Stars: ✭ 44 (-26.67%)
Mutual labels:  notifications
Parse Sdk Arduino
The Arduino SDK for the Parse Platform
Stars: ✭ 59 (-1.67%)
Mutual labels:  notifications
Hanami Webpack
A RubyGem to allow you to use the Webpack as your asset pipeline in Hanami.
Stars: ✭ 50 (-16.67%)
Mutual labels:  rubygems
Chime
🎵 Python sound notifications made easy
Stars: ✭ 56 (-6.67%)
Mutual labels:  notifications
Robin
A multi-platform notification scheduler written in Swift.
Stars: ✭ 46 (-23.33%)
Mutual labels:  notifications
Craft Brief
Quick, easy, and customizable user-group notifications for Craft CMS.
Stars: ✭ 47 (-21.67%)
Mutual labels:  notifications
Ng Push
An Angular wrapper around the Notifications API
Stars: ✭ 55 (-8.33%)
Mutual labels:  notifications
Pushkit
All the required components to set up independent web push notifications 🎈
Stars: ✭ 45 (-25%)
Mutual labels:  notifications
Notifier
NO LIBRARIES socket per page bridge for your Laravel application. (CLIENT PART INCLUDED)
Stars: ✭ 57 (-5%)
Mutual labels:  notifications
Laravel Notification
Example package for using the (still under development) Messages API from Nexmo as a notification channel in Laravel
Stars: ✭ 44 (-26.67%)
Mutual labels:  notifications
Giti
Permanent observer of your git directories
Stars: ✭ 54 (-10%)
Mutual labels:  notifications
Teller Cli
🏦 Banking for your command line.
Stars: ✭ 60 (+0%)
Mutual labels:  notifications
Postgresql2websocket
Send PostgreSQL notifications over websockets
Stars: ✭ 58 (-3.33%)
Mutual labels:  notifications
Gitlab Notifications
👍 Notifications Center for GitLab
Stars: ✭ 55 (-8.33%)
Mutual labels:  notifications

webmention-client-ruby

A Ruby gem for sending Webmention notifications.

Gem Downloads Build Maintainability Coverage

Key Features

  • Crawls a given URL for mentioned URLs.
  • Performs endpoint discovery on mentioned URLs.
  • Sends webmentions to mentioned URLs.

Getting Started

Before installing and using webmention-client-ruby, you'll want to have Ruby 2.5 (or newer) installed. It's recommended that you use a Ruby version managment tool like rbenv, chruby, or rvm.

webmention-client-ruby is developed using Ruby 2.5.8 and is additionally tested against Ruby 2.6 and 2.7 using Travis CI.

Installation

If you're using Bundler to manage gem dependencies, add webmention-client-ruby to your project's Gemfile:

source 'https://rubygems.org'

gem 'webmention'

…and then run:

bundle install

Usage

With webmention-client-ruby added to your project's Gemfile and installed, you may send a webmention from a source URL to a target URL:

require 'webmention'

source = 'https://source.example.com/post/100'  # A post on your website
target = 'https://target.example.com/post/100'  # A post on someone else's website

Webmention.send_mention(source, target) # => #<HTTP::Response/1.1 200 OK {…}>

If no Webmention endpoint is found for a given source URL, the send_mention method will return nil.

Note: HTTP::Response objects may return a variety of status codes that will vary depending on the endpoint's capabilities and the success or failure of the request. See the Webmention spec for more on status codes on their implications.

Sending multiple webmentions

To send webmentions to all URLs mentioned within a source URL's h-entry:

require 'webmention'

client = Webmention.client('https://source.example.com/post/100')

client.mentioned_urls    # => Array
client.send_all_mentions # => Hash

This example will crawl https://source.example.com/post/100, parse its markup for the first h-entry, perform endpoint discovery on mentioned URLs, and attempt to send webmentions to those URLs.

Note: If no h-entry is found at the provided source URL, the send_all_mentions method will search the source URL's <body> for mentioned URLs.

The send_all_mentions method returns a hash of mentioned URLs and the associated HTTP response (an HTTP::Response object):

{
  'https://target.example.com/post/100' => #<HTTP::Response/1.1 200 OK {…}>,
  'https://target.example.com/post/101' => #<HTTP::Response/1.1 200 OK {…}>
}

Exception Handling

There are several exceptions that may be raised by webmention-client-ruby's underlying dependencies. These errors are raised as subclasses of WebmentionClientError (which itself is a subclass of StandardError).

From sporkmonger/addressable:

  • Webmention::Client::InvalidURIError

From httprb/http:

  • Webmention::Client::ConnectionError
  • Webmention::Client::TimeoutError
  • Webmention::Client::TooManyRedirectsError

webmention-client-ruby will also raise a Webmention::Client::UnsupportedMimeTypeError when encountering an HTTP::Response instance with an unsupported MIME type.

Contributing

Interested in helping improve webmention-client-ruby? Awesome! Your help is greatly appreciated. See CONTRIBUTING.md for details.

Acknowledgments

webmention-client-ruby is written and maintained by Aaron Parecki (@aaronpk) and Nat Welch (@icco) with help from these additional contributors.

To learn more about Webmention, see indieweb.org/Webmention and webmention.net.

License

webmention-client-ruby is freely available under the Apache License 2.0. See LICENSE for more details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].