litmus 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/.rspec CHANGED
@@ -1 +1 @@
1
- --tty --colour --profile --format nested
1
+ --tty --colour --profile
data/Gemfile ADDED
@@ -0,0 +1,14 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem "httparty", ">= 0.6.1"
4
+
5
+ group :development do
6
+ gem "rspec"
7
+ gem "bundler", "~> 1.0"
8
+ gem "jeweler", "~> 2.0.1"
9
+ gem "simplecov", ">= 0"
10
+ gem "fakeweb"
11
+ gem 'guard-rspec', '~> 4.3.1'
12
+ gem 'guard-bundler'
13
+ gem 'terminal-notifier-guard'
14
+ end
@@ -0,0 +1,118 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ addressable (2.3.6)
5
+ builder (3.2.2)
6
+ celluloid (0.15.2)
7
+ timers (~> 1.1.0)
8
+ coderay (1.1.0)
9
+ descendants_tracker (0.0.4)
10
+ thread_safe (~> 0.3, >= 0.3.1)
11
+ diff-lcs (1.2.5)
12
+ docile (1.1.5)
13
+ fakeweb (1.3.0)
14
+ faraday (0.9.0)
15
+ multipart-post (>= 1.2, < 3)
16
+ ffi (1.9.3)
17
+ formatador (0.2.5)
18
+ git (1.2.8)
19
+ github_api (0.12.1)
20
+ addressable (~> 2.3)
21
+ descendants_tracker (~> 0.0.4)
22
+ faraday (~> 0.8, < 0.10)
23
+ hashie (>= 3.2)
24
+ multi_json (>= 1.7.5, < 2.0)
25
+ nokogiri (~> 1.6.3)
26
+ oauth2
27
+ guard (2.6.1)
28
+ formatador (>= 0.2.4)
29
+ listen (~> 2.7)
30
+ lumberjack (~> 1.0)
31
+ pry (>= 0.9.12)
32
+ thor (>= 0.18.1)
33
+ guard-bundler (2.0.0)
34
+ bundler (~> 1.0)
35
+ guard (~> 2.2)
36
+ guard-rspec (4.3.1)
37
+ guard (~> 2.1)
38
+ rspec (>= 2.14, < 4.0)
39
+ hashie (3.3.1)
40
+ highline (1.6.21)
41
+ httparty (0.13.2)
42
+ json (~> 1.8)
43
+ multi_xml (>= 0.5.2)
44
+ jeweler (2.0.1)
45
+ builder
46
+ bundler (>= 1.0)
47
+ git (>= 1.2.5)
48
+ github_api
49
+ highline (>= 1.6.15)
50
+ nokogiri (>= 1.5.10)
51
+ rake
52
+ rdoc
53
+ json (1.8.1)
54
+ jwt (1.0.0)
55
+ listen (2.7.8)
56
+ celluloid (>= 0.15.2)
57
+ rb-fsevent (>= 0.9.3)
58
+ rb-inotify (>= 0.9)
59
+ lumberjack (1.0.6)
60
+ method_source (0.8.2)
61
+ mini_portile (0.6.0)
62
+ multi_json (1.10.1)
63
+ multi_xml (0.5.5)
64
+ multipart-post (2.0.0)
65
+ nokogiri (1.6.3.1)
66
+ mini_portile (= 0.6.0)
67
+ oauth2 (1.0.0)
68
+ faraday (>= 0.8, < 0.10)
69
+ jwt (~> 1.0)
70
+ multi_json (~> 1.3)
71
+ multi_xml (~> 0.5)
72
+ rack (~> 1.2)
73
+ pry (0.10.0)
74
+ coderay (~> 1.1.0)
75
+ method_source (~> 0.8.1)
76
+ slop (~> 3.4)
77
+ rack (1.5.2)
78
+ rake (10.3.2)
79
+ rb-fsevent (0.9.4)
80
+ rb-inotify (0.9.5)
81
+ ffi (>= 0.5.0)
82
+ rdoc (4.0.0)
83
+ rspec (3.1.0)
84
+ rspec-core (~> 3.1.0)
85
+ rspec-expectations (~> 3.1.0)
86
+ rspec-mocks (~> 3.1.0)
87
+ rspec-core (3.1.7)
88
+ rspec-support (~> 3.1.0)
89
+ rspec-expectations (3.1.2)
90
+ diff-lcs (>= 1.2.0, < 2.0)
91
+ rspec-support (~> 3.1.0)
92
+ rspec-mocks (3.1.3)
93
+ rspec-support (~> 3.1.0)
94
+ rspec-support (3.1.2)
95
+ simplecov (0.9.0)
96
+ docile (~> 1.1.0)
97
+ multi_json
98
+ simplecov-html (~> 0.8.0)
99
+ simplecov-html (0.8.0)
100
+ slop (3.5.0)
101
+ terminal-notifier-guard (1.5.3)
102
+ thor (0.19.1)
103
+ thread_safe (0.3.4)
104
+ timers (1.1.0)
105
+
106
+ PLATFORMS
107
+ ruby
108
+
109
+ DEPENDENCIES
110
+ bundler (~> 1.0)
111
+ fakeweb
112
+ guard-bundler
113
+ guard-rspec (~> 4.3.1)
114
+ httparty (>= 0.6.1)
115
+ jeweler (~> 2.0.1)
116
+ rspec
117
+ simplecov
118
+ terminal-notifier-guard
data/README.md CHANGED
@@ -23,6 +23,11 @@ Currently Implmented
23
23
  * Litmus::TestVersion.create(test_id)
