litmus 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.3.0
@@ -1,9 +1,12 @@
1
1
  module Litmus
2
2
  class Base
3
3
  include HTTParty
4
-
5
- def initialize(company, username, password)
6
- self.class.base_uri "#{company}.litmus.com"
4
+
5
+ # debug_output $stderr
6
+
7
+ def initialize(company, username, password, ssl = false)
8
+ protocol = ssl ? 'https' : 'http'
9
+ self.class.base_uri "#{protocol}://#{company}.litmus.com"
7
10
  self.class.basic_auth(username, password)
8
11
  end
9
12
  end
@@ -4,14 +4,15 @@ module Litmus
4
4
  super.reject{|test| test["service"] != 'email'}
5
5
  end
6
6
 
7
- def self.create(email={}, name = nil)
7
+ def self.create(email={}, name = nil, sandbox = false)
8
8
  builder = Builder::XmlMarkup.new
9
9
  builder.instruct! :xml, :version=>"1.0"
10
10
  builder.test_set do |test_set|
11
11
  test_set.use_defaults true
12
12
  test_set.save_defaults false
13
13
  test_set.name name if name
14
-
14
+ test_set.sandbox true if sandbox
15
+
15
16
  unless email.empty?
16
17
  test_set.email_source do |email_source|
17
18
  email_source.subject email[:subject]
@@ -4,13 +4,14 @@ module Litmus
4
4
  super.reject{|test| test["service"] != 'page'}
5
5
  end
6
6
 
7
- def self.create(url, name = nil)
7
+ def self.create(url, name = nil, sandbox = false)
8
8
  builder = Builder::XmlMarkup.new
9
9
  builder.instruct! :xml, :version=>"1.0"
10
10
  builder.test_set do |test_set|
11
11
  test_set.use_defaults true
12
12
  test_set.url url
13
13
  test_set.name name if name
14
+ test_set.sandbox true if sandbox
14
15
  end
15
16
  post('/pages.xml', :body => builder.target!, :headers => {"Content-type" => "application/xml"})["test_set"]
16
17
  end
@@ -4,14 +4,14 @@
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = %q{litmus}
8
- s.version = "0.2.0"
7
+ s.name = "litmus"
8
+ s.version = "0.3.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = [%q{Matt Fawcett}]
12
- s.date = %q{2011-09-29}
13
- s.description = %q{A wrapper to the Litmus customer API}
14
- s.email = %q{mail@matthewfawcett.co.uk}
11
+ s.authors = ["Matt Fawcett"]
12
+ s.date = "2012-01-14"
13
+ s.description = "A wrapper to the Litmus customer API"
14
+ s.email = "mail@matthewfawcett.co.uk"
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE",
17
17
  "README.md"
@@ -50,10 +50,10 @@ Gem::Specification.new do |s|
50
50
  "spec/test_spec.rb",
51
51
  "spec/test_version_spec.rb"
52
52
  ]
53
- s.homepage = %q{http://github.com/mattfawcett/litmus}
54
- s.require_paths = [%q{lib}]
55
- s.rubygems_version = %q{1.8.6}
56
- s.summary = %q{A wrapper to the Litmus customer API}
53
+ s.homepage = "http://github.com/mattfawcett/litmus"
54
+ s.require_paths = ["lib"]
55
+ s.rubygems_version = "1.8.11"
56
+ s.summary = "A wrapper to the Litmus customer API"
57
57
 
58
58
  if s.respond_to? :specification_version then
59
59
  s.specification_version = 3
@@ -2,4 +2,13 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
2
 
3
3
  describe "Litmus" do
4
4
 
5
+ describe ".initialize" do
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'
11
+ end
12
+ end
13
+
5
14
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: litmus
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 2
8
+ - 3
9
9
  - 0
10
- version: 0.2.0
10
+ version: 0.3.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Matt Fawcett
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-09-29 00:00:00 Z
18
+ date: 2012-01-14 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rspec
@@ -120,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
120
  requirements: []
121
121
 
122
122
  rubyforge_project:
123
- rubygems_version: 1.8.6
123
+ rubygems_version: 1.8.11
124
124
  signing_key:
125
125
  specification_version: 3
126
126
  summary: A wrapper to the Litmus customer API