thincloud-postmark 0.3.2 → 0.4.0
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
@@ -38,17 +38,27 @@ $ gem install thincloud-postmark
|
|
38
38
|
|
39
39
|
## Usage
|
40
40
|
|
41
|
+
Thincloud::Postmark is only enabled for environments included in the `environments` array. For instance, to use `Postmark` in development and staging the list would look like this:
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
[:development, :staging]
|
45
|
+
```
|
46
|
+
|
47
|
+
The different configuration options and detailed below.
|
48
|
+
|
41
49
|
### Configuration
|
42
50
|
|
43
51
|
Thincloud::Postmark configuration options are available to customize the engine behavior. Available options and their default values:
|
44
52
|
|
45
53
|
```ruby
|
54
|
+
# Rails environment(s) that should use the `postmark` delivery method.
|
55
|
+
environments = []
|
46
56
|
api_key = "POSTMARK_API_TEST"
|
47
57
|
interceptor_to = nil
|
48
58
|
interceptor_cc = nil
|
49
59
|
interceptor_bcc = nil
|
50
60
|
|
51
|
-
# Rails environment(s)
|
61
|
+
# Rails environment(s) that should have mail intercepted.
|
52
62
|
interceptor_environments = []
|
53
63
|
```
|
54
64
|
|
@@ -75,7 +85,8 @@ interceptor_bcc -> ENV["THINCLOUD_INTERCEPTOR_BCC"]
|
|
75
85
|
The `Thincloud::Postmark` module accepts a `configure` block that takes the same options listed above. This block can be put into an initializer or inside of a `config\environments` file.
|
76
86
|
|
77
87
|
```ruby
|
78
|
-
Thincloud::Postmark do |config|
|
88
|
+
Thincloud::Postmark.configure do |config|
|
89
|
+
config.environments = [:development, :production]
|
79
90
|
config.api_key = "MY_API_KEY"
|
80
91
|
config.secure = true
|
81
92
|
config.interceptor_to = "keymaster@zuul.com"
|
@@ -91,6 +102,7 @@ You can also access the configuration via the Rails configuration object. In fac
|
|
91
102
|
|
92
103
|
```ruby
|
93
104
|
#...
|
105
|
+
config.thincloud.postmark.environments = [:development, :production]
|
94
106
|
config.thincloud.postmark.api_key = "MY_API_KEY"
|
95
107
|
config.thincloud.postmark.secure = false
|
96
108
|
config.thincloud.postmark.interceptor_environments = [:staging]
|
@@ -12,6 +12,7 @@ module Thincloud
|
|
12
12
|
|
13
13
|
# Public: Configuration options for the Thincloud::Postmark module
|
14
14
|
class Configuration
|
15
|
+
attr_accessor :environments
|
15
16
|
attr_accessor :api_key
|
16
17
|
attr_accessor :interceptor_to
|
17
18
|
attr_accessor :interceptor_cc
|
@@ -25,6 +26,7 @@ module Thincloud
|
|
25
26
|
interceptor_cc = ENV["THINCLOUD_INTERCEPTOR_CC"]
|
26
27
|
interceptor_bcc = ENV["THINCLOUD_INTERCEPTOR_BCC"]
|
27
28
|
|
29
|
+
@environments = []
|
28
30
|
@api_key ||= api_key
|
29
31
|
@interceptor_to ||= interceptor_to
|
30
32
|
@interceptor_cc ||= interceptor_cc
|
@@ -34,7 +34,10 @@ module Thincloud
|
|
34
34
|
# process to make sure we have our config settings then we apply them
|
35
35
|
# to AM::Base. Keep them in both places so config appears normal.
|
36
36
|
initializer "thincloud.postmark.settings", before: "finisher_hook" do
|
37
|
-
|
37
|
+
# TODO: Find a way to check other environments in the tests. The dummy
|
38
|
+
# application setup in Rails Engine testing only allows us to test one
|
39
|
+
# environment, :test in this case.
|
40
|
+
if configuration.environments.include?(Rails.env.to_sym)
|
38
41
|
[ActionMailer::Base, config.action_mailer].each do |c|
|
39
42
|
c.delivery_method = :postmark
|
40
43
|
c.postmark_settings = { api_key: configuration.api_key }
|
data/test/configuration_test.rb
CHANGED
@@ -4,6 +4,8 @@ describe Thincloud::Postmark::Configuration do
|
|
4
4
|
let(:config) { Thincloud::Postmark::Configuration.new }
|
5
5
|
|
6
6
|
it { config.must_be_kind_of Thincloud::Postmark::Configuration }
|
7
|
+
it { config.must_respond_to :environments }
|
8
|
+
it { config.must_respond_to :environments= }
|
7
9
|
it { config.must_respond_to :api_key }
|
8
10
|
it { config.must_respond_to :api_key= }
|
9
11
|
it { config.must_respond_to :secure }
|
@@ -15,6 +17,7 @@ describe Thincloud::Postmark::Configuration do
|
|
15
17
|
it { config.must_respond_to :interceptor_bcc= }
|
16
18
|
|
17
19
|
describe "defaults" do
|
20
|
+
it { config.environments.must_equal [] }
|
18
21
|
it { config.api_key.must_equal "POSTMARK_API_TEST" }
|
19
22
|
it { config.secure.must_equal true }
|
20
23
|
it { ::Postmark.secure.must_equal true }
|
@@ -35,6 +35,7 @@ Dummy::Application.configure do
|
|
35
35
|
# Print deprecation notices to the stderr
|
36
36
|
config.active_support.deprecation = :stderr
|
37
37
|
|
38
|
+
config.thincloud.postmark.environments = [:test]
|
38
39
|
config.thincloud.postmark.interceptor_environments = [:test]
|
39
40
|
config.thincloud.postmark.interceptor_to = "marshmellowman@staypuft.com"
|
40
41
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thincloud-postmark
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2012-11-
|
15
|
+
date: 2012-11-23 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: thincloud-test
|
@@ -122,7 +122,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
122
122
|
version: '0'
|
123
123
|
segments:
|
124
124
|
- 0
|
125
|
-
hash: -
|
125
|
+
hash: -2032068721589309994
|
126
126
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
127
127
|
none: false
|
128
128
|
requirements:
|
@@ -131,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
131
131
|
version: '0'
|
132
132
|
segments:
|
133
133
|
- 0
|
134
|
-
hash: -
|
134
|
+
hash: -2032068721589309994
|
135
135
|
requirements: []
|
136
136
|
rubyforge_project:
|
137
137
|
rubygems_version: 1.8.24
|