Class: Litmus::EmailTest
Class Method Summary collapse
Methods inherited from Test
destroy, find_by_name, rename, show
Methods inherited from Base
Constructor Details
This class inherits a constructor from Litmus::Base
Class Method Details
.create(email = {}, name = nil, sandbox = false, application_codes = []) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/litmus/email_test.rb', line 7 def self.create(email={}, name = nil, sandbox = false, application_codes=[]) builder = Builder::XmlMarkup.new builder.instruct! :xml, :version=>"1.0" builder.test_set do |test_set| if application_codes application_codes.each do |application_code| test_set.tag!("applications", {type: "array"}) do |applications| applications.application do |application| application.code application_code end end end end test_set.use_defaults application_codes.empty? test_set.save_defaults false test_set.name name if name test_set.sandbox true if sandbox unless email.empty? test_set.email_source do |email_source| email_source.subject email[:subject] email_source.body do |body| body.cdata! email[:body] end end end end post('/emails.xml', :body => builder.target!, :headers => {"Content-type" => "application/xml"})["test_set"] end |
.list ⇒ Object
3 4 5 |
# File 'lib/litmus/email_test.rb', line 3 def self.list super.reject{|test| test["service"] != 'email'} end |