Sha256: a0e20dfa38e58c459bfb7f84ce606bf0330b06a2b88c11d0a68714212c0ef76d

Contents?: true

Size: 813 Bytes

Versions: 4

Compression:

Stored size: 813 Bytes

Contents

$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'createsend'

class SegmentsSample
    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_SEGMENT_ID env var missing' if ENV['CREATESEND_SEGMENT_ID'].nil?

        auth = {:access_token => ENV['CREATESEND_ACCESS_TOKEN'], :refresh_token => ENV['CREATESEND_REFRESH_TOKEN']}
        @segment = CreateSend::Segment.new auth, ENV['CREATESEND_SEGMENT_ID']
    end

    def get_active_subscribers
        @segment.subscribers
    end
end

sample = SegmentsSample.new

puts "All active subscribers: #{sample.get_active_subscribers.to_json}\n\n"

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
createsend-6.1.1 samples/segments_sample.rb
createsend-sendowlfork-6.1.0.pre.hashie5 samples/segments_sample.rb
createsend-6.1.0 samples/segments_sample.rb
createsend-6.0.0 samples/segments_sample.rb