Sha256: 27d86797c584f567466eae4c28a668f0a872a88f2db2b7dc7ffb52c376c296cf
Contents?: true
Size: 932 Bytes
Versions: 5
Compression:
Stored size: 932 Bytes
Contents
# encoding: UTF-8 require 'contactology/stash' module Contactology class TransactionalMessage < Contactology::Stash extend API property :campaign, :required => true property :contact, :required => true property :source, :required => true property :replacements, :required => true def replacements self['replacements'] || Hash.new end def send_message(options = {}) self.class.query('Campaign_Send_Transactional', options.merge({ 'campaignId' => campaign.id, 'contact' => normalize_contact(contact), 'source' => source, 'replacements' => {:_contactology => 'Contactology'}.merge(replacements), :on_error => false, :on_timeout => false, :on_success => true })) end private def normalize_contact(contact) return contact if contact.kind_of?(Hash) { 'email' => contact.email } end end end
Version data entries
5 entries across 5 versions & 1 rubygems