Skip to content

Instantly share code, notes, and snippets.

@daveworth
Created December 2, 2011 22:13
Show Gist options
  • Select an option

  • Save daveworth/1425066 to your computer and use it in GitHub Desktop.

Select an option

Save daveworth/1425066 to your computer and use it in GitHub Desktop.
require 'date'
require 'active_support'
require 'awesome_print'
load 'lib/gibbon.rb'
def broken_test
g = Gibbon.new("API-KEY")
ge = g.get_exporter
list_id = ""
conditions = {:match => "all", :conditions => [ {:field => "rating", :op => "gt", :value => "1"} ]}
ap g.campaign_segment_test({:list_id => list_id, :options => conditions}).to_i
ap ge.list({ :id => list_id, :segment => conditions }).inject(-1) {|s,v| s+=1}
ap g.campaign_segment_test({ :list_id => list_id, :since => (DateTime.now+1).strftime("%Y-%m-%d 23:59:59"), :options => conditions }).to_i
# The since parameter below is ignored in your tree, not in my patch. This is
# handy because the only row returned by this is the headers row.
ap ge.list({ :id => list_id, :since => (DateTime.now+1).strftime("%Y-%m-%d 23:59:59"), :segment => conditions }).inject(-1) {|s,v| s+=1}
end
if __FILE__ == $0
broken_test
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment