Class: ConstantContact::Components::Campaign

Inherits:
Component
  • Object
show all
Defined in:
lib/constantcontact/components/email_marketing/campaign.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Component

#to_hash, to_hash_value, #to_json

Instance Attribute Details

#click_through_detailsObject

Returns the value of attribute click_through_details.



10
11
12
# File 'lib/constantcontact/components/email_marketing/campaign.rb', line 10

def click_through_details
  @click_through_details
end

#created_dateObject

Returns the value of attribute created_date.



10
11
12
# File 'lib/constantcontact/components/email_marketing/campaign.rb', line 10

def created_date
  @created_date
end

#email_contentObject

Returns the value of attribute email_content.



10
11
12
# File 'lib/constantcontact/components/email_marketing/campaign.rb', line 10

def email_content
  @email_content
end

#email_content_formatObject

Returns the value of attribute email_content_format.



10
11
12
# File 'lib/constantcontact/components/email_marketing/campaign.rb', line 10

def email_content_format
  @email_content_format
end

#from_emailObject

Returns the value of attribute from_email.



10
11
12
# File 'lib/constantcontact/components/email_marketing/campaign.rb', line 10

def from_email
  @from_email
end

#from_nameObject

Returns the value of attribute from_name.



10
11
12
# File 'lib/constantcontact/components/email_marketing/campaign.rb', line 10

def from_name
  @from_name
end

#greeting_nameObject

Returns the value of attribute greeting_name.



10
11
12
# File 'lib/constantcontact/components/email_marketing/campaign.rb', line 10

def greeting_name
  @greeting_name
end

#greeting_salutationsObject

Returns the value of attribute greeting_salutations.



10
11
12
# File 'lib/constantcontact/components/email_marketing/campaign.rb', line 10

def greeting_salutations
  @greeting_salutations
end

#greeting_stringObject

Returns the value of attribute greeting_string.



10
11
12
# File 'lib/constantcontact/components/email_marketing/campaign.rb', line 10

def greeting_string
  @greeting_string
end

#idObject

Returns the value of attribute id.



10
11
12
# File 'lib/constantcontact/components/email_marketing/campaign.rb', line 10

def id
  @id
end

#is_permission_reminder_enabledObject

Returns the value of attribute is_permission_reminder_enabled.



10
11
12
# File 'lib/constantcontact/components/email_marketing/campaign.rb', line 10

def is_permission_reminder_enabled
  @is_permission_reminder_enabled
end

#is_view_as_webpage_enabledObject

Returns the value of attribute is_view_as_webpage_enabled.



10
11
12
# File 'lib/constantcontact/components/email_marketing/campaign.rb', line 10

def is_view_as_webpage_enabled
  @is_view_as_webpage_enabled
end

#last_run_dateObject

Returns the value of attribute last_run_date.



10
11
12
# File 'lib/constantcontact/components/email_marketing/campaign.rb', line 10

def last_run_date
  @last_run_date
end

Returns the value of attribute message_footer.



10
11
12
# File 'lib/constantcontact/components/email_marketing/campaign.rb', line 10

def message_footer
  @message_footer
end

#modified_dateObject

Returns the value of attribute modified_date.



10
11
12
# File 'lib/constantcontact/components/email_marketing/campaign.rb', line 10

def modified_date
  @modified_date
end

#nameObject

Returns the value of attribute name.



10
11
12
# File 'lib/constantcontact/components/email_marketing/campaign.rb', line 10

def name
  @name
end

#next_run_dateObject

Returns the value of attribute next_run_date.



10
11
12
# File 'lib/constantcontact/components/email_marketing/campaign.rb', line 10

def next_run_date
  @next_run_date
end

Returns the value of attribute permalink_url.



10
11
12
# File 'lib/constantcontact/components/email_marketing/campaign.rb', line 10

def permalink_url
  @permalink_url
end

#permission_reminder_textObject

Returns the value of attribute permission_reminder_text.



10
11
12
# File 'lib/constantcontact/components/email_marketing/campaign.rb', line 10

def permission_reminder_text
  @permission_reminder_text
end

#reply_to_emailObject

