webhookr 0.0.2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.coveralls.yml ADDED
@@ -0,0 +1 @@
1
+ service_name: travis-ci
data/.travis.yml ADDED
@@ -0,0 +1,13 @@
1
+ language: ruby
2
+ rvm:
3
+ - "1.9.3"
4
+ - "2.0.0"
5
+ - jruby-19mode # JRuby in 1.9 mode
6
+ - ruby-head
7
+ env:
8
+ - RAILS_VERSION=4.0.0
9
+ - RAILS_VERSION=3.2.13
10
+ - RAILS_VERSION=3.1.12
11
+ matrix:
12
+ allow_failures:
13
+ - rvm: ruby-head
data/Gemfile CHANGED
@@ -2,15 +2,18 @@ source "http://rubygems.org"
2
2
 
3
3
  gemspec
4
4
 
5
- gem "rake", "~> 10.0"
6
- gem "minitest"
7
- gem "minitest-reporters"
8
- gem "em-websocket"
9
- gem "guard"
10
- gem "guard-minitest"
11
- gem "guard-markdown"
12
- gem "guard-livereload"
13
- gem "simplecov", :require => false
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
@@ -18,7 +18,7 @@ guard 'minitest', :test_folders => 'test', :test_file_patterns => '*_test.rb' do
18
18
  end
19
19
 
20
20
  guard 'livereload' do
21
- watch('README.md')
21
+ watch('README.html')
22
22
  end
23
23
 
24
24
  guard 'markdown', :convert_on_start => true do
data/README.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # webhookr: Rails Webhooks Made Easy
2
- [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/zoocasa/webhookr)
2
+ [![Build Status](https://travis-ci.org/zoocasa/webhookr.png?branch=master)](https://travis-ci.org/zoocasa/webhookr)
3
+ [![Dependency Status](https://gemnasium.com/zoocasa/webhookr.png)](https://gemnasium.com/zoocasa/webhookr)
4
+ [![Code Climate](https://codeclimate.com/github/zoocasa/webhookr.png)](https://codeclimate.com/github/zoocasa/webhookr)
5
+ [![Coverage Status](https://coveralls.io/repos/zoocasa/webhookr/badge.png?branch=master)](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 3.1 and 3.2, and has been tested on the following Ruby
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.1
134
- * MRI 1.8.7
135
- * MRI 1.9.2
136
+ * JRuby 1.7.4
136
137
  * MRI 1.9.3
137
- * Rubinius 1.2.4
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
- * Test with MRI 2.0
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", :as => "events"
3
- post "/events/:service_id(/:security_token)" => "events#create", :as => "events"
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
@@ -1,3 +1,3 @@
1
1
  module Webhookr
2
- VERSION = "0.0.2"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -3,7 +3,6 @@ require File.expand_path('../boot', __FILE__)
3
3
  # Pick the frameworks you want:
4
4
  # require "active_record/railtie"
5
5
  require "action_controller/railtie"
6
- require "active_resource/railtie"
7
6
  require "sprockets/railtie"
8
7
  require "rails/test_unit/railtie"
9
8
 
@@ -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
- # Log error messages when you accidentally call methods on nil
15
- config.whiny_nils = true
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.secret_token = '37ef70b5f837f7a433cdd2a24cfac821c9e6624bccad494de69557a4d95e70d6400afb6c291fed109e417492c84c39d4325f35716fdc6c57cc376aacc72ad512'
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
@@ -18,5 +18,5 @@ Gem::Specification.new do |s|
18
18
  s.homepage = "http://github.com/zoocasa/webhookr"
19
19
  s.require_paths = ["lib"]
20
20
 
21
- s.add_dependency "rails", ["~> 3.1"]
21
+ s.add_dependency "rails", [">= 3.1"]
22
22
  end
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: 2012-12-11 00:00:00.000000000 Z
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