Sha256: b3af627eb04153f7850dc5b233065ac8a93416f27ce3bad8dbcc29695226dd2c

Contents?: true

Size: 790 Bytes

Versions: 4

Compression:

Stored size: 790 Bytes

Contents

class CampaignMonitor
  # Provides access to the lists and campaigns associated with a client
  class Client
    include CampaignMonitor::Helpers

    attr_reader :id, :name, :cm_client

    # Example
    #  @client = new Client(12345)
    def initialize(id, name=nil)
      @id = id
      @name = name
      @cm_client = CampaignMonitor.new
    end

    # Example
    #  @client = new Client(12345)
    #  @lists = @client.lists
    #
    #  for list in @lists
    #    puts list.name
    #  end
    def lists
      cm_client.lists(self.id)
    end

    # Example
    #  @client = new Client(12345)
    #  @campaigns = @client.campaigns
    #
    #  for campaign in @campaigns
    #    puts campaign.subject
    #  end
    def campaigns
      cm_client.campaigns(self.id)
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
patientslikeme-campaign_monitor-1.2.1 lib/campaign_monitor/client.rb
patientslikeme-campaign_monitor-1.2.2 lib/campaign_monitor/client.rb
patientslikeme-campaign_monitor-1.3.0 lib/campaign_monitor/client.rb
turingstudio-campaign_monitor-1.3.1 lib/campaign_monitor/client.rb