Class: CampaignMonitor::Client

Inherits:
Object
  • Object
show all
Includes:
Helpers
Defined in:
lib/campaign_monitor/client.rb

Overview

Provides access to the lists and campaigns associated with a client

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers

#formatted_timestamp, #handle_response, #timestamp_format

Constructor Details

#initialize(id, name = nil) ⇒ Client

Example @client = new Client(12345)



10
11
12
13
14
# File 'lib/campaign_monitor/client.rb', line 10

def initialize(id, name=nil)
  @id = id
  @name = name
  @cm_client = CampaignMonitor.new
end

Instance Attribute Details

#cm_clientObject (readonly)

Returns the value of attribute cm_client.



6
7
8
# File 'lib/campaign_monitor/client.rb', line 6

def cm_client
  @cm_client
end

#idObject (readonly)

Returns the value of attribute id.



6
7
8
# File 'lib/campaign_monitor/client.rb', line 6

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/campaign_monitor/client.rb', line 6

def name
  @name
end

Instance Method Details

#campaignsObject

Example @client = new Client(12345) @campaigns = @client.campaigns

for campaign in @campaigns puts campaign.subject end



34
35
36
# File 'lib/campaign_monitor/client.rb', line 34

def campaigns
  cm_client.campaigns(self.id)
end

#listsObject

Example @client = new Client(12345) @lists = @client.lists

for list in @lists puts list.name end



23
24
25
# File 'lib/campaign_monitor/client.rb', line 23

def lists
  cm_client.lists(self.id)
end