Sha256: 2ed628776bae3adb25a108b43ce0c9a6fb5d2b7afcfce86e21425dccc2b340fb
Contents?: true
Size: 1.37 KB
Versions: 1
Compression:
Stored size: 1.37 KB
Contents
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) require 'createsend' class ListsSample def initialize raise 'CREATESEND_ACCESS_TOKEN env var missing' if ENV['CREATESEND_ACCESS_TOKEN'].nil? raise 'CREATESEND_REFRESH_TOKEN env var missing' if ENV['CREATESEND_REFRESH_TOKEN'].nil? raise 'CREATESEND_LIST_ID env var missing' if ENV['CREATESEND_LIST_ID'].nil? auth = {:access_token => ENV['CREATESEND_ACCESS_TOKEN'], :refresh_token => ENV['CREATESEND_REFRESH_TOKEN']} @list = CreateSend::List.new auth, ENV['CREATESEND_LIST_ID'] end def get_active_subscribers @list.active end def get_bounced_subscribers @list.bounced end def get_unsubscribed_subscribers @list.unsubscribed end def get_unconfirmed_subscribers @list.unconfirmed end def get_deleted_subscribers @list.deleted end end sample = ListsSample.new puts "All active subscribers: #{sample.get_active_subscribers.to_json}\n\n" puts "All bounced subscribers: #{sample.get_bounced_subscribers.to_json}\n\n" puts "All unsubscribed subscribers: #{sample.get_unsubscribed_subscribers.to_json}\n\n" puts "All unconfirmed subscribers: #{sample.get_unconfirmed_subscribers.to_json}\n\n" puts "All deleted subscribers: #{sample.get_deleted_subscribers.to_json}\n\n"
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
createsend-6.0.0 | samples/lists_sample.rb |