sendgrid-rails 2.0.3 → 2.0.4

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.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ YmUyZWE1MDNiMWY3NzBjMWUyMmJiOGFhYzdkMmViMjAxMGMzYTFlYg==
5
+ data.tar.gz: !binary |-
6
+ NjY1MTFkMWEwODkzODViMWQxODNiZTJhN2YxN2Y5ODE3ZTQxOGM1MQ==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ NWI4MTg5MjRiYTFiNGE5ODAxNGU5N2JmZDE5NDlmMGU4NmZiNDYzZWY4NThm
10
+ Mzk5YWFhMjhhMDc0ZmYxMmY0M2JmNzg5NDg5MTUwMjA5YWExYWFhZmNmZGQ1
11
+ MmZlMDRjZThlNmVhYjhlOTEyZTI3ZjY1MTljOTZmZjhmZWM4Y2M=
12
+ data.tar.gz: !binary |-
13
+ NTQ4MmIwMWQyNzFlNjhjZDBhMzJiZjRkY2RmNGYxYTI0ZjY0YTFmYjNiZmQy
14
+ ZDEyNzNlZmJkOTc1YzM4MDAzMjI1YzMyNzFjMzY4ZTFjN2I3NGM3MTM3NmI2
15
+ MDQ2ZmQ5N2YwYWIyNGNlZDI0YWFiYzU4ZTRlODI3MmFlNmIyMzY=
@@ -31,7 +31,7 @@ In config/initializers/mail.rb:
31
31
  === Overriding default recipient in standard SMTP header
32
32
 
33
33
  Dummy recipient email used in sent email's "To" header and seen in received email's Received header.
34
- By deefault set to 'dummy@email.com'
34
+ By default set to 'dummy@email.com'
35
35
 
36
36
  In config/initializers/mail.rb:
37
37
 
@@ -101,6 +101,14 @@ Add an invisible image at the end of the email to track e-mail opens. If the ema
101
101
 
102
102
  == Change log
103
103
 
104
+ *v2.0.4*
105
+
106
+ * CC and BCC are copied to SendGrid XSMTP-API header
107
+
108
+ *v2.0.3*
109
+
110
+ * Ability to change "dummy_recipient" in config
111
+
104
112
  *v2.0.2*
105
113
 
106
114
  * ApiHeader#to_json wraps array items with spaces
@@ -1,32 +1,32 @@
1
- class SendGrid::ApiHeader
2
- attr_reader :data
3
-
4
- def initialize
5
- @data = Hash.new { |h,k| h[k] = Hash.new(&h.default_proc) }
6
- end
7
-
8
- def add_recipients(recipients)
9
- @data[:to] = [] unless @data[:to].instance_of?(Array)
10
- @data[:to] |= Array.wrap(recipients)
11
- end
12
-
13
- def substitute(var, val)
14
- @data[:sub][var] = Array.wrap(val)
15
- end
16
-
17
- def uniq_args(val)
18
- @data[:unique_args] = val if val.instance_of?(Hash)
19
- end
20
-
21
- def category(cat)
22
- @data[:category] = cat
23
- end
24
-
25
- def add_filter_setting(fltr, setting, val)
26
- @data[:filters][fltr][:settings][setting] = val
27
- end
28
-
29
- def to_json
30
- JSON.generate(@data, :array_nl => ' ')
31
- end
32
- end
1
+ class SendGrid::ApiHeader
2
+ attr_reader :data
3
+
4
+ def initialize
5
+ @data = Hash.new { |h,k| h[k] = Hash.new(&h.default_proc) }
6
+ end
7
+
8
+ def add_recipients(recipients)
9
+ @data[:to] = [] unless @data[:to].instance_of?(Array)
10
+ @data[:to] |= Array.wrap(recipients)
11
+ end
12
+
13
+ def substitute(var, val)
14
+ @data[:sub][var] = Array.wrap(val)
15
+ end
16
+
17
+ def uniq_args(val)
18
+ @data[:unique_args] = val if val.instance_of?(Hash)
19
+ end
20
+
21
+ def category(cat)
22
+ @data[:category] = cat
23
+ end
24
+
25
+ def add_filter_setting(fltr, setting, val)
26
+ @data[:filters][fltr][:settings][setting] = val
27
+ end
28
+
29
+ def to_json
30
+ JSON.generate(@data, :array_nl => ' ')
31
+ end
32
+ end
@@ -3,6 +3,8 @@ module SendGrid
3
3
  def self.delivering_email(mail)
