benchwarmer 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.rspec +1 -0
- data/Gemfile +11 -0
- data/Gemfile.lock +47 -0
- data/Guardfile +19 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +74 -0
- data/Rakefile +49 -0
- data/VERSION +1 -0
- data/benchwarmer.gemspec +71 -0
- data/lib/benchwarmer.rb +5 -0
- data/lib/benchwarmer/api.rb +94 -0
- data/spec/benchwarmer_spec.rb +35 -0
- data/spec/spec_helper.rb +18 -0
- metadata +142 -0
data/.document
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
diff-lcs (1.1.3)
|
5
|
+
fakeweb (1.3.0)
|
6
|
+
ffi (1.0.11)
|
7
|
+
git (1.2.5)
|
8
|
+
guard (1.0.0)
|
9
|
+
ffi (>= 0.5.0)
|
10
|
+
thor (~> 0.14.6)
|
11
|
+
guard-rspec (0.6.0)
|
12
|
+
guard (>= 0.10.0)
|
13
|
+
jeweler (1.8.3)
|
14
|
+
bundler (~> 1.0)
|
15
|
+
git (>= 1.2.5)
|
16
|
+
rake
|
17
|
+
rdoc
|
18
|
+
json (1.6.5)
|
19
|
+
multi_json (1.0.4)
|
20
|
+
rake (0.9.2.2)
|
21
|
+
rdoc (3.12)
|
22
|
+
json (~> 1.4)
|
23
|
+
rspec (2.8.0)
|
24
|
+
rspec-core (~> 2.8.0)
|
25
|
+
rspec-expectations (~> 2.8.0)
|
26
|
+
rspec-mocks (~> 2.8.0)
|
27
|
+
rspec-core (2.8.0)
|
28
|
+
rspec-expectations (2.8.0)
|
29
|
+
diff-lcs (~> 1.1.2)
|
30
|
+
rspec-mocks (2.8.0)
|
31
|
+
simplecov (0.5.4)
|
32
|
+
multi_json (~> 1.0.3)
|
33
|
+
simplecov-html (~> 0.5.3)
|
34
|
+
simplecov-html (0.5.3)
|
35
|
+
thor (0.14.6)
|
36
|
+
|
37
|
+
PLATFORMS
|
38
|
+
ruby
|
39
|
+
|
40
|
+
DEPENDENCIES
|
41
|
+
bundler (~> 1.0.0)
|
42
|
+
fakeweb
|
43
|
+
guard-rspec
|
44
|
+
jeweler (~> 1.8.3)
|
45
|
+
rdoc (~> 3.12)
|
46
|
+
rspec (~> 2.8.0)
|
47
|
+
simplecov
|
data/Guardfile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
guard 'rspec', :version => 2 do
|
5
|
+
watch(%r{^spec/.+_spec\.rb$})
|
6
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
7
|
+
watch('spec/spec_helper.rb') { "spec" }
|
8
|
+
|
9
|
+
# Rails example
|
10
|
+
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
11
|
+
watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
|
12
|
+
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
|
13
|
+
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
|
14
|
+
watch('config/routes.rb') { "spec/routing" }
|
15
|
+
watch('app/controllers/application_controller.rb') { "spec/controllers" }
|
16
|
+
# Capybara request specs
|
17
|
+
watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" }
|
18
|
+
end
|
19
|
+
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2012 Brian Getting
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
= Benchwarmer
|
2
|
+
|
3
|
+
Benchwarmer is a Ruby gem that provides a wrapper for interacting with the {Benchmark Email API}[http://www.benchmarkemail.com/API/Doc].
|
4
|
+
|
5
|
+
== Requirements
|
6
|
+
|
7
|
+
You will need a {Benchmark Email account}[http://www.benchmarkemail.com/Register]. Once you have your Benchmark account set up, you will need your username and password to access the API.
|
8
|
+
|
9
|
+
== Installation
|
10
|
+
|
11
|
+
(sudo) gem install benchwarmer
|
12
|
+
|
13
|
+
== Usage
|
14
|
+
|
15
|
+
The first step is to login to the Benchmark Email API and get your API access token, which you will want to store for later use. Keep in mind that each time you "login" to the API, a new token will be generated. Token management is discussed further down. Don't forget that your "username" can also be your email address, depending on how you have set up your Benchmark Email account.
|
16
|
+
|
17
|
+
token = Benchwarmer::API.login('username/email', 'password')
|
18
|
+
> "833a7c7ff759414699efe73ac90cff98" # => Store this value for later use.
|
19
|
+
|
20
|
+
Once you have your API access token, the next step is to create a Benchwarmer object:
|
21
|
+
|
22
|
+
b = Benchwarmer::API.new(token)
|
23
|
+
|
24
|
+
You can also override the default configuration by passing in your own when initializing:
|
25
|
+
|
26
|
+
b = Benchwarmer::API.new(token, {:secure => true, :timeout => 60, :api_version => '1.0'})
|
27
|
+
|
28
|
+
You can then run any of the methods that you find in the {Benchmark Email API Documentation}[http://www.benchmarkemail.com/API/Library] against it. Simply convert the names to the more Ruby-like underscored versions (e.g. listGetContactDetails becomes list_get_contact_details).
|
29
|
+
|
30
|
+
# Retrieve all contact lists
|
31
|
+
b.list_get('', 1, 100, '', '')
|
32
|
+
|
33
|
+
# Add contacts to a list
|
34
|
+
contacts = [
|
35
|
+
{ :email => 'sample@subscriber.com',
|
36
|
+
:firstname => 'Bob',
|
37
|
+
:lastname => 'Smith' }
|
38
|
+
]
|
39
|
+
b.list_add_contacts('list_id', contacts, 0) # => Change to '1' for double opt-in
|
40
|
+
|
41
|
+
# Create a new contact list
|
42
|
+
b.list_create('My List Name') # => Returns the ID of the newly created list
|
43
|
+
|
44
|
+
== Dealing With Tokens
|
45
|
+
|
46
|
+
Each time you "login" to the API to retrieve an access token, the Benchmark Email API will generate a new access token. The problem with this is that if you don't store your token and instead login each time, tokens will build up. Since having a lot of tokens that grant access to your account via the API is a bad idea, {Benchwarmer}[http://rubygems.org/gems/benchwarmer] provides methods to manage your tokens:
|
47
|
+
|
48
|
+
# List the valid API tokens for this account
|
49
|
+
Benchwarmer::API.token_get('username/email', 'password', {:secure => true})
|
50
|
+
|
51
|
+
# Add a new API token
|
52
|
+
Benchwarmer::API.token_add('username/email', 'password', {:secure => true})
|
53
|
+
|
54
|
+
# Delete an API token
|
55
|
+
Benchwarmer::API.token_add('username/email', 'password', 'api_token_to_delete', {:secure => true})
|
56
|
+
|
57
|
+
== Travis Build Status
|
58
|
+
|
59
|
+
{<img src="http://travis-ci.org/terra-firma/benchwarmer.png" />}[http://travis-ci.org/terra-firma/benchwarmer]
|
60
|
+
|
61
|
+
== Contributing to Benchwarmer
|
62
|
+
|
63
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
64
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
65
|
+
* Fork the project.
|
66
|
+
* Start a feature/bugfix branch.
|
67
|
+
* Commit and push until you are happy with your contribution.
|
68
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
69
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
70
|
+
|
71
|
+
== Copyright
|
72
|
+
|
73
|
+
Copyright (c) 2012 Terra Firma Design & Consulting. See LICENSE.txt for further details.
|
74
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
+
gem.name = "benchwarmer"
|
18
|
+
gem.homepage = "http://github.com/terra-firma/benchwarmer"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.summary = %Q{A Ruby wrapper for the Benchmark Email API.}
|
21
|
+
gem.description = %Q{Benchwarmer is a Ruby gem that provides a wrapper for interacting with the “Benchmark Email” API.}
|
22
|
+
gem.email = "brian@terra-firma-design.com"
|
23
|
+
gem.authors = ["Brian Getting"]
|
24
|
+
# dependencies defined in Gemfile
|
25
|
+
end
|
26
|
+
Jeweler::RubygemsDotOrgTasks.new
|
27
|
+
|
28
|
+
require 'rspec/core'
|
29
|
+
require 'rspec/core/rake_task'
|
30
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
31
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
32
|
+
end
|
33
|
+
|
34
|
+
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
35
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
36
|
+
spec.rcov = true
|
37
|
+
end
|
38
|
+
|
39
|
+
task :default => :spec
|
40
|
+
|
41
|
+
require 'rdoc/task'
|
42
|
+
Rake::RDocTask.new do |rdoc|
|
43
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
44
|
+
|
45
|
+
rdoc.rdoc_dir = 'rdoc'
|
46
|
+
rdoc.title = "benchwarmer #{version}"
|
47
|
+
rdoc.rdoc_files.include('README*')
|
48
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
49
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.3
|
data/benchwarmer.gemspec
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "benchwarmer"
|
8
|
+
s.version = "0.0.3"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Brian Getting"]
|
12
|
+
s.date = "2012-01-31"
|
13
|
+
s.description = "Benchwarmer is a Ruby gem that provides a wrapper for interacting with the \u{201c}Benchmark Email\u{201d} API."
|
14
|
+
s.email = "brian@terra-firma-design.com"
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".rspec",
|
22
|
+
"Gemfile",
|
23
|
+
"Gemfile.lock",
|
24
|
+
"Guardfile",
|
25
|
+
"LICENSE.txt",
|
26
|
+
"README.rdoc",
|
27
|
+
"Rakefile",
|
28
|
+
"VERSION",
|
29
|
+
"benchwarmer.gemspec",
|
30
|
+
"lib/benchwarmer.rb",
|
31
|
+
"lib/benchwarmer/api.rb",
|
32
|
+
"spec/benchwarmer_spec.rb",
|
33
|
+
"spec/spec_helper.rb"
|
34
|
+
]
|
35
|
+
s.homepage = "http://github.com/terra-firma/benchwarmer"
|
36
|
+
s.licenses = ["MIT"]
|
37
|
+
s.require_paths = ["lib"]
|
38
|
+
s.rubygems_version = "1.8.10"
|
39
|
+
s.summary = "A Ruby wrapper for the Benchmark Email API."
|
40
|
+
|
41
|
+
if s.respond_to? :specification_version then
|
42
|
+
s.specification_version = 3
|
43
|
+
|
44
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
45
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
46
|
+
s.add_development_dependency(%q<fakeweb>, [">= 0"])
|
47
|
+
s.add_development_dependency(%q<guard-rspec>, [">= 0"])
|
48
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
|
49
|
+
s.add_development_dependency(%q<rspec>, ["~> 2.8.0"])
|
50
|
+
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
51
|
+
s.add_development_dependency(%q<simplecov>, [">= 0"])
|
52
|
+
else
|
53
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
54
|
+
s.add_dependency(%q<fakeweb>, [">= 0"])
|
55
|
+
s.add_dependency(%q<guard-rspec>, [">= 0"])
|
56
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
|
57
|
+
s.add_dependency(%q<rspec>, ["~> 2.8.0"])
|
58
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
59
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
60
|
+
end
|
61
|
+
else
|
62
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
63
|
+
s.add_dependency(%q<fakeweb>, [">= 0"])
|
64
|
+
s.add_dependency(%q<guard-rspec>, [">= 0"])
|
65
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
|
66
|
+
s.add_dependency(%q<rspec>, ["~> 2.8.0"])
|
67
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
68
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
data/lib/benchwarmer.rb
ADDED
@@ -0,0 +1,94 @@
|
|
1
|
+
module Benchwarmer
|
2
|
+
class API
|
3
|
+
# Blank Slate
|
4
|
+
instance_methods.each do |m|
|
5
|
+
undef_method m unless m.to_s =~ /^__|object_id|method_missing|respond_to?|to_s|inspect/
|
6
|
+
end
|
7
|
+
|
8
|
+
# Benchmark Email API Documentation: http://www.benchmarkemail.com/API/Library
|
9
|
+
BENCHMARK_API_VERSION = "1.0"
|
10
|
+
DEFAULTS = {
|
11
|
+
:api_version => BENCHMARK_API_VERSION,
|
12
|
+
:secure => false,
|
13
|
+
:timeout => nil
|
14
|
+
}
|
15
|
+
|
16
|
+
# Initialize with an API token and config options
|
17
|
+
def initialize(api_token, config = {})
|
18
|
+
opts = DEFAULTS.merge(config).freeze
|
19
|
+
@api_client = XMLRPC::Client.new2("#{opts[:secure] ? 'https' : 'http'}://api.benchmarkemail.com/#{opts[:api_version]}/", nil, opts[:timeout])
|
20
|
+
@api_token = api_token
|
21
|
+
end
|
22
|
+
|
23
|
+
def method_missing(api_method, *args) # :nodoc:
|
24
|
+
@api_client.call(camelize_api_method_name(api_method.to_s), @api_token, *args)
|
25
|
+
rescue XMLRPC::FaultException => error
|
26
|
+
super if error.message.include?("unsupported method called:")
|
27
|
+
raise APIError.new(error)
|
28
|
+
end
|
29
|
+
|
30
|
+
def respond_to?(api_method) # :nodoc:
|
31
|
+
@api_client.call(api_method, @api_token)
|
32
|
+
rescue XMLRPC::FaultException => error
|
33
|
+
error.message.include?("unsupported method called:") ? false : true
|
34
|
+
end
|
35
|
+
|
36
|
+
# Token management methods
|
37
|
+
#
|
38
|
+
# Each time you "login", a new token is generated with access to the B.E. API.
|
39
|
+
# This means that you should store a single token and use it over and over,
|
40
|
+
# preventing a build-up of tokens.
|
41
|
+
#
|
42
|
+
# Our hope is that in the future B.E. will make the following changes
|
43
|
+
# with regard to API access tokens:
|
44
|
+
#
|
45
|
+
# - Provide an interface for account holders to manage their API tokens.
|
46
|
+
# - Remove the ability to login with username, password.
|
47
|
+
# - Add OAuth2 so that the "access_token" can be used in the same way that
|
48
|
+
# "API tokens" are currently used.
|
49
|
+
#
|
50
|
+
# In other words, make it more like Mailchimp.
|
51
|
+
|
52
|
+
def self.login(username, password, config = {})
|
53
|
+
api_client(config)
|
54
|
+
@api_client.call('login', username, password)
|
55
|
+
end
|
56
|
+
|
57
|
+
# Get a list of the tokens
|
58
|
+
def self.token_get(username, password, config = {})
|
59
|
+
api_client(config)
|
60
|
+
@api_client.call("tokenGet", username, password)
|
61
|
+
end
|
62
|
+
|
63
|
+
# Add a new token (generated randomly)
|
64
|
+
def self.token_add(username, password, config = {})
|
65
|
+
api_client(config)
|
66
|
+
@api_client.call("tokenAdd", username, password, SecureRandom.urlsafe_base64(20))
|
67
|
+
end
|
68
|
+
|
69
|
+
# Delete an existing token
|
70
|
+
def self.token_delete(username, password, token, config = {})
|
71
|
+
api_client(config)
|
72
|
+
@api_client.call("tokenDelete", username, password, token)
|
73
|
+
end
|
74
|
+
|
75
|
+
private
|
76
|
+
|
77
|
+
def self.api_client(options)
|
78
|
+
opts = DEFAULTS.merge(options).freeze
|
79
|
+
@api_client = XMLRPC::Client.new2("#{opts[:secure] ? 'https' : 'http'}://api.benchmarkemail.com/#{opts[:api_version]}/", nil, opts[:timeout])
|
80
|
+
end
|
81
|
+
|
82
|
+
def camelize_api_method_name(str)
|
83
|
+
str.to_s[0].chr.downcase + str.gsub(/(?:^|_)(.)/) { $1.upcase }[1..str.size]
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
87
|
+
|
88
|
+
class APIError < StandardError
|
89
|
+
def initialize(error)
|
90
|
+
super("(#{error.faultCode}) #{error.message}")
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Benchwarmer
|
4
|
+
describe API do
|
5
|
+
|
6
|
+
it "requires an API token on initialization" do
|
7
|
+
expect {Benchwarmer::API.new}.should raise_error(ArgumentError)
|
8
|
+
end
|
9
|
+
|
10
|
+
it "also accepts config options on initialization" do
|
11
|
+
expect {Benchwarmer::API.new('api_token', {:secure => true})}.should_not raise_error(ArgumentError)
|
12
|
+
end
|
13
|
+
|
14
|
+
it "requires a username and password for class methods" do
|
15
|
+
expect {Benchwarmer::API.login('password')}.should raise_error(ArgumentError)
|
16
|
+
expect {Benchwarmer::API.token_get('password')}.should raise_error(ArgumentError)
|
17
|
+
expect {Benchwarmer::API.token_add('password')}.should raise_error(ArgumentError)
|
18
|
+
expect {Benchwarmer::API.token_delete('password')}.should raise_error(ArgumentError)
|
19
|
+
end
|
20
|
+
|
21
|
+
it "requires a token to delete" do
|
22
|
+
expect {Benchwarmer::API.token_delete('username', 'password')}.should raise_error(ArgumentError)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "also accepts config options on class methods" do
|
26
|
+
expect {Benchwarmer::API.login('username', 'password', {:secure => true})}.should_not raise_error(ArgumentError)
|
27
|
+
expect {Benchwarmer::API.token_get('username', 'password', {:secure => true})}.should_not raise_error(ArgumentError)
|
28
|
+
expect {Benchwarmer::API.token_add('username', 'password', {:secure => true})}.should_not raise_error(ArgumentError)
|
29
|
+
expect {Benchwarmer::API.token_delete('username', 'password', 'token', {:secure => true})}.should_not raise_error(ArgumentError)
|
30
|
+
end
|
31
|
+
|
32
|
+
# TODO: Need a way to mock XMLRPC requests.
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
+
require 'rspec'
|
4
|
+
require 'fakeweb'
|
5
|
+
require 'benchwarmer'
|
6
|
+
|
7
|
+
# Requires supporting files with custom matchers and macros, etc,
|
8
|
+
# in ./support/ and its subdirectories.
|
9
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
10
|
+
|
11
|
+
FakeWeb.allow_net_connect = false
|
12
|
+
|
13
|
+
RSpec.configure do |config|
|
14
|
+
config.before(:each) do
|
15
|
+
FakeWeb.clean_registry
|
16
|
+
# Set up any variables needed here...
|
17
|
+
end
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,142 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: benchwarmer
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Brian Getting
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-01-31 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: &70260519996900 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 1.0.0
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70260519996900
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: fakeweb
|
27
|
+
requirement: &70260519995900 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70260519995900
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: guard-rspec
|
38
|
+
requirement: &70260519995020 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70260519995020
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: jeweler
|
49
|
+
requirement: &70260519994260 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.8.3
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *70260519994260
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: rspec
|
60
|
+
requirement: &70260519993260 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ~>
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: 2.8.0
|
66
|
+
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *70260519993260
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rdoc
|
71
|
+
requirement: &70260519992600 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ~>
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '3.12'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *70260519992600
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: simplecov
|
82
|
+
requirement: &70260520020740 !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
type: :development
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: *70260520020740
|
91
|
+
description: Benchwarmer is a Ruby gem that provides a wrapper for interacting with
|
92
|
+
the “Benchmark Email” API.
|
93
|
+
email: brian@terra-firma-design.com
|
94
|
+
executables: []
|
95
|
+
extensions: []
|
96
|
+
extra_rdoc_files:
|
97
|
+
- LICENSE.txt
|
98
|
+
- README.rdoc
|
99
|
+
files:
|
100
|
+
- .document
|
101
|
+
- .rspec
|
102
|
+
- Gemfile
|
103
|
+
- Gemfile.lock
|
104
|
+
- Guardfile
|
105
|
+
- LICENSE.txt
|
106
|
+
- README.rdoc
|
107
|
+
- Rakefile
|
108
|
+
- VERSION
|
109
|
+
- benchwarmer.gemspec
|
110
|
+
- lib/benchwarmer.rb
|
111
|
+
- lib/benchwarmer/api.rb
|
112
|
+
- spec/benchwarmer_spec.rb
|
113
|
+
- spec/spec_helper.rb
|
114
|
+
homepage: http://github.com/terra-firma/benchwarmer
|
115
|
+
licenses:
|
116
|
+
- MIT
|
117
|
+
post_install_message:
|
118
|
+
rdoc_options: []
|
119
|
+
require_paths:
|
120
|
+
- lib
|
121
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
122
|
+
none: false
|
123
|
+
requirements:
|
124
|
+
- - ! '>='
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '0'
|
127
|
+
segments:
|
128
|
+
- 0
|
129
|
+
hash: 2717363225508213416
|
130
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
131
|
+
none: false
|
132
|
+
requirements:
|
133
|
+
- - ! '>='
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '0'
|
136
|
+
requirements: []
|
137
|
+
rubyforge_project:
|
138
|
+
rubygems_version: 1.8.10
|
139
|
+
signing_key:
|
140
|
+
specification_version: 3
|
141
|
+
summary: A Ruby wrapper for the Benchmark Email API.
|
142
|
+
test_files: []
|