Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to send email via prospect email #48

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
35 changes: 21 additions & 14 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,35 @@ PATH
specs:
ruby-pardot (1.3.2)
crack (= 0.4.3)
httparty (= 0.13.1)
httparty (= 0.18.0)

GEM
remote: http://rubygems.org/
specs:
crack (0.4.3)
safe_yaml (~> 1.0.0)
diff-lcs (1.1.2)
diff-lcs (1.3)
fakeweb (1.3.0)
httparty (0.13.1)
json (~> 1.8)
httparty (0.18.0)
mime-types (~> 3.0)
multi_xml (>= 0.5.2)
json (1.8.6)
mime-types (3.3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2019.1009)
multi_xml (0.6.0)
rspec (2.5.0)
rspec-core (~> 2.5.0)
rspec-expectations (~> 2.5.0)
rspec-mocks (~> 2.5.0)
rspec-core (2.5.1)
rspec-expectations (2.5.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.5.0)
rspec (3.9.0)
rspec-core (~> 3.9.0)
rspec-expectations (~> 3.9.0)
rspec-mocks (~> 3.9.0)
rspec-core (3.9.1)
rspec-support (~> 3.9.1)
rspec-expectations (3.9.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-mocks (3.9.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-support (3.9.2)
safe_yaml (1.0.5)

PLATFORMS
Expand All @@ -37,4 +44,4 @@ DEPENDENCIES
ruby-pardot!

BUNDLED WITH
2.0.2
2.1.4
4 changes: 4 additions & 0 deletions lib/pardot/objects/emails.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ def send_to_prospect prospect_id, params
post "/do/send/prospect_id/#{prospect_id}", params
end

def send_to_prospect_email prospect_email, params
post "/do/send/prospect_email/#{prospect_email}", params
end

def send_to_list params
post "/do/send", params
end
Expand Down
2 changes: 1 addition & 1 deletion ruby-pardot.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Gem::Specification.new do |s|
s.rubyforge_project = "ruby-pardot"

s.add_dependency "crack", "0.4.3"
s.add_dependency "httparty", "0.13.1"
s.add_dependency "httparty", "0.18.0"

s.add_development_dependency "bundler", ">= 1.10"
s.add_development_dependency "rspec"
Expand Down
6 changes: 6 additions & 0 deletions spec/pardot/objects/emails_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ def sample_response
assert_authorization_header
end

it 'should send to a prospect email' do
fake_post '/api/email/version/3/do/send/prospect_email/[email protected]?campaign_id=765&email_template_id=86&format=simple', sample_response
@client.emails.send_to_prospect_email('[email protected]', :campaign_id => 765, :email_template_id => 86).should == {"name" => "My Email"}
assert_authorization_header
end

it 'should send to a list' do
fake_post '/api/email/version/3/do/send?email_template_id=200&list_ids[]=235&campaign_id=654&format=simple', sample_response
@client.emails.send_to_list(:email_template_id => 200, 'list_ids[]' => 235, :campaign_id => 654).should == {"name" => "My Email"}
Expand Down