Sha256: cee6c2bf64b999a038004420b03feb5826622e7dfe86e13db8b249522e4856ac
Contents?: true
Size: 1.29 KB
Versions: 5
Compression:
Stored size: 1.29 KB
Contents
require 'emaildirect' require 'json' module EmailDirect # Represents an import and associated functionality class Import class << self def add(subscribers) options = { :Subscribers => subscribers.to_a } response = EmailDirect.post uri_for('Subscribers'), :body => options.to_json Hashie::Mash.new(response) end def update(subscribers) options = { :Subscribers => subscribers.to_a } response = EmailDirect.put uri_for('Subscribers'), :body => options.to_json Hashie::Mash.new(response) end def add_or_update(subscribers) options = { :Subscribers => subscribers.to_a } response = EmailDirect.post uri_for('AddOrUpdate'), :body => options.to_json Hashie::Mash.new(response) end def remove(email_addresses) options = { :EmailAddresses => email_addresses.to_a } response = EmailDirect.post uri_for('Remove'), :body => options.to_json Hashie::Mash.new(response) end def delete(email_addresses) options = { :EmailAddresses => email_addresses.to_a } response = EmailDirect.post uri_for('Delete'), :body => options.to_json Hashie::Mash.new(response) end def uri_for(action) "/Import/#{action}" end end end end
Version data entries
5 entries across 5 versions & 1 rubygems