Class: ConstantContact::Components::TestSend

Inherits:
Component
  • Object
show all
Defined in:
lib/constantcontact/components/email_marketing/test_send.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

#email_addressesObject

Returns the value of attribute email_addresses



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

def email_addresses
  @email_addresses
end

#formatObject

Returns the value of attribute format



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

def format
  @format
end

#personal_messageObject

Returns the value of attribute personal_message



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

def personal_message
  @personal_message
end

Class Method Details

.create(props) ⇒ TestSend

Factory method to create a TestSend object from an array

Parameters:

  • props (Hash)
    • properties to create object from

Returns:



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/constantcontact/components/email_marketing/test_send.rb', line 16

def self.create(props)
  obj = TestSend.new
  if props
    props.each do |key, value|
      if key == 'email_addresses'
        if value
          obj.email_addresses = []
          value.each do |email_address|
            obj.email_addresses << email_address
          end
        end
      else
        obj.send("#{key}=", value) if obj.respond_to? key
      end
    end
  end
  obj
end

Instance Method Details

#add_email(email_address) ⇒ Object

Add an email address to the set of addresses to send the test send too

Parameters:

  • email_address (String)


38
39
40
41
# File 'lib/constantcontact/components/email_marketing/test_send.rb', line 38

def add_email(email_address)
  @email_addresses = [] if @email_addresses.nil?
  @email_addresses << email_address
end