0.02
No commit activity in last 3 years
No release in over 3 years
Gem containing sinatra engine to utilize SNS notifications.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

SnsEndpoint

Simple gem containing Sinatra engine, designed to help you utilize SNS http post service. Use inside Rails (as an engine) or outside - as a standalone application.

Installation

Add this line to your application's Gemfile:

gem 'sns_endpoint'

And then execute:

$ bundle

Or install it yourself as:

$ gem install sns_endpoint

Usage

Configure using SnsEndpoint.setup, providing block, like this:

SnsEndpoint.setup do |config|
  config.topics_list = ['first_topic', 'second_topic'] #list of topics that endpoint should respond to subscription request
  config.subscribe_proc = Proc.new { |message| p message } #proc that should be executed when subscribe request got received and responded to, passed argument is message (json object)
  config.message_proc = Proc.new { |message| p message } #proc that should be executed when message got send to endpoint
end

for example in Rails initializer.

Use as Rails engine:

  • mount in routes.rb:
mount SnsEndpoint::Core => "/sns_endpoint"

Use as a standalone app: Example script:

require 'rubygems'
require 'sns_endpoint'
SnsEndpoint.setup do |config|
  config.topics_list = ['first_topic', 'second_topic'] #list of topics that endpoint should respond to subscription request
  config.subscribe_proc = Proc.new { |message| p message } #proc that should be executed when subscribe request got received and responded to, passed argument is message (json object)
  config.message_proc = Proc.new { |message| p message } #proc that should be executed when message got send to endpoint
end
SnsEndpoint::Core.run!

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request