Module: SilverPop::Client::Contact
- Included in:
- SilverPop::Client
- Defined in:
- lib/client/contact.rb
Instance Method Summary collapse
-
#add_recipient(fields, list_id, contact_list_id, created_from = 1, options = {}) ⇒ Mash
Adds one new contact to an existing database.
Instance Method Details
#add_recipient(fields, list_id, contact_list_id, created_from = 1, options = {}) ⇒ Mash
Adds one new contact to an existing database.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/client/contact.rb', line 14 def add_recipient(fields, list_id, contact_list_id, created_from=1, ={}) builder = Builder::XmlMarkup.new xml = builder.Envelope { builder.Body { builder.AddRecipient { builder.LIST_ID list_id builder.CREATED_FROM created_from builder.CONTACT_LISTS { contact_list_id.each do |id| builder.CONTACT_LIST_ID id end } unless .empty? .each do |opt| builder.tag! opt[0], opt[1] end end fields.each do |field| builder.COLUMN { builder.NAME field[0].to_s builder.VALUE field[1] } end } } } response = post(xml) end |