Sha256: 9852b3e5efa98b971f3fa0a74e978bb35b7e528cd5897394f8028cd8638d3f27

Contents?: true

Size: 1.24 KB

Versions: 2

Compression:

Stored size: 1.24 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')

describe Pardot::Objects::Emails do

  before do
    @client = create_client
  end

  def sample_response
    %(<?xml version="1.0" encoding="UTF-8"?>\n<rsp stat="ok" version="1.0">
      <email>
        <name>My Email</name>
      </email>
    </rsp>)
  end

  before do
    @client = create_client
  end

  it "should take in the email ID" do
    fake_get "/api/email/version/3/do/read/id/12?format=simple", sample_response
    @client.emails.read_by_id(12).should == {"name" => "My Email"}
    assert_authorization_header
  end

  it 'should send to a prospect' do
    fake_post '/api/email/version/3/do/send/prospect_id/42?campaign_id=765&email_template_id=86&format=simple', sample_response
    @client.emails.send_to_prospect(42, :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"}
    assert_authorization_header
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ruby-pardot-1.3.1 spec/pardot/objects/emails_spec.rb
ruby-pardot-1.3.0 spec/pardot/objects/emails_spec.rb