mandrill_mailer 0.0.5 → 0.0.6

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/README.md CHANGED
@@ -17,7 +17,10 @@ ActionMailer::Base.smtp_settings = {
17
17
  :domain => 'heroku.com'
18
18
  }
19
19
  ActionMailer::Base.delivery_method = :smtp
20
- MandrillMailer::Config.api_key = ENV['MANDRILL_API_KEY']
20
+
21
+ MandrillMailer.configure do |config|
22
+ config.api_key = ENV['MANDRILL_API_KEY']
23
+ end
21
24
  ```
22
25
 
23
26
  Don't forget to setup your ENV variables on your server
@@ -25,7 +28,7 @@ Don't forget to setup your ENV variables on your server
25
28
  You will also need to set default_url_options for the mailer, similar to action mailer
26
29
  in your environment config files:
27
30
 
28
- `MandrillMailer::Config.default_url_options = { :host => 'localhost' }`
31
+ `config.mandrill_mailer.default_url_options = { :host => 'localhost' }`
29
32
 
30
33
  ## Creating a new mailer
31
34
  Creating a new Mandrill Mailer is similar to a normal Rails mailer:
@@ -0,0 +1,7 @@
1
+ require 'rails'
2
+
3
+ module MandrillMailer
4
+ class Railtie < Rails::Railtie
5
+ config.mandrill_mailer = ActiveSupport::OrderedOptions.new
6
+ end
7
+ end
@@ -240,7 +240,7 @@ module MandrillMailer
240
240
  end
241
241
  end
242
242
  else
243
- Rails.application.routes.url_helpers.method(method).call(*args, host: MandrillMailer::Config.default_url_options[:host])
243
+ Rails.application.routes.url_helpers.method(method).call(*args, host: MandrillMailer.config.default_url_options[:host])
244
244
  end
245
245
  end
246
246
 
@@ -277,7 +277,7 @@ module MandrillMailer
277
277
  end
278
278
 
279
279
  def api_key
280
- MandrillMailer::Config.api_key
280
+ MandrillMailer.config.api_key
281
281
  end
282
282
  end
283
283
  end
@@ -1,3 +1,3 @@
1
1
  module MandrillMailer
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -1,8 +1,15 @@
1
1
  require 'action_view'
2
+ require 'mandrill_mailer/railtie'
2
3
  require 'mandrill_mailer/mock'
3
4
  require 'mandrill_mailer/transactional_mailer'
4
5
  require 'mandrill_mailer/version'
5
6
 
6
7
  module MandrillMailer
8
+ def self.configure(&block)
9
+ block.call(MandrillMailer::Railtie.config.mandrill_mailer)
10
+ end
7
11
 
12
+ def self.config
13
+ MandrillMailer::Railtie.config.mandrill_mailer
14
+ end
8
15
  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.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -87,8 +87,8 @@ files:
87
87
  - Gemfile.lock
88
88
  - README.md
89
89
  - lib/mandrill_mailer.rb
90
- - lib/mandrill_mailer/config.rb
91
90
  - lib/mandrill_mailer/mock.rb
91
+ - lib/mandrill_mailer/railtie.rb
92
92
  - lib/mandrill_mailer/transactional_mailer.rb
93
93
  - lib/mandrill_mailer/version.rb
94
94
  - mandrill_mailer-0.0.2.gem
@@ -1,29 +0,0 @@
1
- module MandrillMailer
2
- class Config
3
- # Public: this enables the api key to be set in an initializer
4
- # ex. MandrillMailer.api_key = ENV[MANDRILL_API_KEY]
5
- #
6
- # key - Api key for the Mandrill api
7
- #
8
- #
9
- # Returns
10
- def self.api_key=(key)
11
- @@api_key = key
12
- end
13
-
14
- # Public: Returns the api key
15
- #
16
- # Returns the api key
17
- def self.api_key
18
- @@api_key || ''
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
28
- end
29
- end