Project

konekt

0.0
No commit activity in last 3 years
No release in over 3 years
A Ruby library to interact with Konekt Cloud via Ruby and Rails.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.8
~> 0.10
~> 0.6
~> 10.0
~> 3.3
 Project Readme

Konekt

Build StatusGem Version

A Ruby (and optionally Rails) library to interact with the Konekt cloud.

Current features:

  • Webhook to receive messages - "Custom Webhook Url (your own App)"
    • Automatic authentication to webhook key
    • Decodes payload JSON
    • Decodes data base64
    • Basically, all data passed in to Konekt is passed out as an easy to consume object - per tag, where ever in your app you wish to subscribe.

Installation

Add this line to your application's Gemfile:

gem 'konekt'

And then execute:

$ bundle

Or install it yourself as:

$ gem install konekt

Setup

The endpoint defaults to '/konekt_processor'. If you're app is at https://example.com/ then you should set your webhook URL in Konekt to https://example.com/konekt_processor

ENV['KONEKT_WEBHOOK_KEY'] should be set to to the "Webhook Key" value from the Konekt applcation for this webhook.

Or you can override these in configuration:

  # In an appropriate initializer
  Konekt.configure do |config|
    config.mount_point = '/some/other/path'
    config.auth_token = ENV['KONEKT_WEBHOOK_KEY']
  end

Rack/Sinatra:

  # config.ru
  require 'konekt/middleware'
  use Konekt::Middleware

Rails: This middleware is registered automatically.

Subscribing to Tags

Subscribe to the tags you care about:

Konekt.subscribe 'parcel_shipped' do |event|
  puts event
  # Do something with event
  # You probably want to fire a background task
end

In Rails this could live at config/initalizers/konekt.rb

Problems?

This is pretty new and Konekt is pretty new too. Please raise issues or send PRs!

Contributing

  1. Fork it ( https://github.com/[my-github-username]/konekt/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