Returns the value of attribute reply_to_email.



10
11
12
# File 'lib/constantcontact/components/email_marketing/campaign.rb', line 10

def reply_to_email
  @reply_to_email
end

#sent_to_contact_listsObject

Returns the value of attribute sent_to_contact_lists.



10
11
12
# File 'lib/constantcontact/components/email_marketing/campaign.rb', line 10

def sent_to_contact_lists
  @sent_to_contact_lists
end

#statusObject

Returns the value of attribute status.



10
11
12
# File 'lib/constantcontact/components/email_marketing/campaign.rb', line 10

def status
  @status
end

#style_sheetObject

Returns the value of attribute style_sheet.



10
11
12
# File 'lib/constantcontact/components/email_marketing/campaign.rb', line 10

def style_sheet
  @style_sheet
end

#subjectObject

Returns the value of attribute subject.



10
11
12
# File 'lib/constantcontact/components/email_marketing/campaign.rb', line 10

def subject
  @subject
end

#template_typeObject

Returns the value of attribute template_type.



10
11
12
# File 'lib/constantcontact/components/email_marketing/campaign.rb', line 10

def template_type
  @template_type
end

#text_contentObject

Returns the value of attribute text_content.



10
11
12
# File 'lib/constantcontact/components/email_marketing/campaign.rb', line 10

def text_content
  @text_content
end

#tracking_summaryObject

Returns the value of attribute tracking_summary.



10
11
12
# File 'lib/constantcontact/components/email_marketing/campaign.rb', line 10

def tracking_summary
  @tracking_summary
end

Returns the value of attribute view_as_web_page_link_text.



10
11
12
# File 'lib/constantcontact/components/email_marketing/campaign.rb', line 10

def view_as_web_page_link_text
  @view_as_web_page_link_text
end

#view_as_web_page_textObject

Returns the value of attribute view_as_web_page_text.



10
11
12
# File 'lib/constantcontact/components/email_marketing/campaign.rb', line 10

def view_as_web_page_text
  @view_as_web_page_text
end

Class Method Details

.create(props) ⇒ Campaign

Factory method to create a Campaign object from an array



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/constantcontact/components/email_marketing/campaign.rb', line 22

def self.create(props)
  campaign = Campaign.new
  if props
    props.each do |key, value|
      if key == 'message_footer'
        campaign.message_footer = Components::MessageFooter.create(value)
      elsif key == 'tracking_summary'
        campaign.tracking_summary = Components::TrackingSummary.create(value)
      elsif key == 'sent_to_contact_lists'
        if value
          campaign.sent_to_contact_lists = []
          value.each do |sent_to_contact_list|
            campaign.sent_to_contact_lists << Components::ContactList.create(sent_to_contact_list)
          end
        end
      elsif key == 'click_through_details'
        if value
          campaign.click_through_details = []
          value.each do |click_through_details|
            campaign.click_through_details << Components::ClickThroughDetails.create(click_through_details)
          end
        end
      else
        campaign.send("#{key}=", value) if campaign.respond_to? key
      end
    end
  end
  campaign
end

.create_summary(props) ⇒ Campaign

Factory method to create a Campaign object from an array



56
57
58
59
60
61
62
63
64
# File 'lib/constantcontact/components/email_marketing/campaign.rb', line 56

def self.create_summary(props)
  campaign = Campaign.new
  if props
    props.each do |key, value|
      campaign.send("#{key}=", value) if campaign.respond_to? key
    end
  end
  campaign
end

Instance Method Details

#add_list(contact_list) ⇒ Object

Add a contact list to set of lists associated with this email



69
70
71
72
73
74
75
76
77
78
79
# File 'lib/constantcontact/components/email_marketing/campaign.rb', line 69

def add_list(contact_list)
  if contact_list.instance_of?(ContactList)
    list = contact_list
  elsif contact_list.to_i.to_s == contact_list
    list = ContactList.new(contact_list)
  else
    raise Exceptions::IllegalArgumentException, sprintf(Util::Config.get('errors.id_or_object'), 'ContactList')
  end

  @sent_to_contact_lists << list
end