4
4
  sendgrid_header = mail.instance_variable_get(:@sendgrid_header)
5
5
  sendgrid_header.add_recipients(mail.to)
6
+ sendgrid_header.add_recipients(mail.cc)
7
+ sendgrid_header.add_recipients(mail.bcc)
6
8
  mail.header['X-SMTPAPI'] = sendgrid_header.to_json if sendgrid_header.data.present?
7
9
  mail.header['to'] = SendGrid.config.dummy_recipient
8
10
  end
@@ -1,4 +1,4 @@
1
- module SendGrid
2
- VERSION = "2.0.3"
3
- end
4
-
1
+ module SendGrid
2
+ VERSION = "2.0.4"
3
+ end
4
+
@@ -9,6 +9,7 @@ Gem::Specification.new do |s|
9
9
  s.authors = ["PavelTyk"]
10
10
  s.email = ["paveltyk@gmail.com"]
11
11
  s.homepage = "https://github.com/PavelTyk/sendgrid-rails"
12
+ s.license = "MIT"
12
13
  s.summary = %q{SendGrid gem fo Rails 3}
13
14
  s.description = %q{Gem to extend ActionMailer with SendGrid API support}
14
15
 
@@ -1,41 +1,41 @@
1
- require 'spec_helper'
2
-
3
- describe SendGrid::ApiHeader do
4
- let(:header) { SendGrid::ApiHeader.new }
5
- describe "#to_json" do
6
- it "returns valid json if no data was set" do
7
- header.to_json.should eql "{}"
8
- end
9
-
10
- it "contains 1 recipient (as array)" do
11
- header.add_recipients 'email@email.com'
12
- header.to_json.should eql '{"to":[ "email@email.com" ]}'
13
- end
14
-
15
- it "contaions an array of recipients" do
16
- header.add_recipients %w(email1@email.com email2@email.com)
17
- header.to_json.should eql '{"to":[ "email1@email.com", "email2@email.com" ]}'
18
- end
19
-
20
- it "contains substitution" do
21
- header.substitute :var1, 'Hello'
22
- header.to_json.should eql '{"sub":{"var1":[ "Hello" ]}}'
23
- end
24
-
25
- it "contains uniq args" do
26
- header.uniq_args :arg1 => 'val1'
27
- header.to_json.should eql '{"unique_args":{"arg1":"val1"}}'
28
- end
29
-
30
- it "contains category" do
31
- header.category 'category_name'
32
- header.to_json.should eql '{"category":"category_name"}'
33
- end
34
-
35
- it "contains filter settings" do
36
- header.add_filter_setting :filter1, :setting1, 'val1'
37
- header.to_json.should eql '{"filters":{"filter1":{"settings":{"setting1":"val1"}}}}'
38
- end
39
- end
40
- end
41
-
1
+ require 'spec_helper'
2
+
3
+ describe SendGrid::ApiHeader do
4
+ let(:header) { SendGrid::ApiHeader.new }
5
+ describe "#to_json" do
6
+ it "returns valid json if no data was set" do
7
+ header.to_json.should eql "{}"
8
+ end
9
+
10
+ it "contains 1 recipient (as array)" do
11
+ header.add_recipients 'email@email.com'
12
+ header.to_json.should eql '{"to":[ "email@email.com" ]}'
13
+ end
14
+
15
+ it "contaions an array of recipients" do
16
+ header.add_recipients %w(email1@email.com email2@email.com)
17
+ header.to_json.should eql '{"to":[ "email1@email.com", "email2@email.com" ]}'
18
+ end
19
+
20
+ it "contains substitution" do
21
+ header.substitute :var1, 'Hello'
22
+ header.to_json.should eql '{"sub":{"var1":[ "Hello" ]}}'
23
+ end
24
+
25
+ it "contains uniq args" do
26
+ header.uniq_args :arg1 => 'val1'
27
+ header.to_json.should eql '{"unique_args":{"arg1":"val1"}}'
28
+ end
29
+
30
+ it "contains category" do
31
+ header.category 'category_name'
32
+ header.to_json.should eql '{"category":"category_name"}'
33
+ end
34
+
35
+ it "contains filter settings" do
36
+ header.add_filter_setting :filter1, :setting1, 'val1'
37
+ header.to_json.should eql '{"filters":{"filter1":{"settings":{"setting1":"val1"}}}}'
38
+ end
39
+ end
40
+ end
41
+
@@ -6,6 +6,10 @@ class Mailer < ActionMailer::Base
6
6
  mail :to => recipients, :body => "Hello!"
