Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mortise

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mortise

  • 0.3.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Mortise travis build status Code Climate Dependency Status

Mortise is a Ruby client for the Tenon.io accessibility checker. It lets you easily check for accessibility issues on web pages.

Installation

Add this line to your application's Gemfile:

gem 'mortise'

And then execute:

$ bundle

Or install it yourself as:

$ gem install mortise

Usage

You'll need an API Key to use Tenon.io, so first register and come back when you've got your API Key.

To check accessibility on a web page, just pass Mortise the URL to check and the API key, like this:

checker = Mortise.check('http://validationhell.com', 'YOUR-API-KEY')

Then, you can check the JSON response like this:

checker.raw # {
            #   "resultSet":[
            #     {
            #       "bpID":1,
            #       "certainty":100,
            #       "errorDescription":"All images must have an alt attribute...

Every issue returned will also accessible in a more friendly way like this, where the snake_cased Ruby attributes correspond to the camelCased JSON attributes:

issue = checker.issues.first

issue.bp_id
issue.certainty
issue.error_description
issue.error_snippet
issue.error_title
issue.position
issue.priority
issue.result_title
issue.signature
issue.standards
issue.t_id
issue.xpath

The issues array contains all issues returned by the checker, but you'll typically be more interested in errors (that contains all issues with certainty >= 80) and warnings (that contains all issues with certainty < 80).

Using a Tenon Enterprise instance

By default, Mortise will query the Tenon.io API at http://tenon.io/api/ but if you're using your own Tenon Enterprise instance you can set its location like this:

Mortise.check('http://example.com', 'YOUR-API-KEY', tenon_uri: 'http://yourchecker.com')

Specifying a different Tenon App ID

By default, Mortise will pass its own identifier on the appID parameter, so that Tenon can keep usage stats for Mortise.

If you want to use a different value, you can override it like this:

Mortise.check('http://example.com', 'YOUR-API-KEY', tenon_app_id: 'your-app-id')

Development

After checking out the repo, run bundle to install dependencies. Then, run bundle console for an interactive prompt that will allow you to experiment.

Contributing

  1. Fork it ( https://github.com/[my-github-username]/mortise/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

FAQs

Package last updated on 28 Apr 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc