mandrill-rails 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -5,7 +5,7 @@ rvm:
5
5
  - 1.8.7
6
6
  - 1.9.2
7
7
  - 1.9.3
8
- - rbx-18mode
8
+ # - rbx-18mode # removing for now; travis is having chronic intermittent issues building this properly at the moment
9
9
  - rbx-19mode
10
10
  - jruby-18mode
11
11
  - jruby-19mode
data/CHANGELOG ADDED
@@ -0,0 +1,3 @@
1
+ 0.0.4
2
+ ===================================================================
3
+ * removed manadrill gem as a dependency (thanks to @ssaunier for highlighting this)
data/README.rdoc CHANGED
@@ -1,20 +1,22 @@
1
1
  = Mandrill::Rails {<img src="https://secure.travis-ci.org/evendis/mandrill-rails.png" />}[http://travis-ci.org/evendis/mandrill-rails]
2
2
 
3
- Mandrill::Rails extends the capabilities of the
4
- {Mandrill}[https://github.com/tatemae-consultancy/mandrill] gem to provide tighter integration for Rails projects.
5
-
6
3
  The primary goal of Mandrill::Rails is to make supporting Mandrill web hooks as easy and Rails-native as possible. As other opportunities for better Rails integration of the Mandrill API are discovered, these may be rolled in too.
7
4
 
5
+ Mandrill::Rails currently does not need or require any direct Mandrill API integration (such as provided by
6
+ various {Mandrill}[https://rubygems.org/search?utf8=%E2%9C%93&query=mandrill]
7
+ and {MailChimp}[https://rubygems.org/search?utf8=%E2%9C%93&query=mailchimp] gems).
8
+ If you need direct API integration in addition to Mandrill::Rails features, you can choose to add whichever best meets your needs.
9
+
8
10
  FYI, {Mandrill}[http://mandrill.com/] is the transactional email service by the same folks who do MailChimp.
9
11
 
10
12
  == Requirements and Known Limitations
11
13
 
12
- * Tested with MRI 1.8.7, 1.9.2, 1.9.3, Rubinius (1.8 and 1.9 mode), JRuby (1.8 and 1.9 mode)
13
- * Requires Rails >= 3.0.3 (including 3.1 and 3.2)
14
- * Includes {Mandrill}[https://github.com/tatemae-consultancy/mandrill] ~> 0.0.2 as a dependency
14
+ * Tested with MRI 1.8.7, 1.9.2, 1.9.3, Rubinius (1.9 mode), JRuby (1.8 and 1.9 mode).
15
+ * Rubinius 1.8 mode build temporarily removed since travis is having intermittent problems with this config.
16
+ * Requires Rails >= 3.0.3 (including 3.1 and 3.2).
15
17
 
16
18
  Food for thought (upcoming features maybe)..
17
- * some generators may be handy to avoid the manual coding to hook up web hooks
19
+ * some generators may be handy to avoid the manual coding to wire up web hooks
18
20
  * I thought about implementing this as an engine, but the overhead did not seem appropriate. Maybe that view will change..
19
21
 
20
22
  == The Mandrill::Rails Cookbook
@@ -35,7 +37,10 @@ Or install it yourself as:
35
37
 
36
38
  === How do I install it for gem development?
37
39
 
38
- If you want to work on enhancements of fix bugs in Mandrill::Rails, fork and clone the github repository. If you are using bundler (recommended), run <tt>bundle</tt> to install development dependencies.
40
+ If you want to work on enhancements or fix bugs in Mandrill::Rails, fork and clone the github repository. If you are using bundler (recommended), run <tt>bundle</tt> to install development dependencies.
41
+
42
+ Run tests using <tt>rake</tt> or <tt>rake spec</tt>, and note that guard is also included with the development dependencies so
43
+ you can kick-off continuous testing of changed files by running <tt>bundle exec guard</tt>.
39
44
 
40
45
  See the section below on 'Contributing to Mandrill::Rails' for more information.
41
46
 
@@ -71,7 +76,7 @@ See {Mandrill WebHooks}[https://mandrillapp.com/settings/webhooks]
71
76
  * select the events you want to trigger on
72
77
  * set the "Post to URL" to point to your controller e.g. http://mydomain.com/inbox
73
78
 
74
- === How do I handle a specific Mandrill event payload in my app?
79
+ === How do I handle specific Mandrill event payloads in my app?
75
80
 
76
81
  Once we have configured Mandrill and setup our routes and controllers, our app will successfully
77
82
  receive WebHook event notifications from Mandrill. But we are not doing anything with the payload yet.
@@ -82,9 +87,9 @@ we are interested in.
82
87
  The list of available event types includes: inbound, send, hard_bounce, soft_bounce, open,
83
88
  click, spam, unsub, and reject.
84
89
 
85
- In our controller, we simply write a method called `handle_<event-type>` and it will be called
90
+ In our controller, we simply write a method called <tt>handle_<event-type></tt> and it will be called
86
91
  for each event payload received. The event payload will be passed to this method
87
- as an Mandrill::WebHook::EventDecorator - basically a Hash with some additional methods to
92
+ as a Mandrill::WebHook::EventDecorator - basically a Hash with some additional methods to
88
93
  help extract payload-specific elements.
89
94
 
90
95
  For example, to handle inbound email:
@@ -109,7 +114,7 @@ And if you don't care to handle a specific payload type - then just don't implem
109
114
 
110
115
  === How do I pull apart the event_payload?
111
116
 
112
- The `event_payload` object passed to our handler represents a single event and is packaged
117
+ The <tt>event_payload</tt> object passed to our handler represents a single event and is packaged
113
118
  as an Mandrill::WebHook::EventDecorator - basically a Hash with some additional methods to
114
119
  help extract payload-specific elements.
115
120
 
@@ -127,10 +132,10 @@ some are included in the project source under spec/fixtures/webhook_examples.
127
132
 
128
133
  === What additional methods does event_payload provide to help extract payload-specific elements?
129
134
 
130
- In addition to prividing full Hash-like access to the raw message, the `event_payload` object
135
+ In addition to prividing full Hash-like access to the raw message, the <tt>event_payload</tt> object
131
136
  (a Mandrill::WebHook::EventDecorator) provides a range of helper methods for some of the more obvious
132
137
  things you might need to do with the payload. Here are some examples (see
133
- {Mandrill::WebHook::EventDecorator class documentation}[http://rubydoc.info/gems/mandrill-rails/0.0.2/Mandrill/WebHook/EventDecorator]
138
+ {Mandrill::WebHook::EventDecorator class documentation}[http://rubydoc.info/gems/mandrill-rails/Mandrill/WebHook/EventDecorator]
134
139
  for full details)
135
140
 
136
141
  event_payload.message_id
@@ -160,14 +165,14 @@ for full details)
160
165
 
161
166
  === How to extend Mandrill::WebHook::EventDecorator for application-specific payload handling?
162
167
 
163
- It's quite likely you may benefit from adding more application-specific intelligence to the
164
- `event_payload` object.
168
+ It's likely you may benefit from adding more application-specific intelligence to the
169
+ <tt>event_payload</tt> object.
165
170
 
166
171
  There are many ways to do this, but it is quite legitimate to reopen the EventDecorator class and add your own methods
167
172
  if you wish.
168
173
 
169
- For example `event_payload.user_email` returns the subject user email address, but perhaps I will commonly want to
170
- match that with a user record in my system. Or I similarly want to resolve `event_payload.recipient_emails` to user records.
174
+ For example <tt>event_payload.user_email</tt> returns the subject user email address, but perhaps I will commonly want to
175
+ match that with a user record in my system. Or I similarly want to resolve <tt>event_payload.recipient_emails</tt> to user records.
171
176
  In this case, I could extend EventDecorator in my app like this:
172
177
 
173
178
  # Extends Mandrill::WebHook::EventDecorator with app-specific event payload transformation
@@ -187,7 +192,7 @@ In this case, I could extend EventDecorator in my app like this:
187
192
 
188
193
  === How do I extract attachments from an inbound email?
189
194
 
190
- The EventDecorator class provides an `attachments` method to access an array of attachments (if any).
195
+ The EventDecorator class provides an <tt>attachments</tt> method to access an array of attachments (if any).
191
196
  Each attachment is encapsulated in a class that describes the name, mime type, raw and decoded content.
192
197
 
193
198
  For example:
@@ -211,10 +216,13 @@ For example:
211
216
  end
212
217
  end
213
218
 
214
- === How do I use Mandrill gem features with Mandrill::Rails?
219
+ === How do I use Mandrill API features with Mandrill::Rails?
215
220
 
216
- {Mandrill}[https://github.com/tatemae-consultancy/mandrill] is included with Mandrill::Rails
217
- and its behaviour is unchanged. You can use all the features of the Mandrill gem as normal.
221
+ Mandrill::Rails currently does not need or require any direct Mandrill API integration (such as provided by
222
+ various {Mandrill}[https://rubygems.org/search?utf8=%E2%9C%93&query=mandrill]
223
+ and {MailChimp}[https://rubygems.org/search?utf8=%E2%9C%93&query=mailchimp] gems).
224
+ If you need direct API integration in addition to Mandrill::Rails features,
225
+ you can choose to add whichever best meets your needs and use as normal.
218
226
 
219
227
  == Contributing to Mandrill::Rails
220
228
 
@@ -224,7 +232,7 @@ and its behaviour is unchanged. You can use all the features of the Mandrill gem
224
232
  * Start a feature/bugfix branch
225
233
  * Commit and push until you are happy with your contribution
226
234
  * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
227
- * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
235
+ * Please try not to mess with the gemspec, Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
228
236
 
229
237
  == Copyright
230
238
 
@@ -3,5 +3,5 @@ module Mandrill
3
3
  end
4
4
  end
5
5
  unless defined?(Mandrill::Rails::VERSION)
6
- Mandrill::Rails::VERSION = "0.0.3"
6
+ Mandrill::Rails::VERSION = "0.0.4"
7
7
  end
@@ -15,7 +15,6 @@ Gem::Specification.new do |gem|
15
15
  gem.require_paths = ["lib"]
16
16
  gem.version = Mandrill::Rails::VERSION
17
17
 
18
- gem.add_runtime_dependency(%q<mandrill>, ["~> 0.0.2"])
19
18
  gem.add_runtime_dependency(%q<activesupport>, [">= 3.0.3"])
20
19
  gem.add_development_dependency(%q<bundler>, [">= 1.1.0"])
21
20
  gem.add_development_dependency(%q<rake>, ["~> 0.9.2.2"])
@@ -16,7 +16,7 @@ describe Mandrill::WebHook::EventDecorator do
16
16
  # * soft_bounce - message has soft bounced
17
17
  # * spam - recipient marked a message as spam
18
18
  # * unsub - recipient unsubscribed
19
- # http://goingon.in/inbox
19
+ #
20
20
  {
21
21
  'inbound' => {
22
22
  :event_type => 'inbound',
@@ -211,14 +211,14 @@ describe Mandrill::WebHook::EventDecorator do
211
211
  let(:raw_event) { webhook_example_event('inbound_with_multiple_attachments') }
212
212
  its(:count) { should eql(2) }
213
213
  describe "pdf attachment" do
214
- subject { event_payload.attachments.first }
214
+ subject { event_payload.attachments.select{|a| a.type =~ /pdf/ }.first }
215
215
  its(:name) { should eql('sample.pdf') }
216
216
  its(:type) { should eql('application/pdf') }
217
217
  its(:content) { should match(/^JVBERi0xL/) }
218
218
  its(:decoded_content) { should match(/^%PDF-1.3/) }
219
219
  end
220
220
  describe "txt attachment" do
221
- subject { event_payload.attachments.last }
221
+ subject { event_payload.attachments.select{|a| a.type =~ /plain/ }.first }
222
222
  its(:name) { should eql('sample.txt') }
223
223
  its(:type) { should eql('text/plain') }
224
224
  its(:content) { should eql("This is \na sample\ntext file\n") }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mandrill-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,24 +9,8 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-14 00:00:00.000000000 Z
12
+ date: 2013-04-29 00:00:00.000000000 Z
13
13
  dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: mandrill
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ~>
20
- - !ruby/object:Gem::Version
21
- version: 0.0.2
22
- type: :runtime
23
- prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ~>
28
- - !ruby/object:Gem::Version
29
- version: 0.0.2
30
14
  - !ruby/object:Gem::Dependency
31
15
  name: activesupport
32
16
  requirement: !ruby/object:Gem::Requirement
@@ -133,6 +117,7 @@ files:
133
117
  - .gitignore
134
118
  - .rspec
135
119
  - .travis.yml
120
+ - CHANGELOG
136
121
  - Gemfile
137
122
  - Guardfile
138
123
  - LICENSE
@@ -183,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
183
168
  version: '0'
184
169
  requirements: []
185
170
  rubyforge_project:
186
- rubygems_version: 1.8.24
171
+ rubygems_version: 1.8.23
187
172
  signing_key:
188
173
  specification_version: 3
189
174
  summary: Provides webhook processing and event decoration to make using Mandrill with