Permalink
Browse files

Initial commit of campaign monitor plugin. Nothing fancy.

  • Loading branch information...
1 parent f5c8c52 commit cb6a189ec0a0715c52424383b87f84701a5e765e @jnunemaker committed Jan 9, 2010
Showing with 20 additions and 0 deletions.
  1. +20 −0 campaign_monitor/campaign_monitor.rb
View
20 campaign_monitor/campaign_monitor.rb
@@ -0,0 +1,20 @@
+class CampaignMonitor < Scout::Plugin
+ needs 'httparty'
+
+ OPTIONS=<<-EOS
+ api_key:
+ name: API Key
+ default: "your-api-key"
+ list_id:
+ name: List API ID
+ default: "your-list-id"
+ EOS
+
+ def build_report
+ api_key = option(:api_key)
+ list_id = option(:list_id)
+ response = HTTParty.get("https://api.createsend.com/api/api.asmx/List.GetStats?ApiKey=#{api_key}&ListID=#{list_id}", :format => :xml)
+ report(:total_active_subscribers => response['anyType']['TotalActiveSubscribers'])
+ report(:new_subscribers_today => response['anyType']['NewActiveSubscribersToday'])
+ end
+end

0 comments on commit cb6a189

Please sign in to comment.