webhookr 0.0.2 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.coveralls.yml +1 -0
- data/.travis.yml +13 -0
- data/Gemfile +12 -9
- data/Guardfile +1 -1
- data/README.md +25 -15
- data/app/controllers/webhookr/events_controller.rb +3 -0
- data/config/routes.rb +8 -2
- data/lib/webhookr/version.rb +1 -1
- data/test/dummy/config/application.rb +0 -1
- data/test/dummy/config/environments/development.rb +0 -3
- data/test/dummy/config/environments/test.rb +2 -2
- data/test/dummy/config/initializers/secret_token.rb +1 -1
- data/test/functional/webhookr/events_controller_test.rb +5 -5
- data/test/functional/webhookr/events_routes_test.rb +2 -2
- data/test/test_helper.rb +11 -0
- data/webhookr.gemspec +1 -1
- metadata +7 -5
data/.coveralls.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
service_name: travis-ci
|
data/.travis.yml
ADDED
data/Gemfile
CHANGED
@@ -2,15 +2,18 @@ source "http://rubygems.org"
|
|
2
2
|
|
3
3
|
gemspec
|
4
4
|
|
5
|
-
|
6
|
-
gem "
|
7
|
-
gem "minitest
|
8
|
-
gem "
|
9
|
-
gem "
|
10
|
-
gem "guard
|
11
|
-
gem "guard-
|
12
|
-
gem "guard-
|
13
|
-
gem "
|
5
|
+
group :development, :test do
|
6
|
+
gem "rake", "~> 10.0"
|
7
|
+
gem "minitest"
|
8
|
+
gem "minitest-reporters"
|
9
|
+
gem "em-websocket"
|
10
|
+
gem "guard"
|
11
|
+
gem "guard-minitest"
|
12
|
+
gem "guard-markdown"
|
13
|
+
gem "guard-livereload"
|
14
|
+
gem "simplecov", :require => false
|
15
|
+
gem 'coveralls', :require => false
|
16
|
+
end
|
14
17
|
|
15
18
|
if File.exists?('Gemfile.local')
|
16
19
|
instance_eval File.read('Gemfile.local')
|
data/Guardfile
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# webhookr: Rails Webhooks Made Easy
|
2
|
-
[](https://travis-ci.org/zoocasa/webhookr)
|
3
|
+
[](https://gemnasium.com/zoocasa/webhookr)
|
4
|
+
[](https://codeclimate.com/github/zoocasa/webhookr)
|
5
|
+
[](https://coveralls.io/r/zoocasa/webhookr?branch=master)
|
3
6
|
|
4
7
|
## <a name="introduction"></a>Introduction
|
5
8
|
|
@@ -120,33 +123,40 @@ If you are sending sensitive data via webhooks, it is recommended you use HTTPS.
|
|
120
123
|
|
121
124
|
### <a name="supported_services"></a>Supported Services
|
122
125
|
|
123
|
-
* MailChimp - webhookr-mail_chimp
|
124
|
-
* Mandrill - webhookr-mandrill
|
126
|
+
* MailChimp - [webhookr-mail_chimp](https://github.com/zoocasa/webhookr-mailchimp)
|
127
|
+
* Mandrill - [webhookr-mandrill](https://github.com/gerrypower/webhookr-mandrill)
|
128
|
+
* Stripe - [webhookr-stripe](https://github.com/gerrypower/webhookr-stripe)
|
125
129
|
* Github - coming soon
|
126
|
-
* Stripe - coming soon
|
127
130
|
|
128
131
|
## <a name="works_with"></a>Works with:
|
129
132
|
|
130
|
-
webhookr works with Rails
|
133
|
+
webhookr works with Rails 4.0 and 3.1, and has been tested on the following Ruby
|
131
134
|
implementations:
|
132
135
|
|
133
|
-
* JRuby 1.7.
|
134
|
-
* MRI 1.8.7
|
135
|
-
* MRI 1.9.2
|
136
|
+
* JRuby 1.7.4
|
136
137
|
* MRI 1.9.3
|
137
|
-
*
|
138
|
-
* Ruby EE 1.8.7
|
139
|
-
|
140
|
-
Pending:
|
141
|
-
|
142
|
-
* MRI 2.0
|
138
|
+
* MRI 2.0.0
|
143
139
|
|
144
140
|
### TODO
|
145
141
|
* Implement get/post strategies and responses so the controller can return variable text to the service.
|
146
142
|
This allows support for advanced Webhook responses for services that require it.
|
147
143
|
* Enhance testing of Rake tasks
|
148
144
|
* Clean up the stubs with FactoryGirl
|
149
|
-
|
145
|
+
|
146
|
+
### Versioning
|
147
|
+
This library aims to adhere to [Semantic Versioning 2.0.0](http://semver.org/). Violations of this scheme should be reported as
|
148
|
+
bugs. Specifically, if a minor or patch version is released that breaks backward compatibility, that
|
149
|
+
version should be immediately yanked and/or a new version should be immediately released that restores
|
150
|
+
compatibility. Breaking changes to the public API will only be introduced with new major versions. As a
|
151
|
+
result of this policy, once this gem reaches a 1.0 release, you can (and should) specify a dependency on
|
152
|
+
this gem using the [Pessimistic Version Constraint](http://docs.rubygems.org/read/chapter/16#page74) with
|
153
|
+
two digits of precision. For example:
|
154
|
+
|
155
|
+
spec.add_dependency 'webhookr', '~> 1.0'
|
156
|
+
|
157
|
+
While this gem is currently a 0.x release, suggestion is to require the exact version that works for your code:
|
158
|
+
|
159
|
+
spec.add_dependency 'webhookr', '0.0.2'
|
150
160
|
|
151
161
|
### License
|
152
162
|
|
@@ -20,6 +20,9 @@ module Webhookr
|
|
20
20
|
|
21
21
|
def create_service
|
22
22
|
begin
|
23
|
+
# Rails 4.0.0 fix: https://github.com/rails/rails/pull/11353
|
24
|
+
request.body.rewind
|
25
|
+
|
23
26
|
@service = Webhookr::Service.new(
|
24
27
|
params[:service_id], :payload => request.body.read, :security_token => params[:security_token]
|
25
28
|
)
|
data/config/routes.rb
CHANGED
@@ -1,4 +1,10 @@
|
|
1
1
|
Webhookr::Engine.routes.draw do
|
2
|
-
get "/events/:service_id(/:security_token)" => "events#show",
|
3
|
-
|
2
|
+
get "/events/:service_id(/:security_token)" => "events#show",
|
3
|
+
:as => "events",
|
4
|
+
:defaults => { :format => 'json' },
|
5
|
+
:constraints => { :format => 'json' }
|
6
|
+
post "/events/:service_id(/:security_token)" => "events#create",
|
7
|
+
:as => "new_event",
|
8
|
+
:defaults => { :format => 'json' },
|
9
|
+
:constraints => { :format => 'json' }
|
4
10
|
end
|
data/lib/webhookr/version.rb
CHANGED
@@ -6,9 +6,6 @@ Dummy::Application.configure do
|
|
6
6
|
# since you don't have to restart the web server when you make code changes.
|
7
7
|
config.cache_classes = false
|
8
8
|
|
9
|
-
# Log error messages when you accidentally call methods on nil.
|
10
|
-
config.whiny_nils = true
|
11
|
-
|
12
9
|
# Show full error reports and disable caching
|
13
10
|
config.consider_all_requests_local = true
|
14
11
|
config.action_controller.perform_caching = false
|
@@ -11,8 +11,8 @@ Dummy::Application.configure do
|
|
11
11
|
config.serve_static_assets = true
|
12
12
|
config.static_cache_control = "public, max-age=3600"
|
13
13
|
|
14
|
-
#
|
15
|
-
config.
|
14
|
+
# Rails 4.0
|
15
|
+
config.eager_load = false
|
16
16
|
|
17
17
|
# Show full error reports and disable caching
|
18
18
|
config.consider_all_requests_local = true
|
@@ -4,4 +4,4 @@
|
|
4
4
|
# If you change this key, all old signed cookies will become invalid!
|
5
5
|
# Make sure the secret is at least 30 characters and all random,
|
6
6
|
# no regular words or you'll be exposed to dictionary attacks.
|
7
|
-
Dummy::Application.config.
|
7
|
+
Dummy::Application.config.secret_key_base = '37ef70b5f837f7a433cdd2a24cfac821c9e6624bccad494de69557a4d95e70d6400afb6c291fed109e417492c84c39d4325f35716fdc6c57cc376aacc72ad512'
|
@@ -5,7 +5,7 @@ require 'stubs/service_under_test_stubs'
|
|
5
5
|
|
6
6
|
module Webhookr
|
7
7
|
class EventsControllerTest < ActionController::TestCase
|
8
|
-
|
8
|
+
|
9
9
|
include Webhookr::ServiceUnderTest
|
10
10
|
|
11
11
|
def setup
|
@@ -17,16 +17,16 @@ module Webhookr
|
|
17
17
|
|
18
18
|
test ":get with no service id should return a ActionController::RoutingError" do
|
19
19
|
assert_raise(ActionController::RoutingError) {
|
20
|
-
get(:show)
|
20
|
+
get(:show, {:service_id => ""})
|
21
21
|
}
|
22
22
|
end
|
23
|
-
|
24
|
-
test ":get with an unknown service id should return a ActionController::RoutingError" do
|
23
|
+
|
24
|
+
test ":get with an unknown service id should return a ActionController::RoutingError" do
|
25
25
|
assert_raise(ActionController::RoutingError) {
|
26
26
|
get(:show, {:service_id => "blort"})
|
27
27
|
}
|
28
28
|
end
|
29
|
-
|
29
|
+
|
30
30
|
test ":get with known service id should return success and an empty body" do
|
31
31
|
get(:show, {:service_id => stub.service_name})
|
32
32
|
assert_response :success
|
@@ -5,9 +5,9 @@ module Webhookr
|
|
5
5
|
|
6
6
|
def setup
|
7
7
|
@routes = Webhookr::Engine.routes
|
8
|
-
@show_controller = { :controller => "webhookr/events", :action => "show", :service_id => "service_id" }
|
8
|
+
@show_controller = { :format => "json", :controller => "webhookr/events", :action => "show", :service_id => "service_id" }
|
9
9
|
@show_controller_with_token = @show_controller.merge({ :security_token => "secure" })
|
10
|
-
@create_controller = { :controller => "webhookr/events", :action => "create", :service_id => "service_id" }
|
10
|
+
@create_controller = { :format => "json", :controller => "webhookr/events", :action => "create", :service_id => "service_id" }
|
11
11
|
@create_controller_with_token = @create_controller.merge({ :security_token => "secure" })
|
12
12
|
@path = "/events/service_id"
|
13
13
|
@path_with_token = "/events/service_id/secure"
|
data/test/test_helper.rb
CHANGED
@@ -1,4 +1,11 @@
|
|
1
1
|
require 'simplecov'
|
2
|
+
require 'coveralls'
|
3
|
+
|
4
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
5
|
+
SimpleCov::Formatter::HTMLFormatter,
|
6
|
+
Coveralls::SimpleCov::Formatter
|
7
|
+
]
|
8
|
+
SimpleCov.command_name("Webhookr Tests")
|
2
9
|
SimpleCov.start
|
3
10
|
|
4
11
|
# Configure Rails Environment
|
@@ -16,3 +23,7 @@ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
|
16
23
|
|
17
24
|
MiniTest::Reporters.use!(MiniTest::Reporters::SpecReporter.new)
|
18
25
|
|
26
|
+
puts "Webhookr #{Webhookr::VERSION}"
|
27
|
+
puts "Rails #{Rails::VERSION::STRING}"
|
28
|
+
puts "Ruby #{RUBY_VERSION}-p#{RUBY_PATCHLEVEL} - #{RbConfig::CONFIG['RUBY_INSTALL_NAME']}"
|
29
|
+
|
data/webhookr.gemspec
CHANGED
metadata
CHANGED
@@ -1,30 +1,30 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webhookr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.2
|
5
4
|
prerelease:
|
5
|
+
version: 0.1.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Gerry Power
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-07-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
+
type: :runtime
|
16
17
|
requirement: !ruby/object:Gem::Requirement
|
17
18
|
none: false
|
18
19
|
requirements:
|
19
|
-
- -
|
20
|
+
- - ! '>='
|
20
21
|
- !ruby/object:Gem::Version
|
21
22
|
version: '3.1'
|
22
|
-
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
none: false
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '3.1'
|
30
30
|
description: Webhookr - easily and securely add webhooks to your Rails app.
|
@@ -34,7 +34,9 @@ executables: []
|
|
34
34
|
extensions: []
|
35
35
|
extra_rdoc_files: []
|
36
36
|
files:
|
37
|
+
- .coveralls.yml
|
37
38
|
- .gitignore
|
39
|
+
- .travis.yml
|
38
40
|
- Gemfile
|
39
41
|
- Guardfile
|
40
42
|
- MIT-LICENSE
|