24
24
  * Litmus::Result.list(test_id, test_version_id)
25
25
  * Litmus::Result.show(test_id, test_version_id, result_id)
26
+ * Litmus::Result.retest(test_id, test_version_id, result_id)
27
+ * Litmus::Result.update(test_id, test_version_id, result_id, new_state)
28
+ * Litmus::Report.list
29
+ * Litmus::Report.create(new_name)
30
+ * Litmus::Report.show(id)
26
31
 
27
32
  Install
28
33
  -------
@@ -33,38 +38,46 @@ Example Usage
33
38
  -------------
34
39
 
35
40
  # Setup the authentication details
36
- Litmus::Base.new("your_company_subdomain", "username", "password")
37
-
41
+ use_ssl = true # You must turn on SSL here if you have SSL enabled in Litmus
42
+ Litmus::Base.configure("your_company_subdomain", "username", "password", use_ssl)
43
+
38
44
  # Lets create an email test
39
45
  email_test = Litmus::EmailTest.create
40
- send_test_to = email_test["test_set_versions"].first["url_or_guid"] #=> "f1b17db@emailtests.com"
46
+ send_test_to = email_test["test_set_versions"].first["url_or_guid"] #=> "f1b17db@emailtests.com"
41
47
  test_id = email_test["id"] #=> 1716534
42
48
  version = email_test["test_set_versions"].first["version"] #=> 1
43
-
49
+
44
50
  # If we query our new version we can see Litmus have not had the email yet
45
51
  Litmus::TestVersion.show(test_id, version)["received"] #=> false
46
-
52
+
47
53
  # Lets send them the email
48
54
  Pony.mail(:to => send_test_to, :from => 'mail@matthewfawcett.co.uk', :subject => 'hi', :body => 'Hello there, this is a test')
49
55
 
50
56
  # Alternatively, we could have included the email when the test was created
51
57
  alternative_test = Litmus::EmailTest.create({:subject => 'Hello', :body => '<b>Hello, <i>world</i></b>'})
52
-
58
+
53
59
  # Now they have it
54
60
  Litmus::TestVersion.show(test_id, version)["received"] #=> "true"
55
-
61
+
56
62
  # Lets poll the results and look at the first client
57
63
  Litmus::TestVersion.poll(test_id, version)["results"].first.inspect #=> {"id"=>33539350, "test_code"=>"hotmail", "state"=>"pending"}
58
-
64
+
59
65
  # The hotmail test is still pending, lets wait for a while
60
66
  sleep 10
61
-
67
+
62
68
  # Lets poll the results again and see that its complete
63
69
  Litmus::TestVersion.poll(test_id, version).first.inspect #=> {"id"=>33539350, "test_code"=>"hotmail", "state"=>"complete"}
64
-
65
- # Now lets show the result for this test version
70
+
71
+ # Now let's show the result for this test version
66
72
  image_url = Litmus::Result.show(test_id, version, 33539350)["result_images"].first["full_image"] #=> "s3.amazonaws.com/resultcaptures/2f21fc9c-08f6-4429-b53d-2e224189526b.fullpageon.png"
67
-
73
+
74
+ # And we can retest the results
75
+ Litmus::Result.retest(test_id, version, 33539350)
76
+ # poll again until you have results
77
+
78
+ # And update the the state to ticked
79
+ Litmust::Result.update(test_id, version, 33539350, :ticked)
80
+
68
81
  # Let's rename this test to something more intuitive
69
82
  Litmus::Test.rename(test_id, 'My email test')
70
83
 
@@ -75,3 +88,14 @@ Example Usage
75
88
 
76
89
  # Looks good! Let's clean up...
77
90
  Litmus::Test.destroy(test_id)
91
+
92
+ # Next, let's try a report of email views
93
+ report = Litmus::Report.create("Newsletter")
94
+ report_id = report["id"]
95
+ html_to_include_in_email = report["bug_html"] # bug as in listening device, I assume
96
+
97
+ # Get the report later after the send
98
+ report = Litmus::Report.show(report_id)
99
+
100
+ # View a list of last 1000 reports
101
+ reports = Litmus::Report.list
data/Rakefile CHANGED
@@ -19,27 +19,27 @@ rescue LoadError
19
19
  puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
20
20
  end
21
21
 
