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

Commit

Permalink
GetSummary should raise
Browse files Browse the repository at this point in the history
  • Loading branch information
joshgoebel committed Feb 26, 2009
1 parent 8938c39 commit c24826c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
14 changes: 8 additions & 6 deletions lib/campaign_monitor/campaign.rb
Expand Up @@ -193,17 +193,19 @@ def method_missing(m, *args)
end
end

# Calls Campaign.GetSummary. Often you probably should just use Campaign#summary
# It will return true if successful and false if not.
# Calls Campaign.GetSummary. OYou probably should just use Campaign#summary which caches results
# It will raise ApiError if an error occurs
# Campaign#result will have the result of the API call
#
# Example
# @camp=@client.campaigns.first
# @camp.GetSummary
# @camp.GetSummary["Clicks"]
def GetSummary
@result=Result.new(cm_client.Campaign_GetSummary('CampaignID' => self.id))
@summary=parse_summary(@result.raw) if @result.success?
@result.success?
handle_response(cm_client.Campaign_GetSummary('CampaignID' => self.id)) do |response|
@result=Result.new(response)
@summary=parse_summary(@result.raw)
end
@summary
end

# Convenience method for accessing summary details of a campaign
Expand Down
3 changes: 2 additions & 1 deletion test/campaign_test.rb
Expand Up @@ -37,9 +37,10 @@ def test_bracket_lookup_for_nonexistant
assert_not_nil @campaign
assert_equal 12345, @campaign.id
assert_raises( CampaignMonitor::ApiError ) { @campaign.lists }
assert_raises( CampaignMonitor::ApiError ) { @campaign.GetSummary }
end

def test_braket_lookup_for_existing
def test_bracket_lookup_for_existing
camp=CampaignMonitor::Campaign[@campaign.id]
assert_not_nil camp
camp.lists
Expand Down

0 comments on commit c24826c

Please sign in to comment.