mandrill_mailer 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -25,13 +25,13 @@ Don't forget to setup your ENV variables on your server
25
25
  You will also need to set default_url_options for the mailer, similar to action mailer
26
26
  in your environment config files:
27
27
 
28
- `MandrillMailer::TransactionalMailer.default_url_options = { :host => 'localhost' }`
28
+ `MandrillMailer::Config.default_url_options = { :host => 'localhost' }`
29
29
 
30
30
  ## Creating a new mailer
31
31
  Creating a new Mandrill Mailer is similar to a normal Rails mailer:
32
32
 
33
33
  ```
34
- class InvitationMailer < MandrillMailer
34
+ class InvitationMailer < MandrillMailer::TransactionalMailer
35
35
  default from: 'support@example.com'
36
36
 
37
37
  def invite(invitation)
@@ -91,7 +91,7 @@ You can send the email by using the familiar syntax:
91
91
  `InvitationMailer.invite(invitation).deliver`
92
92
 
93
93
  ## Creating a test method
94
- When switching over to Mandrill for transactional emails we found that it was hard to setup a mailer in the console to send test emails easily (those darn designers), but really, you don't want to have to setup test objects everytime you want to send a test email. You can set up a testing 'stub' once and then call the `.test` method to send the test email.
94
+ When switching over to Mandrill for transactional emails we found that it was hard to setup a mailer in the console to send test emails easily (those darn designers), but really, you don't want to have to setup test objects everytime you want to send a test email. You can set up a testing 'mock' once and then call the `.test` method to send the test email.
95
95
 
96
96
  You can test the above email by typing: `InvitationMailer.test(:invite, email:<your email>)` into the Rails Console.
97
97
 
@@ -17,5 +17,13 @@ module MandrillMailer
17
17
  def self.api_key
18
18
  @@api_key || ''
19
19
  end
20
+
21
+ def self.default_url_options=(options={})
22
+ @@url_options = options
23
+ end
24
+
25
+ def self.default_url_options
26
+ @@url_options || {}
27
+ end
20
28
  end
21
29
  end
@@ -125,10 +125,6 @@ module MandrillMailer
125
125
 
126
126
  end
127
127
 
128
- def default_url_options=(options={})
129
- @@url_host = options[:host]
130
- end
131
-
132
128
  # Public: Triggers the stored Mandril params to be sent to the Mandrill api
133
129
  #
134
130
  # text - The String to be duplicated.
@@ -244,7 +240,7 @@ module MandrillMailer
244
240
  end
245
241
  end
246
242
  else
247
- Rails.application.routes.url_helpers.method(method).call(*args, host: @@url_host)
243
+ Rails.application.routes.url_helpers.method(method).call(*args, host: MandrillMailer::Config.default_url_options[:host])
248
244
  end
249
245
  end
250
246
 
@@ -1,3 +1,3 @@
1
1
  module MandrillMailer
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mandrill_mailer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: