class Kampainer::ContactManager

See ws.campaigner.com/2013/01/contactmanagement.asmx?WSDL

Attributes

session[R]

Public Class Methods

new(session) click to toggle source
# File lib/kampainer/contact_manager.rb, line 6
def initialize(session)
  @session = session
end

Public Instance Methods

create_update_attribute(params) click to toggle source

@option params [String] attribute_name @option params [String] attribute_type @option params [String|??] default_value @return [Integer] attribute id

# File lib/kampainer/contact_manager.rb, line 14
def create_update_attribute(params)
  params.transform_keys! { |key| key.to_s.camelcase(:lower) }
  call('CreateUpdateAttribute', params)[0].to_i
end
delete_attribute(id) click to toggle source
# File lib/kampainer/contact_manager.rb, line 19
def delete_attribute(id)
  call('DeleteAttribute', id: id)
end
delete_contacts(*keys) click to toggle source

@param *keys One or more keys of contacts to delete.

# File lib/kampainer/contact_manager.rb, line 24
def delete_contacts(*keys)
  contact_keys = ArrayOfContactKey[keys]
  call('DeleteContacts', contact_keys.to_xml)[0].to_a
end
get_contacts(*keys) click to toggle source

@param *keys One or more contact keys.

# File lib/kampainer/contact_manager.rb, line 30
def get_contacts(*keys)
  filter = ContactsDataFilter.new(keys: ContactKeys[keys])
  attribute_filter = ContactInformationFilter.new(include: 'static,custom,groups')
  call('GetContacts', filter.to_xml, attribute_filter.to_xml)[0].to_a
end
immediate_upload(contact) click to toggle source

@return [ContactKey]

# File lib/kampainer/contact_manager.rb, line 37
def immediate_upload(contact)
  contact.key ||= ContactKey.new(unique_identifier: contact.email_address, id: 0)
  contacts = Contacts.new(Array(contact))
  call('ImmediateUpload', contacts.to_xml)[0].key
end
list_attributes(filters) click to toggle source

@option filters [Boolean] include_all_default_attributes @option filters [Boolean] include_all_custom_attributes @option filters [Boolean] include_all_system_attributes

# File lib/kampainer/contact_manager.rb, line 46
def list_attributes(filters)
  filter_xml = Attribute::Filter.new(filters).to_xml
  call('ListAttributes', filter_xml)
end
list_test_contacts() click to toggle source
# File lib/kampainer/contact_manager.rb, line 51
def list_test_contacts
  call('ListTestContacts')
end

Protected Instance Methods

call(action_name, *params) click to toggle source
# File lib/kampainer/contact_manager.rb, line 57
def call(action_name, *params)
  session.call("#{session.base_url}2013/01/contactmanagement.asmx", action_name, *params)
end