EmailVision SOAP Api Client
gem install email_vision
Usage
Member API
emv = EmailVision::Member.new(:password => 'foo', :login => 'bar', :key => 'token')
emv.find 'me@host.com'
emv.create_or_update :email => 'me@host.com', :foo => 1
emv.create :email => 'me@host.com', :foo => 1
emv.update :email => 'me@host.com', :foo => 1
emv.update :email_was => 'me@host.com', :email => 'you@host.com'
emv.columns
emv.unjoin 'me@host.com'
emv.rejoin 'me@host.com'
# create, create_or_update, update, change_email return a job-id
# it can be used to wait for the job or fetch its status
job_id = emv.update :email => 'me@host.com', :foo => 1
puts "Status is #{emv.job_status job_id}"
emv.wait_for_job_to_finish job_id # raises when job failed
# :dateunjoin cannot be set via update, use a separate rejoin / unjoin request
class User < ActiveRecord::Base
after_save :update_email_vision
def update_email_vision
case receive_newsletter_change
when [false, true]
emv.rejoin(email)
emv.update(...data for emailv vision...)
when [true, false]
emv.unjoin(email)
end
end
end
Message API
emv = EmailVision::Message.new(:password => 'foo', :login => 'bar', :key => 'token')
# create
message_id = emv.create(:name => "test message", :body => "[EMV TEXTPART] hello world", :reply_to_email => "reply@example.com")
# find single message
message = emv.find(message_id)
# updating
message[:subject] = "cool subject"
emv.update(message) # => true || false
# sending a test message
emv.test(message_id, member_id)
# cloning and deleting
cloned_id = emv.clone(message_id, "test message clone")
cloned = emv.find(cloned_id)
emv.delete(cloned_id)
# find messages by period
message_ids = emv.find_all_by_period(2.days.ago, Time.now)
# find messages by field
message_ids = emv.find_all_by_field(:encoding, "UTF-8")
message_ids = emv.find_all_by_field(:name, "test message clone")
Docs
Author
Michael Grosser
michael@grosser.it
Hereby placed under public domain, do what you want, just do not hold me accountable...