Class: CampaignMonitor::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/campaign_monitor/base.rb

Overview

Provides access to the lists and campaigns associated with a client

Direct Known Subclasses

Campaign, Client, List, Subscriber

Constant Summary collapse

@@client =
nil

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Base

Returns a new instance of Base.



29
30
31
32
# File 'lib/campaign_monitor/base.rb', line 29

def initialize(*args)
  @attributes={}
  @cm_client=@@client
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



5
6
7
# File 'lib/campaign_monitor/base.rb', line 5

def attributes
  @attributes
end

#cm_clientObject (readonly)

Returns the value of attribute cm_client.



5
6
7
# File 'lib/campaign_monitor/base.rb', line 5

def cm_client
  @cm_client
end

#resultObject (readonly)

Returns the value of attribute result.



5
6
7
# File 'lib/campaign_monitor/base.rb', line 5

def result
  @result
end

Class Method Details

.clientObject



9
10
11
# File 'lib/campaign_monitor/base.rb', line 9

def self.client
  @@client
end

.client=(a) ⇒ Object



13
14
15
# File 'lib/campaign_monitor/base.rb', line 13

def self.client=(a)
  @@client=a
end

Instance Method Details

#[](k) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/campaign_monitor/base.rb', line 17

def [](k)
  if m=self.class.get_data_types[k]
    @attributes[k].send(m)
  else
    @attributes[k]
  end
end

#[]=(k, v) ⇒ Object



25
26
27
# File 'lib/campaign_monitor/base.rb', line 25

def []=(k,v)
  @attributes[k]=v
end

#idObject



40
41
42
# File 'lib/campaign_monitor/base.rb', line 40

def id
  @attributes[self.class.get_id_field]
end

#id=(v) ⇒ Object



44
45
46
# File 'lib/campaign_monitor/base.rb', line 44

def id=(v)
  @attributes[self.class.get_id_field]=v
end

#nameObject



48
49
50
# File 'lib/campaign_monitor/base.rb', line 48

def name
  @attributes[self.class.get_name_field]
end