webhookr-mandrill 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b7ef5f7bc4e5b1d7c9cf25974f5fc75f10a29ecc
4
+ data.tar.gz: 25d59cf0eeb5123bcffb2f05da918539d4d48525
5
+ SHA512:
6
+ metadata.gz: 5ad6c65ac57d92d6838dca60ce11ba9051d15d5571a5274928dcdc702bd4ff7bf9974849f2b11b6d028b97a940102469e0bc9690204aa68331972d6032647926
7
+ data.tar.gz: 3734ede08ae6fd50df16a814e1ce65239ef5c7f90351a656e86574b56eae0248e28b97f5065ddb2ca0d4e06e66e9f981304e91ef0c3b33965a42165269bd097f
@@ -0,0 +1 @@
1
+ service_name: travis-ci
@@ -0,0 +1,20 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ Gemfile.local
8
+ Guardfile.local
9
+ README.html
10
+ InstalledFiles
11
+ _yardoc
12
+ coverage
13
+ doc/
14
+ lib/bundler/man
15
+ pkg
16
+ rdoc
17
+ spec/reports
18
+ test/tmp
19
+ test/version_tmp
20
+ tmp
@@ -0,0 +1,9 @@
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
+ matrix:
8
+ allow_failures:
9
+ - rvm: ruby-head
data/Gemfile ADDED
@@ -0,0 +1,20 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
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
17
+
18
+ if File.exists?('Gemfile.local')
19
+ instance_eval File.read('Gemfile.local')
20
+ end
@@ -0,0 +1,24 @@
1
+
2
+ guard 'minitest', :test_folders => 'test', :test_file_patterns => '*_tests.rb' do
3
+ watch(%r|^test/(.+)_tests\.rb|)
4
+
5
+ watch(%r|^lib/(.*)([^/]+)\.rb|) do |m|
6
+ "test/#{m[1]}#{m[2]}_tests.rb"
7
+ end
8
+
9
+ watch(%r|^test/test_helper\.rb|) do
10
+ "test"
11
+ end
12
+ end
13
+
14
+ guard 'markdown', :convert_on_start => true do
15
+ watch ('README.md') { "./README.md|./README.html" }
16
+ end
17
+
18
+ guard 'livereload' do
19
+ watch('README.html')
20
+ end
21
+
22
+ if File.exists?('Guardfile.local')
23
+ instance_eval File.read('Guardfile.local')
24
+ end
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Gerry Power
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,22 @@
1
+ Copyright (c) Gerry Power
2
+
3
+ Permission is hereby granted, free of charge, to any person
4
+ obtaining a copy of this software and associated documentation
5
+ files (the "Software"), to deal in the Software without
6
+ restriction, including without limitation the rights to use,
7
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the
9
+ Software is furnished to do so, subject to the following
10
+ conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,180 @@
1
+ # Webhookr::Mandrill
2
+ [![Build Status](https://travis-ci.org/gerrypower/webhookr-mandrill.png?branch=master)](https://travis-ci.org/gerrypower/webhookr-mandrill)
3
+ [![Dependency Status](https://gemnasium.com/gerrypower/webhookr-mandrill.png)](https://gemnasium.com/gerrypower/webhookr-mandrill)
4
+ [![Code Climate](https://codeclimate.com/repos/51e81bd356b10253cd00e367/badges/3f65f77018889c315542/gpa.png)](https://codeclimate.com/repos/51e81bd356b10253cd00e367/feed)
5
+ [![Coverage Status](https://coveralls.io/repos/gerrypower/webhookr-mandrill/badge.png?branch=master)](https://coveralls.io/r/gerrypower/webhookr-mandrill?branch=master)
6
+
7
+ This gem is a plugin for [Webhookr](https://github.com/zoocasa/webhookr) that enables
8
+ your application to accept [webhooks from Mandrill](http://help.mandrill.com/entries/21738186-Introduction-to-Webhooks).
9
+
10
+ ## Installation
11
+
12
+ Add this line to your application's Gemfile:
13
+
14
+ gem 'webhookr-mandrill'
15
+
16
+ Or install it yourself:
17
+
18
+ $ gem install webhookr-mandrill
19
+
20
+ [webhookr](https://github.com/zoocasa/webhookr) is installed as a dependency of webhookr-mandrill. If you have not [setup Webhookr](https://github.com/zoocasa/webhookr#usage--setup), do so now:
21
+
22
+ ```console
23
+ rails g webhookr:add_route
24
+ ```
25
+
26
+ ## Usage
27
+
28
+ Once you have the gem installed run the generator to add the code to your initializer.
29
+ An initializer will be created if you do not have one.
30
+
31
+ ```console
32
+ rails g webhookr:mandrill:init *initializer_name* -s
33
+ ```
34
+
35
+ Run the generator to create an example file to handle mandrill webhooks.
36
+
37
+ ```console
38
+ rails g webhookr:mandrill:example_hooks
39
+ ```
40
+
41
+ Or create a mandrill handler class for any event that you want to handle. For example
42
+ to handle unsubscribes you would create a class as follows:
43
+
44
+ ```ruby
45
+ class mandrillHooks
46
+ def on_spam(incoming)
47
+ # Your custom logic goes here.
48
+ User.unsubscribe_newletter(incoming.payload.msg.email)
49
+ end
50
+ end
51
+ ```
52
+
53
+ For a complete list of events, and the payload format, see below.
54
+
55
+ Edit config/initializers/*initializer_name* and change the commented line to point to
56
+ your custom Mandrill event handling class. If your class was called *MandrillHooks*
57
+ the configuration line would look like this:
58
+
59
+ ```ruby
60
+ Webhookr::Mandrill::Adapter.config.callback = MandrillHooks
61
+ ```
62
+
63
+ To see the list of Mandrill URLs your application can use when you configure
64
+ mandrill webhooks,
65
+ run the provided webhookr rake task:
66
+
67
+ ```console
68
+ rake webhookr:services
69
+ ```
70
+
71
+ Example output:
72
+
73
+ ```console
74
+ mandrill:
75
+ GET /webhookr/events/mandrill/19xl64emxvn
76
+ POST /webhookr/events/mandrill/19xl64emxvn
77
+ ```
78
+
79
+ ## Mandrill Events & Payload
80
+
81
+ ### Events
82
+
83
+ All webhook events are supported. For further information on these events, see the
84
+ [mandrill documentation](http://help.mandrill.com/entries/21738186-Introduction-to-Webhooks).
85
+
86
+ <table>
87
+ <tr>
88
+ <th>Mandrill Event</th>
89
+ <th>Event Handler</th>
90
+ </tr>
91
+ <tr>
92
+ <td>send</td>
93
+ <td>on_send(incoming)</td>
94
+ </tr>
95
+ <tr>
96
+ <td>hard_bounce</td>
97
+ <td>on_hard_bounce(incoming)</td>
98
+ </tr>
99
+ <tr>
100
+ <td>soft_bounce</td>
101
+ <td>on_soft_bounce(incoming)</td>
102
+ </tr>
103
+ <tr>
104
+ <td>open</td>
105
+ <td>on_open(incoming)</td>
106
+ </tr>
107
+ <tr>
108
+ <td>click</td>
109
+ <td>on_click(incoming)</td>
110
+ </tr>
111
+ <tr>
112
+ <td>spam</td>
113
+ <td>on_spam(incoming)</td>
114
+ </tr>
115
+ <tr>
116
+ <td>unsub</td>
117
+ <td>on_unsub(incoming)</td>
118
+ </tr>
119
+ <tr>
120
+ <td>reject</td>
121
+ <td>on_reject(incoming)</td>
122
+ </tr>
123
+ </table>
124
+
125
+ ### Payload
126
+
127
+ The payload is the full payload data from as per the
128
+ [mandrill documentation](http://help.mandrill.com/entries/24466132-Webhook-Format), converted to an OpenStruct
129
+ for ease of access. Examples for the method call unsubscribe:
130
+
131
+ ```ruby
132
+ incoming.payload.msg._id
133
+ incoming.payload.msg.ts
134
+ incoming.payload.msg.email
135
+ incoming.payload.msg.sender
136
+ incoming.payload.msg.subject
137
+ incoming.payload.msg.opens
138
+ incoming.payload.msg.tags
139
+ incoming.payload.msg.state
140
+ incoming.payload.msg.diag
141
+ incoming.payload.msg.bounce_description
142
+ incoming.payload.msg.template
143
+
144
+ ```
145
+
146
+ ### <a name="supported_services"></a>Supported Service - mandrill
147
+
148
+ * [http://help.mandrill.com/entries/21738186-Introduction-to-Webhooks](mandrill - v1.0)
149
+
150
+ ## <a name="works_with"></a>Works with:
151
+
152
+ webhookr-mandrill works with Rails 3.1, 3.2 and 4.0, and has been tested on the following Ruby
153
+ implementations:
154
+
155
+ * 1.9.3
156
+ * 2.0.0
157
+ * jruby-19mode
158
+
159
+ ### Versioning
160
+ This library aims to adhere to [Semantic Versioning 2.0.0](http://semver.org/). Violations of this scheme should be reported as
161
+ bugs. Specifically, if a minor or patch version is released that breaks backward compatibility, that
162
+ version should be immediately yanked and/or a new version should be immediately released that restores
163
+ compatibility. Breaking changes to the public API will only be introduced with new major versions. As a
164
+ result of this policy, once this gem reaches a 1.0 release, you can (and should) specify a dependency on
165
+ this gem using the [Pessimistic Version Constraint](http://docs.rubygems.org/read/chapter/16#page74) with
166
+ two digits of precision. For example:
167
+
168
+ spec.add_dependency 'webhookr-mandrill', '~> 1.0'
169
+
170
+ While this gem is currently a 0.x release, suggestion is to require the exact version that works for your code:
171
+
172
+ spec.add_dependency 'webhookr-mandrill', '0.0.1'
173
+
174
+ ## License
175
+
176
+ webhookr-mandrill is released under the [MIT license](http://www.opensource.org/licenses/MIT).
177
+
178
+ ## Author
179
+
180
+ * [Gerry Power](https://github.com/gerrypower)
@@ -0,0 +1,37 @@
1
+
2
+ # -*- ruby -*-
3
+
4
+ require 'rubygems'
5
+ require 'rubygems/package_task'
6
+ require 'rake/testtask'
7
+ require 'rdoc/task'
8
+ require 'bundler/gem_tasks'
9
+
10
+ if RUBY_VERSION >= '1.9'
11
+ begin
12
+ gem 'psych'
13
+ rescue Exception => e
14
+ # it's okay, fall back on the bundled psych
15
+ end
16
+ end
17
+
18
+ $:.push 'lib'
19
+
20
+ version = Webhookr::Mandrill::VERSION
21
+
22
+ desc 'Test Webhookr Mandrill'
23
+ Rake::TestTask.new(:test) do |t|
24
+ t.test_files = FileList['test/**/*_tests.rb']
25
+ t.verbose = !!ENV['VERBOSE_TESTS']
26
+ t.warning = !!ENV['WARNINGS']
27
+ end
28
+
29
+ desc 'Build docs'
30
+ Rake::RDocTask.new do |t|
31
+ t.main = 'README.md'
32
+ t.title = "Webhookr Mandrill #{version}"
33
+ t.rdoc_dir = 'doc'
34
+ t.rdoc_files.include('README.md', 'MIT-LICENSE', 'lib/**/*.rb')
35
+ end
36
+
37
+ task :default => :test
@@ -0,0 +1,17 @@
1
+ module Webhookr
2
+ module Mandrill
3
+ module Generators
4
+
5
+ class ExampleHooksGenerator < Rails::Generators::Base
6
+ EXAMPLE_HOOK_FILE = 'app/models/mandrill_hooks.rb'
7
+ source_root File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
8
+
9
+ desc "Creates an example Mandrill hook file: '#{EXAMPLE_HOOK_FILE}'"
10
+ def example_hooks
11
+ copy_file( "mandrill_hooks.rb", EXAMPLE_HOOK_FILE)
12
+ end
13
+ end
14
+
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,24 @@
1
+ require 'generators/webhookr/init_generator'
2
+
3
+ module Webhookr
4
+ module Mandrill
5
+ module Generators
6
+ class InitGenerator < Webhookr::Generators::InitGenerator
7
+
8
+ desc "This generator updates the named initializer with Mandrill options"
9
+ def init
10
+ super
11
+ append_to_file "config/initializers/#{file_name}.rb" do
12
+ plugin_initializer_text
13
+ end
14
+ end
15
+
16
+ def plugin_initializer_text
17
+ "\nWebhookr::Mandrill::Adapter.config.security_token = '#{generate_security_token}'" +
18
+ "\n# Uncomment the next line to include your custom Mandrill handler\n" +
19
+ "# <-- Webhookr::Mandrill::Adapter.config.callback = your_custom_class --> \n"
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,39 @@
1
+ class MandrillHooks
2
+
3
+ # All 'on_' handlers are optional. Omit any you do not require.
4
+ # Details on the payload structure: http://help.mandrill.com/entries/24466132-Webhook-Format
5
+
6
+ def on_send(incoming)
7
+ payload = incoming.payload
8
+ puts("send: #{payload.msg.email}")
9
+ end
10
+
11
+ def on_hard_bounce(incoming)
12
+ payload = incoming.payload
13
+ end
14
+
15
+ def on_soft_bounce(incoming)
16
+ payload = incoming.payload
17
+ end
18
+
19
+ def on_open(incoming)
20
+ payload = incoming.payload
21
+ end
22
+
23
+ def on_click(incoming)
24
+ payload = incoming.payload
25
+ end
26
+
27
+ def on_spam(incoming)
28
+ payload = incoming.payload
29
+ end
30
+
31
+ def on_unsub(incoming)
32
+ payload = incoming.payload
33
+ end
34
+
35
+ def on_reject(incoming)
36
+ payload = incoming.payload
37
+ end
38
+
39
+ end
@@ -0,0 +1,57 @@
1
+ require "webhookr"
2
+ require "webhookr-mandrill/version"
3
+ require "webhookr/ostruct_utils"
4
+
5
+ module Webhookr
6
+ module Mandrill
7
+ class Adapter
8
+ SERVICE_NAME = "mandrill"
9
+ EVENT_KEY = "event"
10
+ PAYLOAD_KEY = "msg"
11
+
12
+ include Webhookr::Services::Adapter::Base
13
+
14
+ def self.process(raw_response)
15
+ new.process(raw_response)
16
+ end
17
+
18
+ def process(raw_response)
19
+ Array.wrap(parse(raw_response)).collect do |p|
20
+ Webhookr::AdapterResponse.new(
21
+ SERVICE_NAME,
22
+ p.fetch(EVENT_KEY),
23
+ OstructUtils.to_ostruct(p)
24
+ ) if assert_valid_packet(p)
25
+ end
26
+ end
27
+
28
+ private
29
+
30
+ def parse(raw_response)
31
+ begin
32
+ assert_valid_packets(
33
+ ActiveSupport::JSON.decode(
34
+ CGI.unescape(raw_response).gsub(/mandrill_events=/,"")
35
+ )
36
+ )
37
+ rescue Exception => e
38
+ raise InvalidPayloadError.new(e)
39
+ end
40
+ end
41
+
42
+ def assert_valid_packets(parsed_responses)
43
+ raise(
44
+ Webhookr::InvalidPayloadError, "Malformed response |#{parsed_responses.inspect}|"
45
+ ) unless parsed_responses.is_a?(Array) && parsed_responses.first.is_a?(Hash)
46
+ parsed_responses
47
+ end
48
+
49
+ def assert_valid_packet(packet)
50
+ raise(Webhookr::InvalidPayloadError, "Unknown event #{packet[EVENT_KEY]}") unless packet[EVENT_KEY]
51
+ raise(Webhookr::InvalidPayloadError, "No msg in the response") unless packet[PAYLOAD_KEY]
52
+ true
53
+ end
54
+
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,5 @@
1
+ module Webhookr
2
+ module Mandrill
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,26 @@
1
+
2
+ $: << File.join(File.dirname(__FILE__), %w{ .. .. .. })
3
+ require 'test_helper'
4
+ require 'generators/webhookr/mandrill/init_generator'
5
+
6
+ class InitGeneratorTests < Rails::Generators::TestCase
7
+ tests Webhookr::Mandrill::Generators::InitGenerator
8
+ destination File.expand_path("../../../tmp", File.dirname(__FILE__))
9
+ setup :prepare_destination
10
+
11
+ def setup
12
+ @name = "test_initializer"
13
+ @initializer = "config/initializers/#{@name}.rb"
14
+ run_generator Array.wrap(@name)
15
+ end
16
+
17
+ test "it should create the initializer" do
18
+ assert_file @initializer
19
+ end
20
+
21
+ test "it should have authorization information" do
22
+ assert_file @initializer do |content|
23
+ assert_match(%r{Webhookr::Mandrill::Adapter\.config\.security_token}, content)
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,15 @@
1
+ require 'simplecov'
2
+ require 'coveralls'
3
+
4
+ SimpleCov.start
5
+ Coveralls.wear!
6
+
7
+ require 'minitest/autorun'
8
+ require 'minitest/reporters'
9
+ require 'rails'
10
+ require "rails/generators/test_case"
11
+ require File.expand_path('../../lib/webhookr-mandrill.rb', __FILE__)
12
+
13
+ if RUBY_VERSION >= "1.9"
14
+ MiniTest::Reporters.use!(MiniTest::Reporters::SpecReporter.new)
15
+ end
@@ -0,0 +1,8 @@
1
+ $: << File.join(File.dirname(__FILE__), %w{ .. .. })
2
+ require 'test_helper'
3
+
4
+ describe Webhookr::Mandrill do
5
+ it "must be defined" do
6
+ Webhookr::Mandrill::VERSION.wont_be_nil
7
+ end
8
+ end
@@ -0,0 +1,97 @@
1
+
2
+ $: << File.join(File.dirname(__FILE__), "..")
3
+ require 'test_helper'
4
+
5
+ describe Webhookr::Mandrill::Adapter do
6
+
7
+ before do
8
+ @fired_at = "2009-03-26 22:01:00"
9
+ @event_type = "spam"
10
+ @single_response = '{ "event": "' + @event_type + '", "ts": "' + @fired_at + '", "msg": { "email": "gerry%2Bagent1@zoocasa.com" }} '
11
+ @valid_response = 'mandrill_events=[' + @single_response + ']'
12
+ @valid_responses = 'mandrill_events=[' + @single_response + ',' + @single_response + ']'
13
+ end
14
+
15
+ describe "the class" do
16
+
17
+ subject { Webhookr::Mandrill::Adapter }
18
+
19
+ it "must support process" do
20
+ subject.must_respond_to(:process)
21
+ end
22
+
23
+ it "should not return an error for a valid packet" do
24
+ lambda {
25
+ subject.process(@valid_response)
26
+ }.must_be_silent
27
+ end
28
+
29
+ end
30
+
31
+ describe "the instance" do
32
+
33
+ subject { Webhookr::Mandrill::Adapter.new }
34
+
35
+ it "should not return an error for a valid packet" do
36
+ lambda {
37
+ subject.process(@valid_response)
38
+ }.must_be_silent
39
+ end
40
+
41
+ it "should raise Webhookr::InvalidPayloadError for no packet" do
42
+ lambda {
43
+ subject.process("")
44
+ }.must_raise(Webhookr::InvalidPayloadError)
45
+ end
46
+
47
+ it "should raise Webhookr::InvalidPayloadError for a missing event type" do
48
+ lambda {
49
+ subject.process('mandrill_events=[ { "msg": { "email": "gerry%2Bagent1@zoocasa.com" }} ]')
50
+ }.must_raise(Webhookr::InvalidPayloadError)
51
+ end
52
+
53
+ it "should raise Webhookr::InvalidPayloadError for a missing data packet" do
54
+ lambda {
55
+ subject.process('mandrill_events=[ { "event": "spam" } ]')
56
+ }.must_raise(Webhookr::InvalidPayloadError)
57
+ end
58
+
59
+ end
60
+
61
+ describe "it's response" do
62
+ before do
63
+ @adapter = Webhookr::Mandrill::Adapter.new
64
+ end
65
+
66
+ subject { @adapter.process(@valid_response).first }
67
+
68
+ it "must respond to service_name" do
69
+ subject.must_respond_to(:service_name)
70
+ end
71
+
72
+ it "should return the correct service name" do
73
+ assert_equal(Webhookr::Mandrill::Adapter::SERVICE_NAME, subject.service_name)
74
+ end
75
+
76
+ it "must respond to event_type" do
77
+ subject.must_respond_to(:event_type)
78
+ end
79
+
80
+ it "should return the correct event type" do
81
+ assert_equal(@event_type, subject.event_type)
82
+ end
83
+
84
+ it "must respond to payload" do
85
+ subject.must_respond_to(:payload)
86
+ end
87
+
88
+ it "must respond to payload.msg" do
89
+ subject.payload.must_respond_to(:msg)
90
+ end
91
+
92
+ it "should return the correct data packet" do
93
+ assert_equal("gerry+agent1@zoocasa.com", subject.payload.msg.email)
94
+ end
95
+ end
96
+
97
+ end
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'webhookr-mandrill/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "webhookr-mandrill"
8
+ gem.version = Webhookr::Mandrill::VERSION
9
+ gem.authors = ["Gerry Power"]
10
+ gem.email = ["gerry@thepowerhouse.com"]
11
+ gem.description = "A webhookr extension to support Mandrill webhooks."
12
+ gem.summary = gem.description
13
+ gem.homepage = "http://github.com/gerrypower/webhookr-mandrill"
14
+ gem.license = "MIT"
15
+
16
+ gem.files = `git ls-files`.split($/)
17
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
18
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
19
+ gem.require_paths = ["lib"]
20
+
21
+ gem.add_dependency("webhookr")
22
+ gem.add_dependency("activesupport", [">= 3.1"])
23
+
24
+ end
metadata ADDED
@@ -0,0 +1,95 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: webhookr-mandrill
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Gerry Power
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-08-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: webhookr
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: activesupport
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '3.1'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '3.1'
41
+ description: A webhookr extension to support Mandrill webhooks.
42
+ email:
43
+ - gerry@thepowerhouse.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - .coveralls.yml
49
+ - .gitignore
50
+ - .travis.yml
51
+ - Gemfile
52
+ - Guardfile
53
+ - LICENSE.txt
54
+ - MIT-LICENSE
55
+ - README.md
56
+ - Rakefile
57
+ - lib/generators/webhookr/mandrill/example_hooks_generator.rb
58
+ - lib/generators/webhookr/mandrill/init_generator.rb
59
+ - lib/generators/webhookr/mandrill/templates/mandrill_hooks.rb
60
+ - lib/webhookr-mandrill.rb
61
+ - lib/webhookr-mandrill/version.rb
62
+ - test/generators/webhookr/mandrill/init_generator_tests.rb
63
+ - test/test_helper.rb
64
+ - test/unit/webhookr-mandrill/version_tests.rb
65
+ - test/unit/webhookr-mandrill_tests.rb
66
+ - webhookr-mandrill.gemspec
67
+ homepage: http://github.com/gerrypower/webhookr-mandrill
68
+ licenses:
69
+ - MIT
70
+ metadata: {}
71
+ post_install_message:
72
+ rdoc_options: []
73
+ require_paths:
74
+ - lib
75
+ required_ruby_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - '>='
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ required_rubygems_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - '>='
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ requirements: []
86
+ rubyforge_project:
87
+ rubygems_version: 2.0.3
88
+ signing_key:
89
+ specification_version: 4
90
+ summary: A webhookr extension to support Mandrill webhooks.
91
+ test_files:
92
+ - test/generators/webhookr/mandrill/init_generator_tests.rb
93
+ - test/test_helper.rb
94
+ - test/unit/webhookr-mandrill/version_tests.rb
95
+ - test/unit/webhookr-mandrill_tests.rb