pling-actionmailer 0.1.0 → 0.2.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/Gemfile CHANGED
@@ -1,9 +1,8 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
- # Specify your gem's dependencies in pling.gemspec
4
3
  gemspec
5
4
 
6
- gem 'pling', :path => '../pling'
5
+ gem 'pling', :git => 'git://github.com/flinc/pling.git'
7
6
 
8
7
  gem 'guard'
9
8
  gem 'guard-rspec'
data/README.md CHANGED
@@ -8,11 +8,6 @@
8
8
 
9
9
  gem 'pling-actionmailer', :require => 'pling/gateways/action_mailer'
10
10
 
11
- ## Usage
12
-
13
-
14
-
15
-
16
11
  ## Build Status
17
12
 
18
13
  pling-actionmailer is on [Travis](http://travis-ci.org/flinc/pling-actionmailer) running the specs on Ruby 1.8.7, Ruby Enterprise Edition, Ruby 1.9.2, Ruby HEAD, JRuby, Rubinius and Rubinius 2.
@@ -7,6 +7,6 @@
7
7
  </style>
8
8
  </head>
9
9
  <body>
10
- <%= @message.content %>
10
+ <%= @message.body %>
11
11
  </body>
12
12
  </html>
@@ -1 +1 @@
1
- <%= @message.content %>
1
+ <%= @message.body %>
@@ -10,12 +10,9 @@ module Pling
10
10
  def pling_message(message, device, configuration)
11
11
  @message, @device, @configuration = message, device, configuration
12
12
 
13
- use_text = configuration.delete(:text)
14
- use_html = configuration.delete(:html)
15
-
16
- mail(configuration.merge(:to => device.identifier)) do |format|
17
- format.text { render 'pling/mailer/pling_message' } if use_text
18
- format.html { render 'pling/mailer/pling_message' } if use_html
13
+ mail(:to => device.identifier, :from => configuration[:from]) do |format|
14
+ format.text { render 'pling/mailer/pling_message' } if configuration[:text]
15
+ format.html { render 'pling/mailer/pling_message' } if configuration[:html]
19
16
  end
20
17
  end
21
18
  end
@@ -26,10 +23,7 @@ module Pling
26
23
  setup_configuration(configuration, :require => [:from])
27
24
  end
28
25
 
29
- def deliver(message, device)
30
- message = Pling._convert(message, :message)
31
- device = Pling._convert(device, :device)
32
-
26
+ def deliver!(message, device)
33
27
  mailer = configuration[:mailer] || Pling::Gateway::ActionMailer::Mailer
34
28
  mailer.pling_message(message, device, configuration).deliver
35
29
  end
@@ -37,12 +31,12 @@ module Pling
37
31
  private
38
32
 
39
33
  def default_configuration
40
- {
34
+ super.merge({
41
35
  :html => true,
42
36
  :text => true
43
- }
37
+ })
44
38
  end
45
39
 
46
40
  end
47
41
  end
48
- end
42
+ end
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "pling-actionmailer"
5
- s.version = "0.1.0"
5
+ s.version = "0.2.0"
6
6
  s.authors = ["benedikt", "t6d", "fabrik42"]
7
7
  s.email = ["benedikt@synatic.net", "me@t6d.de", "fabrik42@gmail.com"]
8
8
  s.homepage = "http://flinc.github.com/pling-actionmailer"
@@ -14,9 +14,10 @@ Gem::Specification.new do |s|
14
14
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
15
15
  s.require_paths = ["lib"]
16
16
 
17
- s.add_runtime_dependency "pling", "~> 0.0"
17
+ s.add_runtime_dependency "pling", "~> 0.1"
18
18
  s.add_runtime_dependency "actionmailer", "~> 3.0"
19
19
 
20
20
  s.add_development_dependency "rspec", "~> 2.7"
21
21
  s.add_development_dependency "yard", ">= 0.7"
22
+ s.add_development_dependency "rake", ">= 0.9"
22
23
  end
@@ -40,6 +40,24 @@ describe Pling::Gateway::ActionMailer do
40
40
 
41
41
  gateway.deliver(message, device)
42
42
  end
43
+
44
+ it 'should allow configuration of the :mailer' do
45
+ mailer = mock()
46
+ mailer.should_receive(:pling_message).
47
+ with(message, device, hash_including(valid_configuration)).
48
+ and_return(mail)
49
+
50
+ gateway = Pling::Gateway::ActionMailer.new(valid_configuration.merge(:mailer => mailer))
51
+
52
+ gateway.deliver(message, device)
53
+ end
54
+
55
+ it 'should not change the configuration' do
56
+ configuration = valid_configuration.merge(:html => true, :text => false)
57
+ gateway = Pling::Gateway::ActionMailer.new(configuration)
58
+
59
+ expect { gateway.deliver(message, device) }.to_not change(configuration, :count)
60
+ end
43
61
  end
44
62
 
45
63
  describe '#deliver' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pling-actionmailer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,22 +11,22 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2011-10-21 00:00:00.000000000Z
14
+ date: 2011-10-28 00:00:00.000000000Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: pling
18
- requirement: &70329444843100 !ruby/object:Gem::Requirement
18
+ requirement: &70346678559800 !ruby/object:Gem::Requirement
19
19
  none: false
20
20
  requirements:
21
21
  - - ~>
22
22
  - !ruby/object:Gem::Version
23
- version: '0.0'
23
+ version: '0.1'
24
24
  type: :runtime
25
25
  prerelease: false
26
- version_requirements: *70329444843100
26
+ version_requirements: *70346678559800
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: actionmailer
29
- requirement: &70329444842560 !ruby/object:Gem::Requirement
29
+ requirement: &70346678558420 !ruby/object:Gem::Requirement
30
30
  none: false
31
31
  requirements:
32
32
  - - ~>
@@ -34,10 +34,10 @@ dependencies:
34
34
  version: '3.0'
35
35
  type: :runtime
36
36
  prerelease: false
37
- version_requirements: *70329444842560
37
+ version_requirements: *70346678558420
38
38
  - !ruby/object:Gem::Dependency
39
39
  name: rspec
40
- requirement: &70329444841800 !ruby/object:Gem::Requirement
40
+ requirement: &70346678557260 !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
43
  - - ~>
@@ -45,10 +45,10 @@ dependencies:
45
45
  version: '2.7'
46
46
  type: :development
47
47
  prerelease: false
48
- version_requirements: *70329444841800
48
+ version_requirements: *70346678557260
49
49
  - !ruby/object:Gem::Dependency
50
50
  name: yard
51
- requirement: &70329444841320 !ruby/object:Gem::Requirement
51
+ requirement: &70346678556360 !ruby/object:Gem::Requirement
52
52
  none: false
53
53
  requirements:
54
54
  - - ! '>='
@@ -56,7 +56,18 @@ dependencies:
56
56
  version: '0.7'
57
57
  type: :development
58
58
  prerelease: false
59
- version_requirements: *70329444841320
59
+ version_requirements: *70346678556360
60
+ - !ruby/object:Gem::Dependency
61
+ name: rake
62
+ requirement: &70346678555560 !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ! '>='
66
+ - !ruby/object:Gem::Version
67
+ version: '0.9'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: *70346678555560
60
71
  description: Pling Gateway to ActionMailer
61
72
  email:
62
73
  - benedikt@synatic.net