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

Commit

Permalink
need to remove d1p1:type since campaign monitor will not be processin…
Browse files Browse the repository at this point in the history
…g it and it confuses the the api method to think there are actual data to process
  • Loading branch information
Andy Shen committed Jul 30, 2008
1 parent 5ab3c0b commit c6e39b5
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/campaign_monitor.rb
Expand Up @@ -71,9 +71,10 @@ def initialize(api_key=CAMPAIGN_MONITOR_API_KEY)
# Takes a CampaignMonitor API method name and set of parameters;
# returns an XmlSimple object with the response
def request(method, *params)
response = XmlSimple.xml_in(http_get(request_url(method, params)), { 'KeepRoot' => false,
'ForceArray' => %w[List Campaign Subscriber Client SubscriberOpen SubscriberUnsubscribe SubscriberClick SubscriberBounce],
'NoAttr' => true })
response = XmlSimple.xml_in(http_get(request_url(method, params)), { 'keeproot' => false,
'forcearray' => %w[List Campaign Subscriber Client SubscriberOpen SubscriberUnsubscribe SubscriberClick SubscriberBounce],
'noattr' => true })
response.delete('d1p1:type')
response
end

Expand Down
29 changes: 29 additions & 0 deletions pivot_clents.rb
@@ -0,0 +1,29 @@
#!/usr/bin/env ruby

require 'rubygems'
require 'xmlsimple'
require "pp"
require "date"
# require 'aws/s3'

require 'lib/campaign_monitor.rb'

CAMPAIGN_MONITOR_API_KEY = '37c8763721d8e2d4805a1fd6d8260d3830eaffe5'
current_date = Time.now

cm = CampaignMonitor.new
pivot = cm.clients.find { |c| c.name == 'Pivot' }
lists = pivot.lists

# lists.each { |l| pp l.active_subscribers(Date.today) }


# pivot's [{"ClientID"=>87554}]

# pivot_cm = pivot.cm_client
# lists = pivot.lists
# pp lists
#
l = lists.first
#
pp l.active_subscribers(current_date)

0 comments on commit c6e39b5

Please sign in to comment.