Project

hookly

0.0
No commit activity in last 3 years
No release in over 3 years
hookly.js asset pipeline provider/wrapper. Ruby wrapper for the Hookly API
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 3.2
~> 1.21

Runtime

~> 0.7
 Project Readme

#hookly-rails

Circle CI
Gem Version
Code Climate

  1. Ruby wrapper for the Hookly API
  2. hookly.js asset pipeline provider/wrapper

Rails 3.1+ asset-pipeline gem to provide hookly.js

#Setup

Add to your Gemfile:

gem 'hookly-rails'

s ###JS Setup Then add this to you application.js manifest:

//= require hookly

Then check out the hookly.js docs for usage and working examples

###API Setup

# config/initializers/hookly.rb
Hookly.token = '{{token}}'
Hookly.secret = '{{secret}}'

###Post a message to the #updates channel

In the client javascript subscribe to '#updates'

hookly.start('{{token}}')
hookly.on('#updates', function(options) {
  // options == { model: 'Message', id: 5, text: 'Thanks for the info.' }
});

Push a new message the updates channel

Hookly::Message.create('#updates', model: 'Message', id: 5, text: 'Thanks for the info.')
 #=> #<Hookly::Message id: '44fjwq-djas' slug: '#updates', data: { model: 'Message', id: 5, text: 'Thanks for the info.' }>

###Post a private message

Have information that only a certain user should see??

Include a unique user id on the client and server

hookly.start('{{token}}', '{{uid}}')
hookly.on('#updates', function(options) {
  // options == { model: 'Message', id: 6, text: 'Thanks for the PRIVATE info.' }
});
Hookly::Message.create('#updates', '{{uid}}', id: 6, text: 'Thanks for the PRIVATE info.')
 #=> #<Hookly::Message id: '44fjwq-djas' slug: '#updates', uid: '{{uid}}' data: { model: 'Message', id: 6, text: 'Thanks for the PRIVATE info.' }>