Sha256: 35319020bb5e224ea60a655d4582e81d642299ded9dbd9678947a8b2103e523a

Contents?: true

Size: 1.68 KB

Versions: 4

Compression:

Stored size: 1.68 KB

Contents

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

describe Pardot::Objects::Users do
  
  before do
    @client = create_client
  end
  
  describe "query" do
    
    def sample_results
      %(<?xml version="1.0" encoding="UTF-8"?>\n<rsp stat="ok" version="1.0">
        <result>
          <total_results>2</total_results>
          <user>
            <email>user@test.com</email>
            <first_name>Jim</first_name>
          </user>
          <user>
            <email>user@example.com</email>
            <first_name>Sue</first_name>
          </user>
        </result>
      </rsp>)
    end
    
    before do
      @client = create_client
    end
    
    it "should take in some arguments" do
      fake_get "/api/user/version/3/do/query?api_key=my_api_key&user_key=bar&id_greater_than=200&format=simple", sample_results
      
      @client.users.query(:id_greater_than => 200).should == {"total_results" => 2, 
        "user"=>[
          {"email"=>"user@test.com", "first_name"=>"Jim"}, 
          {"email"=>"user@example.com", "first_name"=>"Sue"}
        ]}
    end
    
  end
  
  describe "read_by_email" do
    
    def sample_results
      %(<?xml version="1.0" encoding="UTF-8"?>
      <rsp stat="ok" version="1.0">
        <user>
          <email>user@example.com</email>
          <first_name>Sue</first_name>
        </user>
      </rsp>)
    end
    
    it "should return the prospect" do
      fake_post "/api/user/version/3/do/read/email/user@test.com?api_key=my_api_key&user_key=bar&format=simple", sample_results
      
      @client.users.read_by_email("user@test.com").should == {"email"=>"user@example.com", "first_name"=>"Sue"}
      
    end
    
  end
  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ruby-pardot-1.2.0 spec/pardot/objects/users_spec.rb
ruby-pardot-1.1.0 spec/pardot/objects/users_spec.rb
ruby-pardot-1.0.2 spec/pardot/objects/users_spec.rb
ruby-pardot-1.0 spec/pardot/objects/users_spec.rb