pdm-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/lib/pdm-rails/delivery.rb +4 -0
- data/lib/pdm-rails/ext/action_mailer/base.rb +32 -0
- data/lib/pdm-rails/railtie.rb +11 -2
- data/lib/pdm-rails/version.rb +1 -1
- data/lib/pdm-rails.rb +3 -0
- metadata +20 -17
data/lib/pdm-rails/delivery.rb
CHANGED
@@ -0,0 +1,32 @@
|
|
1
|
+
require "action_mailer/base"
|
2
|
+
|
3
|
+
module ActionMailer
|
4
|
+
class Base
|
5
|
+
|
6
|
+
def view_assigns_with_pdm
|
7
|
+
view_assigns_without_pdm.tap do |view_assigns|
|
8
|
+
view_assigns.delete("_message")
|
9
|
+
end
|
10
|
+
end
|
11
|
+
alias_method_chain :view_assigns, :pdm
|
12
|
+
|
13
|
+
def assign_pdm_template(template)
|
14
|
+
return unless template.formats.include?(:html)
|
15
|
+
message.template_html = template.source
|
16
|
+
message.template_assigns = view_assigns_with_pdm
|
17
|
+
end
|
18
|
+
|
19
|
+
def render_with_pdm(opts)
|
20
|
+
unless ::Pdm::Rails::Delivery === message.delivery_method
|
21
|
+
return render_without_pdm(opts)
|
22
|
+
end
|
23
|
+
|
24
|
+
if message.delivery_method.personalization?
|
25
|
+
assign_pdm_template(opts[:template])
|
26
|
+
end
|
27
|
+
|
28
|
+
"" # The result of this method is shoved in 'body'
|
29
|
+
end
|
30
|
+
alias_method_chain :render, :pdm
|
31
|
+
end
|
32
|
+
end
|
data/lib/pdm-rails/railtie.rb
CHANGED
@@ -7,14 +7,23 @@ module Pdm
|
|
7
7
|
|
8
8
|
require "action_mailer"
|
9
9
|
require "pdm-rails/delivery"
|
10
|
-
|
10
|
+
|
11
|
+
require "pdm-rails/ext/action_mailer/base"
|
12
|
+
require "pdm/ext/mail/message"
|
13
|
+
|
11
14
|
# Register the :pdm delivery method. This will also add a
|
12
15
|
# +pdm_settings+ method to customize the various bits.
|
13
16
|
settings = {
|
17
|
+
# !! NB !! This *must* be filled in.
|
14
18
|
:api_key => nil,
|
19
|
+
|
20
|
+
# If this option is enabled, templating will be done on the
|
21
|
+
# server-side. Please leave this disabled for now as the API
|
22
|
+
# for this is not finalized.
|
23
|
+
:personalization => false,
|
15
24
|
}
|
16
25
|
settings = Pdm.default_options.merge(settings)
|
17
|
-
ActionMailer::Base.add_delivery_method(:pdm, Pdm::Rails::Delivery, settings)
|
26
|
+
::ActionMailer::Base.add_delivery_method(:pdm, Pdm::Rails::Delivery, settings)
|
18
27
|
end
|
19
28
|
end
|
20
29
|
end
|
data/lib/pdm-rails/version.rb
CHANGED
data/lib/pdm-rails.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pdm-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- PipeDevMail
|
@@ -15,10 +15,11 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-11-20 00:00:00 +02:00
|
19
|
+
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
|
-
|
22
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
22
23
|
none: false
|
23
24
|
requirements:
|
24
25
|
- - ">="
|
@@ -27,12 +28,12 @@ dependencies:
|
|
27
28
|
segments:
|
28
29
|
- 0
|
29
30
|
version: "0"
|
30
|
-
|
31
|
-
requirement: *id001
|
32
|
-
type: :development
|
31
|
+
version_requirements: *id001
|
33
32
|
name: rake
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
34
35
|
- !ruby/object:Gem::Dependency
|
35
|
-
|
36
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
36
37
|
none: false
|
37
38
|
requirements:
|
38
39
|
- - ">="
|
@@ -43,12 +44,12 @@ dependencies:
|
|
43
44
|
- 0
|
44
45
|
- 0
|
45
46
|
version: 3.0.0
|
46
|
-
|
47
|
-
requirement: *id002
|
48
|
-
type: :runtime
|
47
|
+
version_requirements: *id002
|
49
48
|
name: rails
|
49
|
+
type: :runtime
|
50
|
+
prerelease: false
|
50
51
|
- !ruby/object:Gem::Dependency
|
51
|
-
|
52
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
52
53
|
none: false
|
53
54
|
requirements:
|
54
55
|
- - ">="
|
@@ -57,10 +58,10 @@ dependencies:
|
|
57
58
|
segments:
|
58
59
|
- 0
|
59
60
|
version: "0"
|
60
|
-
|
61
|
-
requirement: *id003
|
62
|
-
type: :runtime
|
61
|
+
version_requirements: *id003
|
63
62
|
name: pdm
|
63
|
+
type: :runtime
|
64
|
+
prerelease: false
|
64
65
|
description: Use the PipeDevMail gem within Rails
|
65
66
|
email:
|
66
67
|
- support@pipedevmail.com
|
@@ -76,9 +77,11 @@ files:
|
|
76
77
|
- Rakefile
|
77
78
|
- lib/pdm-rails.rb
|
78
79
|
- lib/pdm-rails/delivery.rb
|
80
|
+
- lib/pdm-rails/ext/action_mailer/base.rb
|
79
81
|
- lib/pdm-rails/railtie.rb
|
80
82
|
- lib/pdm-rails/version.rb
|
81
83
|
- pdm-rails.gemspec
|
84
|
+
has_rdoc: true
|
82
85
|
homepage: ""
|
83
86
|
licenses: []
|
84
87
|
|
@@ -108,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
111
|
requirements: []
|
109
112
|
|
110
113
|
rubyforge_project:
|
111
|
-
rubygems_version: 1.
|
114
|
+
rubygems_version: 1.6.2
|
112
115
|
signing_key:
|
113
116
|
specification_version: 3
|
114
117
|
summary: Interact with the PDM API from Rails
|