Lono::Api

This gem is used to interface with Lono's public API. For more information, you can take a look at our documentation.

Seriously, we owe a lot of this gem's code to @austinrfnd. Thanks a lot!

Installation

Add this line to your application's Gemfile:

gem 'lono-api'

And then execute:

$ bundle

Or install it yourself as:

$ gem install lono-api

Usage

Configuration

  Lono.configure do |config|
    config.client_secret = 'secret'
    config.client_id = 'id'
    config.auth_token = 'auth_token'
    config.scope = ['write']
  end

Generate the Authentication URL

auth_url = Lono::AuthUrl.fetch "http://redirect_here_on_success.com"

Get A Session Token

session_token = Lono::SessionToken.fetch()

Turn on a device's zone on and off

device = Lono::Device.new('device_id_name', session_token)
# turn zone one on
device.set_zone(0, true)

# turn zone one off
device.set_zone(0, false)

Development

After checking out the repo, run bin/setup to install dependencies. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Running Specs

rake

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/lono-devices/lono-ruby

License

The gem is available as open source under the terms of the MIT License.