7
7
  end
8
8
 
9
+ def email_with_cc_recipients(recipients, cc, bcc)
10
+ mail :to => recipients, :body => "Hello!", :cc => cc, :bcc => bcc
11
+ end
12
+
9
13
  def email_open_tracking(opentrack_enabled = true)
10
14
  open_tracking opentrack_enabled
11
15
  mail :to => 'email@email.com', :body => 'Hello!'
@@ -5,6 +5,9 @@ describe Mailer do
5
5
  it 'set correct recipients in X-SMTAPI header' do
6
6
  Mailer.email_with_multiple_recipients(%w(em1@email.com em2@email.com)).deliver.header.to_s.
7
7
  should include('X-SMTPAPI: {"to":[ "em1@email.com", "em2@email.com" ]}')
8
+
9
+ Mailer.email_with_cc_recipients(%w(em1@email.com), %w(cc@email.com), %w(bcc@email.com)).deliver.header.to_s.
10
+ should include('X-SMTPAPI: {"to":[ "em1@email.com", "cc@email.com", "bcc@email.com" ]}')
8
11
  end
9
12
 
10
13
  it 'removes original TO header part' do
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sendgrid-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3
5
- prerelease:
4
+ version: 2.0.4
6
5
  platform: ruby
7
6
  authors:
8
7
  - PavelTyk
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-03-13 00:00:00.000000000 Z
11
+ date: 2014-10-21 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rspec
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: actionmailer
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ! '>='
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ! '>='
44
39
  - !ruby/object:Gem::Version
@@ -46,7 +41,6 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: activesupport
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ! '>='
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ! '>='
60
53
  - !ruby/object:Gem::Version
@@ -85,28 +78,28 @@ files:
85
78
  - spec/spec_helper.rb
86
79
  - spec/version_spec.rb
87
80
  homepage: https://github.com/PavelTyk/sendgrid-rails
88
- licenses: []
81
+ licenses:
82
+ - MIT
83
+ metadata: {}
89
84
  post_install_message:
90
85
  rdoc_options: []
91
86
  require_paths:
92
87
  - lib
93
88
  required_ruby_version: !ruby/object:Gem::Requirement
94
- none: false
95
89
  requirements:
96
90
  - - ! '>='
97
91
  - !ruby/object:Gem::Version
98
92
  version: '0'
99
93
  required_rubygems_version: !ruby/object:Gem::Requirement
100
- none: false
101
94
  requirements:
102
95
  - - ! '>='
103
96
  - !ruby/object:Gem::Version
104
97
  version: '0'
105
98
  requirements: []
106
99
  rubyforge_project: sendgrid-rails
107
- rubygems_version: 1.8.25
100
+ rubygems_version: 2.1.10
108
101
  signing_key:
109
- specification_version: 3
102
+ specification_version: 4
110
103
  summary: SendGrid gem fo Rails 3
111
104
  test_files:
112
105
  - spec/api_header_spec.rb