Skip to content
This repository has been archived by the owner on Aug 9, 2022. It is now read-only.

Commit

Permalink
tests for adding and deleting clients with the ruby api
Browse files Browse the repository at this point in the history
  • Loading branch information
joshgoebel committed Feb 20, 2009
1 parent 7c95fb5 commit 0a36f70
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
11 changes: 11 additions & 0 deletions lib/campaign_monitor/client.rb
Expand Up @@ -86,6 +86,17 @@ def UpdateBasics
@result=Result.new(cm_client.Client_UpdateBasics(@attributes))
@result.success?
end

def Create
@result=Result.new(cm_client.Client_Create(@attributes))
self.id = @result.content
@result.success?
end

def Delete
@result=Result.new(cm_client.Client_Delete("ClientID" => id))
@result.success?
end

private

Expand Down
13 changes: 7 additions & 6 deletions test/client_test.rb
Expand Up @@ -34,11 +34,12 @@ def teardown

# def test_create_and_delete_client
# before=@cm.clients.size
# response = @cm.Client_Create(build_new_client)
# puts response.inspect
# client=CampaignMonitor::Client.new(build_new_client)
# client.Create
# assert_success client.result
# assert_equal before+1, @cm.clients.size
# @client_id=response["__content__"]
# reponse = @cm.Client_Delete("ClientID" => @client_id)
# client.Delete
# assert_success client.result
# assert_equal before, @cm.clients.size
# end

Expand Down Expand Up @@ -109,8 +110,8 @@ def test_update_both

protected
def build_new_client(options={})
{"CompanyName" => "Spacely Space Sprockets", "ContactName" => "George Jetson",
"EmailAddress" => "george@sss.com", "Country" => "United States of America",
{"CompanyName" => "Lick More Enterprises", "ContactName" => "George Jetson",
"EmailAddress" => "george@jetson.com", "Country" => "United States of America",
"TimeZone" => "(GMT-05:00) Indiana (East)"
}.merge(options)
end
Expand Down

0 comments on commit 0a36f70

Please sign in to comment.