Litmus::Reseller
Reseller Apis are only for use with a reseller account. They do not work with a regular Litmus account.
Installation
To get started, add 'listmus-reseller' to your Gemfile
, run bundle install
, and run the generator:
rails generate litmus_reseller:install
The generator will create an initializer to allow configuration
Configuration
Override any of these defaults in config/initializers/litmus-reseller.rb
:
LitmusReseller.configure do |config|
config.username = nil
config.password = nil
end
Usage
Create a test
Create an EmailTest and get a result back:
# All applications
response = LitmusReseller::EmailTest.create([])
# Custom applications
response = LitmusReseller::EmailTest.create(['ol2010', 'iphone5s'])
# Custom guid
response = LitmusReseller::EmailTest.create([], 'custom-guid')
The response will look like this:
{ "TestingApplications" :
[
{
"ApplicationLongName" : "Outlook 2010",
"ApplicationName" : "ol2010",
"AverageTimeToProcess" : 0,
"BusinessOrPopular" : true,
"Completed" : null,
"DesktopClient" : true,
"FoundInSpam" : null,
"FullpageImage" : null,
"FullpageImageContentBlocking" : null,
"FullpageImageNoContentBlocking" : null,
"FullpageImageThumb" : null,
"FullpageImageThumbContentBlocking" : null,
"FullpageImageThumbNoContentBlocking" : null,
"Id" : 0,
"PlatformLongName" : "",
"PlatformName" : "",
"RenderedHtmlUrl" : null,
"ResultType" : 0,
"SpamHeaders" : null,
"SpamScore" : 0,
"State" : null,
"Status" : 0,
"SupportsContentBlocking" : false,
"SupportsSpamScoring" : null,
"WindowImage" : null,
"WindowImageContentBlocking" : null,
"WindowImageNoContentBlocking" : null,
"WindowImageThumb" : null,
"WindowImageThumbContentBlocking" : null,
"WindowImageThumbNoContentBlocking" : null
},
{...}
],
"State" : "waiting",
"InboxGuid" : "test12345",
"Id" : 19498721,
"Source" : "https://s3.amazonaws.com/sitevista/",
"Subject" : "",
"Html" : "https://html.litmus.com/email/?url=/sitevista/",
"ZipFile" : "http://zip.litmus.com/resellers/?guid=e03c3e66-ba5b-4ed5-916a-c58c2b763d40",
"TestType" : 0,
"Sandbox" : false,
"UserGuid" : nil,
"Error" : false,
"ErrorMessage" : nil
}
Send your email to a unique email address you get from the emai_test
:
to_address = "#{response["InboxGuid"]@emailtests.com}"
mail(to: to_address, subject: "Subject line")
Poll the api periodically to see if your previews are complete
results = LitmusReseller::Result.show(response["id"])
while results["status"] != "complete" do
results = LitmusReseller::Result.show(response["id"])
wait 60
end
Contributing
- Fork it ( https://github.com/[my-github-username]/litmus-reseller/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request