Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,20 @@ Mailer class definition:
end
end

=== Setting ip pool

Mailer class definition:

class Mailer < ActionMailer::Base
default :from => '[email protected]',
:subject => 'An email sent via SendGridSmtpApi with substitutions'

def email_with_ip_pool
ip_pool 'IPPoolName'
mail :to => '[email protected]'
end
end

== Apps (formerly called Filters)

Apps can be applied to any of your email messages and can be configured through SendGridSmtpApi gem.
Expand Down
2 changes: 1 addition & 1 deletion lib/send_grid.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module SendGridSmtpApi
def self.included(base)
base.class_eval do
prepend InstanceMethods
delegate :substitute, :uniq_args, :category, :add_filter_setting, :standard_smtp, :to => :sendgrid_header
delegate :substitute, :uniq_args, :category, :add_filter_setting, :ip_pool, :standard_smtp, :to => :sendgrid_header
alias_method :sendgrid_header, :send_grid_header
end
end
Expand Down
5 changes: 4 additions & 1 deletion lib/send_grid/api_header.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,15 @@ def add_filter_setting(fltr, setting, val)
@data[:filters][fltr][:settings][setting] = val
end

def ip_pool(pool_name)
@data[:ip_pool] = pool_name
end

def to_json
JSON.generate(@data, {:indent => " ", :space => "", :space_before => "", :object_nl => "", :array_nl => ""})
end

def standard_smtp(enabled = false)
@standard_smtp = enabled
end

end
5 changes: 5 additions & 0 deletions spec/api_header_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,10 @@
header.add_filter_setting :filter1, :setting1, 'val1'
header.to_json.should eql '{ "filters":{ "filter1":{ "settings":{ "setting1":"val1" } } }}'
end

it "contains ip_pool" do
header.ip_pool 'pool_name'
header.to_json.should eql '{ "ip_pool":"pool_name"}'
end
end
end