Class: CampaignMonitor::Client
- Inherits:
-
Object
- Object
- CampaignMonitor::Client
- 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
-
#cm_client ⇒ Object
readonly
Returns the value of attribute cm_client.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#campaigns ⇒ Object
Example @client = new Client(12345) @campaigns = @client.campaigns.
-
#initialize(id, name = nil) ⇒ Client
constructor
Example @client = new Client(12345).
-
#lists ⇒ Object
Example @client = new Client(12345) @lists = @client.lists.
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_client ⇒ Object (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 |
#id ⇒ Object (readonly)
Returns the value of attribute id.
6 7 8 |
# File 'lib/campaign_monitor/client.rb', line 6 def id @id end |
#name ⇒ Object (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
#campaigns ⇒ Object
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 |
#lists ⇒ Object
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 |