22
- require 'rspec/core'
23
- require 'rspec/core/rake_task'
24
- RSpec::Core::RakeTask.new(:spec) do |spec|
25
- spec.pattern = 'spec/**/*_spec.rb'
26
- end
27
-
28
- RSpec::Core::RakeTask.new(:rcov) do |spec|
29
- spec.pattern = 'spec/**/*_spec.rb'
30
- spec.rcov = true
31
- end
22
+ # require 'rspec/core'
23
+ # require 'rspec/core/rake_task'
24
+ # RSpec::Core::RakeTask.new(:spec) do |spec|
25
+ # spec.pattern = 'spec/**/*_spec.rb'
26
+ # end
27
+ #
28
+ # RSpec::Core::RakeTask.new(:rcov) do |spec|
29
+ # spec.pattern = 'spec/**/*_spec.rb'
30
+ # spec.rcov = true
31
+ # end
32
32
 
33
33
  task :spec => :check_dependencies
34
34
 
35
35
  task :default => :spec
36
-
37
- require 'rake/rdoctask'
38
- Rake::RDocTask.new do |rdoc|
39
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
40
-
41
- rdoc.rdoc_dir = 'rdoc'
42
- rdoc.title = "litmus #{version}"
43
- rdoc.rdoc_files.include('README*')
44
- rdoc.rdoc_files.include('lib/**/*.rb')
45
- end
36
+ #
37
+ # require 'rake/rdoctask'
38
+ # Rake::RDocTask.new do |rdoc|
39
+ # version = File.exist?('VERSION') ? File.read('VERSION') : ""
40
+ #
41
+ # rdoc.rdoc_dir = 'rdoc'
42
+ # rdoc.title = "litmus #{version}"
43
+ # rdoc.rdoc_files.include('README*')
44
+ # rdoc.rdoc_files.include('lib/**/*.rb')
45
+ # end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.4.0
@@ -6,6 +6,7 @@ require "litmus/email_test"
6
6
  require "litmus/page_test"
7
7
  require "litmus/test_version"
8
8
  require "litmus/result"
9
+ require "litmus/report"
9
10
 
10
11
  module Litmus
11
- end
12
+ end
@@ -1,13 +1,16 @@
1
1
  module Litmus
2
2
  class Base
3
3
  include HTTParty
4
-
4
+
5
5
  # debug_output $stderr
6
-
7
6
  def initialize(company, username, password, ssl = false)
7
+ self.class.configure(company, username, password, ssl)
8
+ end
9
+
10
+ def self.configure(company, username, password, ssl = false)
8
11
  protocol = ssl ? 'https' : 'http'
9
- self.class.base_uri "#{protocol}://#{company}.litmus.com"
10
- self.class.basic_auth(username, password)
12
+ self.base_uri "#{protocol}://#{company}.litmus.com"
13
+ self.basic_auth(username, password)
11
14
  end
12
15
  end
13
- end
16
+ end
@@ -16,7 +16,9 @@ module Litmus
16
16
  unless email.empty?
17
17
  test_set.email_source do |email_source|
18
18
  email_source.subject email[:subject]
19
- email_source.body email[:body]
19
+ email_source.body do |body|
20
+ body.cdata! email[:body]
21
+ end
20
22
  end
21
23
  end
22
24
  end
@@ -0,0 +1,20 @@
1
+ module Litmus
2
+ class Report < Base
3
+ def self.list
4
+ get("/reports.xml")["reports"]
5
+ end
6
+
7
+ def self.show(report_id)
8
+ get("/reports/#{report_id}.xml")["report"]
9
+ end
10
+
11
+ def self.create(name)
12
+ builder = Builder::XmlMarkup.new
13
+ builder.instruct! :xml, :version=>"1.0"
14
+ builder.report do |report|
15
+ report.name name if name
16
+ end
17
+ post('/reports.xml', :body => builder.target!, :headers => {"Content-type" => "application/xml"})["report"]
18
+ end
19
+ end
20
+ end
@@ -7,5 +7,18 @@ module Litmus
7
7
  def self.show(test_id, version_id, id)
8
8
  get("/tests/#{test_id}/versions/#{version_id}/results/#{id}.xml")["result"]
9
9
  end
10
+
11
+ def self.update(test_id, version_id, id, new_state)
12
+ builder = Builder::XmlMarkup.new
13
+ builder.instruct! :xml, :version=>"1.0"
14
+ builder.result do |result|
15
+ result.check_state new_state
16
+ end
17
+ put("/tests/#{test_id}/versions/#{version_id}/results/#{id}.xml")["result"]
18
+ end
19
+
20
+ def self.retest(test_id, version_id, id)
21
+ post("/tests/#{test_id}/versions/#{version_id}/results/#{id}/retest.xml")
22
+ end
10
23
  end
11
- end
24
+ end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "litmus"
8
- s.version = "0.3.0"
8
+ s.version = "0.4.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Matt Fawcett"]
12
- s.date = "2012-01-14"
12
+ s.date = "2014-11-04"
13
13
  s.description = "A wrapper to the Litmus customer API"
14
14
  s.email = "mail@matthewfawcett.co.uk"
