The Ketra gem provides a friendly Ruby interface to the Ketra API
Add this line to your application's Gemfile:
gem 'ketra'NOTE: versions 0.3.0+ are only supported for use with Ketra N4 Hubs with 1.15+ firmware
And then execute:
$ bundle
Or install it yourself as:
$ gem install ketra
In order to use this gem you will need to contact Ketra Support and get assigned a client_id and client_secret
require 'ketra'
Ketra.client_id = 'YOUR CLIENT ID'
Ketra.client_secret = 'YOUR CLIENT SECRET'
Ketra.client.authorize(:username => 'YOUR DESIGN STUDIO USERNAME', :password => 'YOUR DESIGN STUDIO PASSWORD)
access_token = Ketra.client.access_tokenKetra.client.authorize(:token => 'YOUR ACCESS TOKEN')Ketra.client.options[:api_mode] = :remote
Ketra.client.options[:installation_id] = 'YOUR INSTALLATION ID'
Ketra.client.options[:hub_serial] = 'YOUR HUB SERIAL NUMBER'Ketra.client.options[:api_mode] = :local #optional since :local is the default
Ketra.client.options[:hub_serial] = 'YOUR HUB SERIAL NUMBER'All commands require authentication and the correct configuration for either remote or local API mode.
Ketra::Commands.activate_button('YOUR KEYPAD NAME', 'YOUR BUTTON NAME')
Ketra::Commands.deactivate_button('YOUR KEYPAD NAME', 'YOUR BUTTON NAME')
Ketra::Commands.push_button('YOUR KEYPAD NAME', 'YOUR BUTTON NAME')Ketra::Commands.keypads
Ketra::Commands.groupsAfter checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.
Bug reports and pull requests are welcome on GitHub at https://github.com/kennyjpowers/ketra. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The gem is available as open source under the terms of the MIT License.