15
15
  s.extra_rdoc_files = [
@@ -19,6 +19,8 @@ Gem::Specification.new do |s|
19
19
  s.files = [
20
20
  ".document",
21
21
  ".rspec",
22
+ "Gemfile",
23
+ "Gemfile.lock",
22
24
  "LICENSE",
23
25
  "README.md",
24
26
  "Rakefile",
@@ -27,6 +29,7 @@ Gem::Specification.new do |s|
27
29
  "lib/litmus/base.rb",
28
30
  "lib/litmus/email_test.rb",
29
31
  "lib/litmus/page_test.rb",
32
+ "lib/litmus/report.rb",
30
33
  "lib/litmus/result.rb",
31
34
  "lib/litmus/test.rb",
32
35
  "lib/litmus/test_version.rb",
@@ -35,16 +38,21 @@ Gem::Specification.new do |s|
35
38
  "spec/fixtures/all_tests.xml",
36
39
  "spec/fixtures/create_email_test.xml",
37
40
  "spec/fixtures/create_page_test.xml",
41
+ "spec/fixtures/create_report.xml",
38
42
  "spec/fixtures/create_test_version.xml",
43
+ "spec/fixtures/list_reports.xml",
39
44
  "spec/fixtures/list_results.xml",
40
45
  "spec/fixtures/list_test_versions.xml",
41
46
  "spec/fixtures/poll_test_version.xml",
42
47
  "spec/fixtures/rename_test.xml",
48
+ "spec/fixtures/show_report.xml",
43
49
  "spec/fixtures/show_result.xml",
44
50
  "spec/fixtures/show_test.xml",
45
51
  "spec/fixtures/show_test_version.xml",
52
+ "spec/fixtures/update_result.xml",
46
53
  "spec/litmus_spec.rb",
47
54
  "spec/page_test_spec.rb",
55
+ "spec/report_spec.rb",
48
56
  "spec/result_spec.rb",
49
57
  "spec/spec_helper.rb",
50
58
  "spec/test_spec.rb",
@@ -52,20 +60,47 @@ Gem::Specification.new do |s|
52
60
  ]
53
61
  s.homepage = "http://github.com/mattfawcett/litmus"
54
62
  s.require_paths = ["lib"]
55
- s.rubygems_version = "1.8.11"
63
+ s.rubygems_version = "1.8.23"
56
64
  s.summary = "A wrapper to the Litmus customer API"
57
65
 
58
66
  if s.respond_to? :specification_version then
59
67
  s.specification_version = 3
60
68
 
61
69
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
70
+ s.add_runtime_dependency(%q<httparty>, [">= 0.6.1"])
71
+ s.add_development_dependency(%q<rspec>, [">= 0"])
72
+ s.add_development_dependency(%q<bundler>, ["~> 1.0"])
73
+ s.add_development_dependency(%q<jeweler>, ["~> 2.0.1"])
74
+ s.add_development_dependency(%q<simplecov>, [">= 0"])
75
+ s.add_development_dependency(%q<fakeweb>, [">= 0"])
76
+ s.add_development_dependency(%q<guard-rspec>, ["~> 4.3.1"])
77
+ s.add_development_dependency(%q<guard-bundler>, [">= 0"])
78
+ s.add_development_dependency(%q<terminal-notifier-guard>, [">= 0"])
62
79
  s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
63
80
  s.add_runtime_dependency(%q<httparty>, [">= 0.6.1"])
64
81
  else
82
+ s.add_dependency(%q<httparty>, [">= 0.6.1"])
83
+ s.add_dependency(%q<rspec>, [">= 0"])
84
+ s.add_dependency(%q<bundler>, ["~> 1.0"])
85
+ s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
86
+ s.add_dependency(%q<simplecov>, [">= 0"])
87
+ s.add_dependency(%q<fakeweb>, [">= 0"])
88
+ s.add_dependency(%q<guard-rspec>, ["~> 4.3.1"])
89
+ s.add_dependency(%q<guard-bundler>, [">= 0"])
90
+ s.add_dependency(%q<terminal-notifier-guard>, [">= 0"])
65
91
  s.add_dependency(%q<rspec>, [">= 1.2.9"])
66
92
  s.add_dependency(%q<httparty>, [">= 0.6.1"])
67
93
  end
68
94
  else
95
+ s.add_dependency(%q<httparty>, [">= 0.6.1"])
96
+ s.add_dependency(%q<rspec>, [">= 0"])
97
+ s.add_dependency(%q<bundler>, ["~> 1.0"])
98
+ s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
99
+ s.add_dependency(%q<simplecov>, [">= 0"])
100
+ s.add_dependency(%q<fakeweb>, [">= 0"])
101
+ s.add_dependency(%q<guard-rspec>, ["~> 4.3.1"])
102
+ s.add_dependency(%q<guard-bundler>, [">= 0"])
103
+ s.add_dependency(%q<terminal-notifier-guard>, [">= 0"])
69
104
  s.add_dependency(%q<rspec>, [">= 1.2.9"])
70
105
  s.add_dependency(%q<httparty>, [">= 0.6.1"])
71
106
  end
@@ -0,0 +1,6 @@
1
+ <report>
2
+ <bug_html>&lt;style&gt;@media print{#_t { background-image: url('https://a6.emltrk.com/3CDC7925?p');}} div.OutlookMessageHeader, table.moz-email-headers-table, blockquote #_t {background-image:url('https://a6.emltrk.com/3CDC7925?f')}&lt;/style&gt;&lt;div id=&quot;_t&quot;&gt;&lt;/div&gt;&lt;img src=&quot;https://a6.emltrk.com/3CDC7925&quot; width=&quot;1&quot; height=&quot;1&quot; border=&quot;0&quot; /&gt;</bug_html>
3
+ <created_at type="datetime">2010-06-16T13:31:14Z</created_at>
4
+ <id type="integer">24</id>
5
+ <report_name>Newsletter</report_name>
6
+ </report>
@@ -0,0 +1,35 @@
1
+ <reports type="array">
2
+ <report>
3
+ <bug_html>&lt;style&gt;@media print{#_t { background-image: url('https://a6.emltrk.com/E95EEB71?p');}} div.OutlookMessageHeader, table.moz-email-headers-table, blockquote #_t {background-image:url('https://a6.emltrk.com/E95EEB71?f')}&lt;/style&gt;&lt;div id=&quot;_t&quot;&gt;&lt;/div&gt;&lt;img src=&quot;https://a6.emltrk.com/E95EEB71&quot; width=&quot;1&quot; height=&quot;1&quot; border=&quot;0&quot; /&gt;</bug_html>
4
+ <created_at type="datetime">2010-06-16T12:24:09Z</created_at>
5
+ <id type="integer">24</id>
6
+ <name>Test report</name>
7
+ <public_sharing type="boolean">false</public_sharing>
8
+ <sharing_url></sharing_url>
9
+ <client_usage>http://export.litmus.com/mailclientusage.aspx/ABC123</client_usage>
10
+ <client_engagement>http://export.litmus.com/mailclientengagement.aspx/ABC456</client_engagement>
11
+ <activity>http://export.litmus.com/activity.aspx/ABC789</activity>
12
+ </report>
13
+ <report>
14
+ <bug_html>&lt;style&gt;@media print{#_t { background-image: url('https://a6.emltrk.com/E95EEB71?p');}} div.OutlookMessageHeader, table.moz-email-headers-table, blockquote #_t {background-image:url('https://a6.emltrk.com/E95EEB71?f')}&lt;/style&gt;&lt;div id=&quot;_t&quot;&gt;&lt;/div&gt;&lt;img src=&quot;https://a6.emltrk.com/E95EEB71&quot; width=&quot;1&quot; height=&quot;1&quot; border=&quot;0&quot; /&gt;</bug_html>
15
+ <created_at type="datetime">2010-06-16T12:24:09Z</created_at>
16
+ <id type="integer">25</id>
17
+ <name>Test report</name>
18
+ <public_sharing type="boolean">false</public_sharing>
19
+ <sharing_url></sharing_url>
20
+ <client_usage>http://export.litmus.com/mailclientusage.aspx/ABC123</client_usage>
21
+ <client_engagement>http://export.litmus.com/mailclientengagement.aspx/ABC456</client_engagement>
22
+ <activity>http://export.litmus.com/activity.aspx/ABC789</activity>
23
+ </report>
24
+ <report>
25
+ <bug_html>&lt;style&gt;@media print{#_t { background-image: url('https://a6.emltrk.com/E95EEB71?p');}} div.OutlookMessageHeader, table.moz-email-headers-table, blockquote #_t {background-image:url('https://a6.emltrk.com/E95EEB71?f')}&lt;/style&gt;&lt;div id=&quot;_t&quot;&gt;&lt;/div&gt;&lt;img src=&quot;https://a6.emltrk.com/E95EEB71&quot; width=&quot;1&quot; height=&quot;1&quot; border=&quot;0&quot; /&gt;</bug_html>
26
+ <created_at type="datetime">2010-06-16T12:24:09Z</created_at>
27
+ <id type="integer">26</id>
28
+ <name>Test report</name>
29
+ <public_sharing type="boolean">false</public_sharing>
30
+ <sharing_url></sharing_url>
31
+ <client_usage>http://export.litmus.com/mailclientusage.aspx/ABC123</client_usage>
32
+ <client_engagement>http://export.litmus.com/mailclientengagement.aspx/ABC456</client_engagement>
33
+ <activity>http://export.litmus.com/activity.aspx/ABC789</activity>
34
+ </report>
35
+ </reports>
@@ -0,0 +1,11 @@
1
+ <report>
2
+ <bug_html>&lt;style&gt;@media print{#_t { background-image: url('https://a6.emltrk.com/E95EEB71?p');}} div.OutlookMessageHeader, table.moz-email-headers-table, blockquote #_t {background-image:url('https://a6.emltrk.com/E95EEB71?f')}&lt;/style&gt;&lt;div id=&quot;_t&quot;&gt;&lt;/div&gt;&lt;img src=&quot;https://a6.emltrk.com/E95EEB71&quot; width=&quot;1&quot; height=&quot;1&quot; border=&quot;0&quot; /&gt;</bug_html>
3
+ <created_at type="datetime">2010-06-16T12:24:09Z</created_at>
4
+ <id type="integer">24</id>
5
+ <name>Test - Yahoo test</name>
6
+ <public_sharing type="boolean">false</public_sharing>
7
+ <sharing_url></sharing_url>
8
+ <client_usage>http://export.litmus.com/mailclientusage.aspx/ABC123</client_usage>
9
+ <client_engagement>http://export.litmus.com/mailclientengagement.aspx/ABC456</client_engagement>
10
+ <activity>http://export.litmus.com/activity.aspx/ABC789</activity>
11
+ </report>
@@ -0,0 +1,45 @@
1
+ <result>
2
+ <check_state>ticked</check_state>
3
+ <error_at type="datetime" nil="true" />
4
+ <finished_at type="datetime">2010-12-18T22:44:51Z</finished_at>
5
+ <id type="integer">33524970</id>
6
+ <started_at type="datetime">2010-12-18T22:44:13Z</started_at>
7
+ <test_code>ol2003</test_code>
8
+ <state>complete</state>
9
+ <result_type>email</result_type>
10
+ <rendered_html_url />
11
+ <testing_application>
12
+ <average_time_to_process type="integer">165</average_time_to_process>
13
+ <business>true</business>
14
+ <result_type>email</result_type>
15
+ <supports_content_blocking>true</supports_content_blocking>
16
+ <desktop_client>true</desktop_client>
17
+ <status>0</status>
18
+ <platform_name>Windows</platform_name>
19
+ <platform_long_name>Microsoft Windows</platform_long_name>
20
+ <application_code>ol2003</application_code>
21
+ <application_long_name>Outlook 2003</application_long_name>
22
+ </testing_application>
23
+ <result_images type="array">
24
+ <result_image>
25
+ <image_type>full_off</image_type>
26
+ <full_image>s3.amazonaws.com/resultcaptures/path.png</full_image>
27
+ <thumbnail_image>s3.amazonaws.com/resultcaptures/path.png</thumbnail_image>
28
+ </result_image>
29
+ <result_image>
30
+ <image_type>full_on</image_type>
31
+ <full_image>s3.amazonaws.com/resultcaptures/path.png</full_image>
32
+ <thumbnail_image>s3.amazonaws.com/resultcaptures/path.png</thumbnail_image>
33
+ </result_image>
34
+ <result_image>
35
+ <image_type>window_off</image_type>
36
+ <full_image>s3.amazonaws.com/resultcaptures/path.png</full_image>
37
+ <thumbnail_image>s3.amazonaws.com/resultcaptures/path.png</thumbnail_image>
38
+ </result_image>
39
+ <result_image>
40
+ <image_type>window_on</image_type>
41
+ <full_image>s3.amazonaws.com/resultcaptures/path.png</full_image>
42
+ <thumbnail_image>s3.amazonaws.com/resultcaptures/path.png</thumbnail_image>
43
+ </result_image>
44
+ </result_images>
45
+ </result>
@@ -2,13 +2,13 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
2
 
3
3
  describe "Litmus" do
4
4
 
5
- describe ".initialize" do
5
+ describe ".configure" do
6
6
  it "should use the appropriate protocol for the given account" do
7
- test = Litmus::Base.new('host', 'user', 'password')
8
- test.class.base_uri.should == 'http://host.litmus.com'
9
- test_ssl = Litmus::Base.new('host', 'user', 'password', true)
10
- test_ssl.class.base_uri.should == 'https://host.litmus.com'
7
+ Litmus::Base.configure('host', 'user', 'password')
8
+ Litmus::Base.base_uri.should == 'http://host.litmus.com'
9
+ Litmus::Base.configure('host', 'user', 'password', true)
10
+ Litmus::Base.base_uri.should == 'https://host.litmus.com'
11
11
  end
12
12
  end
13
-
13
+
14
14
  end
@@ -0,0 +1,26 @@
1
+ require 'spec_helper'
2
+
3
+ describe Litmus::Result do
4
+ describe ".list" do
5
+ it "should give me an array of results" do
6
+ results = Litmus::Report.list
7
+ results.count.should == 3
8
+ results.first["id"].should == 24
9
+ end
10
+ end
11
+
12
+ describe ".show" do
13
+ it "should return a result object" do
14
+ result = Litmus::Report.show(24)
15
+ result["id"].should == 24
16
+ end
17
+ end
18
+
19
+ describe ".create" do
20
+ it "should return success" do
21
+ result = Litmus::Report.create("Newsletter")
22
+ result["id"].should == 24
23
+ result["report_name"].should == 'Newsletter'
24
+ end
25
+ end
26
+ end
@@ -16,4 +16,19 @@ describe Litmus::Result do
16
16
  result["result_images"].first["full_image"].should =~ /s3.amazonaws.com/
17
17
  end
18
18
  end
19
- end
19
+
20
+ describe ".retest" do
21
+ it "should return success" do
22
+ result = Litmus::Result.retest(1715760, 1, 33524970)
23
+ result.code.should == 201
24
+ end
25
+ end
26
+
27
+ describe ".update" do
28
+ it "should return a result object" do
29
+ result = Litmus::Result.update(1715760, 1, 33524970, :ticked)
30
+ result["id"].should == 33524970
31
+ result["result_images"].first["full_image"].should =~ /s3.amazonaws.com/
32
+ end
33
+ end
34
+ end
@@ -2,19 +2,18 @@ $LOAD_PATH.unshift(File.dirname(__FILE__))
2
2
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
3
  require 'litmus'
4
4
  require 'rspec'
5
- require 'rspec/autorun'
6
5
 
7
6
  require 'fakeweb'
8
7
  FakeWeb.allow_net_connect = false
9
8
 
10
9
  RSpec.configure do |config|
11
- FakeWeb.register_uri(:get, 'http://matt:yourpassword@matthewfawcett.litmus.com/tests.xml',
10
+ FakeWeb.register_uri(:get, 'http://matt:yourpassword@matthewfawcett.litmus.com/tests.xml',
12
11
  :body => File.join(File.dirname(__FILE__), 'fixtures', 'all_tests.xml'),
13
12
  :content_type => "text/xml")
14
- FakeWeb.register_uri(:post, 'http://matt:yourpassword@matthewfawcett.litmus.com/emails.xml',
13
+ FakeWeb.register_uri(:post, 'http://matt:yourpassword@matthewfawcett.litmus.com/emails.xml',
15
14
  :body => File.join(File.dirname(__FILE__), 'fixtures', 'create_email_test.xml'),
16
15
  :content_type => "text/xml")
17
- FakeWeb.register_uri(:post, 'http://matt:yourpassword@matthewfawcett.litmus.com/pages.xml',
16
+ FakeWeb.register_uri(:post, 'http://matt:yourpassword@matthewfawcett.litmus.com/pages.xml',
18
17
  :body => File.join(File.dirname(__FILE__), 'fixtures', 'create_page_test.xml'),
19
18
  :content_type => "text/xml")
20
19
  FakeWeb.register_uri(:get, 'http://matt:yourpassword@matthewfawcett.litmus.com/tests/1716450.xml',
@@ -43,6 +42,21 @@ RSpec.configure do |config|
43
42
  FakeWeb.register_uri(:get, 'http://matt:yourpassword@matthewfawcett.litmus.com/tests/1715760/versions/1/results/33524970.xml',
44
43
  :body => File.join(File.dirname(__FILE__), 'fixtures', 'show_result.xml'),
45
44
  :content_type => "text/xml")
45
+ FakeWeb.register_uri(:post, 'http://matt:yourpassword@matthewfawcett.litmus.com/tests/1715760/versions/1/results/33524970/retest.xml',
46
+ :status => [201, 'Created'],:content_type => "text/xml")
47
+ FakeWeb.register_uri(:put, 'http://matt:yourpassword@matthewfawcett.litmus.com/tests/1715760/versions/1/results/33524970.xml',
48
+ :body => File.join(File.dirname(__FILE__), 'fixtures', 'update_result.xml'),
49
+ :content_type => "text/xml")
50
+ FakeWeb.register_uri(:get, 'http://matt:yourpassword@matthewfawcett.litmus.com/reports.xml',
51
+ :body => File.join(File.dirname(__FILE__), 'fixtures', 'list_reports.xml'),
52
+ :content_type => "text/xml")
53
+ FakeWeb.register_uri(:get, 'http://matt:yourpassword@matthewfawcett.litmus.com/reports/24.xml',
54
+ :body => File.join(File.dirname(__FILE__), 'fixtures', 'show_report.xml'),
55
+ :content_type => "text/xml")
56
+ FakeWeb.register_uri(:post, 'http://matt:yourpassword@matthewfawcett.litmus.com/reports.xml',
57
+ :body => File.join(File.dirname(__FILE__), 'fixtures', 'create_report.xml'),
58
+ :content_type => "text/xml")
59
+
46
60
  config.before(:each) do
47
61
  Litmus::Base.new("matthewfawcett", "matt", "yourpassword")
48
62
  end
metadata CHANGED
@@ -1,66 +1,204 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: litmus
3
- version: !ruby/object:Gem::Version
4
- hash: 19
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.4.0
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 3
9
- - 0
10
- version: 0.3.0
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Matt Fawcett
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-01-14 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2014-11-04 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: httparty
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 0.6.1
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 0.6.1
30
+ - !ruby/object:Gem::Dependency
21
31
  name: rspec
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: bundler
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: '1.0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '1.0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: jeweler
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: 2.0.1
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 2.0.1
78
+ - !ruby/object:Gem::Dependency
79
+ name: simplecov
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: fakeweb
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: guard-rspec
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ~>
116
+ - !ruby/object:Gem::Version
117
+ version: 4.3.1
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ~>
124
+ - !ruby/object:Gem::Version
125
+ version: 4.3.1
126
+ - !ruby/object:Gem::Dependency
127
+ name: guard-bundler
128
+ requirement: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ! '>='
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ type: :development
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ - !ruby/object:Gem::Dependency
143
+ name: terminal-notifier-guard
144
+ requirement: !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - ! '>='
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
150
+ type: :development
22
151
  prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 13
29
- segments:
30
- - 1
31
- - 2
32
- - 9
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ! '>='
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
158
+ - !ruby/object:Gem::Dependency
159
+ name: rspec
160
+ requirement: !ruby/object:Gem::Requirement
161
+ none: false
162
+ requirements:
163
+ - - ! '>='
164
+ - !ruby/object:Gem::Version
33
165
  version: 1.2.9
34
166
  type: :development
35
- version_requirements: *id001
36
- - !ruby/object:Gem::Dependency
37
- name: httparty
38
167
  prerelease: false
39
- requirement: &id002 !ruby/object:Gem::Requirement
40
- none: false
41
- requirements:
42
- - - ">="
43
- - !ruby/object:Gem::Version
44
- hash: 5
45
- segments:
46
- - 0
47
- - 6
48
- - 1
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
170
+ requirements:
171
+ - - ! '>='
172
+ - !ruby/object:Gem::Version
173
+ version: 1.2.9
174
+ - !ruby/object:Gem::Dependency
175
+ name: httparty
176
+ requirement: !ruby/object:Gem::Requirement
177
+ none: false
178
+ requirements:
179
+ - - ! '>='
180
+ - !ruby/object:Gem::Version
49
181
  version: 0.6.1
50
182
  type: :runtime
51
- version_requirements: *id002
183
+ prerelease: false
184
+ version_requirements: !ruby/object:Gem::Requirement
185
+ none: false
186
+ requirements:
187
+ - - ! '>='
188
+ - !ruby/object:Gem::Version
189
+ version: 0.6.1
52
190
  description: A wrapper to the Litmus customer API
53
191
  email: mail@matthewfawcett.co.uk
54
192
  executables: []
55
-
56
193
  extensions: []
57
-
58
- extra_rdoc_files:
194
+ extra_rdoc_files:
59
195
  - LICENSE
60
196
  - README.md
61
- files:
197
+ files:
62
198
  - .document
63
199
  - .rspec
200
+ - Gemfile
201
+ - Gemfile.lock
64
202
  - LICENSE
65
203
  - README.md
66
204
  - Rakefile
@@ -69,6 +207,7 @@ files:
69
207
  - lib/litmus/base.rb
70
208
  - lib/litmus/email_test.rb
71
209
  - lib/litmus/page_test.rb
210
+ - lib/litmus/report.rb
72
211
  - lib/litmus/result.rb
73
212
  - lib/litmus/test.rb
74
213
  - lib/litmus/test_version.rb
@@ -77,52 +216,47 @@ files:
77
216
  - spec/fixtures/all_tests.xml
78
217
  - spec/fixtures/create_email_test.xml
79
218
  - spec/fixtures/create_page_test.xml
219
+ - spec/fixtures/create_report.xml
80
220
  - spec/fixtures/create_test_version.xml
221
+ - spec/fixtures/list_reports.xml
81
222
  - spec/fixtures/list_results.xml
82
223
  - spec/fixtures/list_test_versions.xml
83
224
  - spec/fixtures/poll_test_version.xml
84
225
  - spec/fixtures/rename_test.xml
226
+ - spec/fixtures/show_report.xml
85
227
  - spec/fixtures/show_result.xml
86
228
  - spec/fixtures/show_test.xml
87
229
  - spec/fixtures/show_test_version.xml
230
+ - spec/fixtures/update_result.xml
88
231
  - spec/litmus_spec.rb
89
232
  - spec/page_test_spec.rb
233
+ - spec/report_spec.rb
90
234
  - spec/result_spec.rb
91
235
  - spec/spec_helper.rb
92
236
  - spec/test_spec.rb
93
237
  - spec/test_version_spec.rb
94
238
  homepage: http://github.com/mattfawcett/litmus
95
239
  licenses: []
96
-
97
240
  post_install_message:
98
241
  rdoc_options: []
99
-
100
- require_paths:
242
+ require_paths:
101
243
  - lib
102
- required_ruby_version: !ruby/object:Gem::Requirement
244
+ required_ruby_version: !ruby/object:Gem::Requirement
103
245
  none: false
104
- requirements:
105
- - - ">="
106
- - !ruby/object:Gem::Version
107
- hash: 3
108
- segments:
109
- - 0
110
- version: "0"
111
- required_rubygems_version: !ruby/object:Gem::Requirement
246
+ requirements:
247
+ - - ! '>='
248
+ - !ruby/object:Gem::Version
249
+ version: '0'
250
+ required_rubygems_version: !ruby/object:Gem::Requirement
112
251
  none: false
113
- requirements:
114
- - - ">="
115
- - !ruby/object:Gem::Version
116
- hash: 3
117
- segments:
118
- - 0
119
- version: "0"
252
+ requirements:
253
+ - - ! '>='
254
+ - !ruby/object:Gem::Version
255
+ version: '0'
120
256
  requirements: []
121
-
122
257
  rubyforge_project:
123
- rubygems_version: 1.8.11
258
+ rubygems_version: 1.8.23
124
259
  signing_key:
125
260
  specification_version: 3
126
261
  summary: A wrapper to the Litmus customer API
127
262
  test_files: []
128
-