mail-sympa 0.1.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/CHANGES +2 -0
- data/MANIFEST +7 -0
- data/README +50 -0
- data/Rakefile +27 -0
- data/lib/mail/sympa.rb +233 -0
- data/mail-sympa.gemspec +26 -0
- data/test/test_mail_sympa.rb +290 -0
- metadata +74 -0
data/CHANGES
ADDED
data/MANIFEST
ADDED
data/README
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
= Description
|
2
|
+
The mail-sympa library is Ruby interface for the Sympa mailing list management
|
3
|
+
software.
|
4
|
+
|
5
|
+
= Prerequisites
|
6
|
+
soap4r 1.5.8 or later
|
7
|
+
|
8
|
+
= Installation
|
9
|
+
gem install mail-sympa
|
10
|
+
|
11
|
+
= Synopsis (tentative)
|
12
|
+
require 'mail/sympa'
|
13
|
+
|
14
|
+
mail = Mail::Sympa.new(server, namespace)
|
15
|
+
mail.login(email, password)
|
16
|
+
|
17
|
+
# Enumerate over each list and inspect it
|
18
|
+
puts mail.lists.each do |list|
|
19
|
+
p list
|
20
|
+
end
|
21
|
+
|
22
|
+
# Add a user quietly
|
23
|
+
mail.add('foo@bar.com', 'some_list', 'Mr. Foo', true)
|
24
|
+
|
25
|
+
= Known Issues
|
26
|
+
The Sympa#add and Sympa#del methods return an empty string instead of
|
27
|
+
a boolean. I am unsure why.
|
28
|
+
|
29
|
+
= Future Plans
|
30
|
+
Add wrappers for createList and closeList.
|
31
|
+
|
32
|
+
= License
|
33
|
+
Artistic 2.0
|
34
|
+
|
35
|
+
= Copyright
|
36
|
+
(C) 2010 Daniel J. Berger, Mark Sallee, David Salisbury
|
37
|
+
All Rights Reserved
|
38
|
+
|
39
|
+
= Warranty
|
40
|
+
This library is provided "as is" and without any express or
|
41
|
+
implied warranties, including, without limitation, the implied
|
42
|
+
warranties of merchantability and fitness for a particular purpose.
|
43
|
+
|
44
|
+
= Notes
|
45
|
+
See http://www.sympa.org for details.
|
46
|
+
|
47
|
+
= Authors
|
48
|
+
Daniel Berger
|
49
|
+
David Salisbury
|
50
|
+
Mark Sallee
|
data/Rakefile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/testtask'
|
3
|
+
include Config
|
4
|
+
|
5
|
+
namespace 'gem' do
|
6
|
+
desc 'Remove any existing gem file'
|
7
|
+
task :clean do
|
8
|
+
Dir['*.gem'].each{ |f| File.delete(f) }
|
9
|
+
end
|
10
|
+
|
11
|
+
desc 'Build the mail-sympa gem'
|
12
|
+
task :build => [:clean] do
|
13
|
+
spec = eval(IO.read('mail-sympa.gemspec'))
|
14
|
+
Gem::Builder.new(spec).build
|
15
|
+
end
|
16
|
+
|
17
|
+
desc 'Install the mail-sympa gem'
|
18
|
+
task :install => [:build] do
|
19
|
+
file = Dir["*.gem"].first
|
20
|
+
sh "gem install #{file}"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
Rake::TestTask.new('test') do |t|
|
25
|
+
t.warning = true
|
26
|
+
t.verbose = true
|
27
|
+
end
|
data/lib/mail/sympa.rb
ADDED
@@ -0,0 +1,233 @@
|
|
1
|
+
require 'soap/rpc/driver'
|
2
|
+
|
3
|
+
# The Mail module serves as a namespace only.
|
4
|
+
module Mail
|
5
|
+
# The Sympa module encapsulates the various Sympa server SOAP methods
|
6
|
+
class Sympa
|
7
|
+
# Error class raised in some cases if a Mail::Sympa method fails.
|
8
|
+
class Error < StandardError; end
|
9
|
+
|
10
|
+
# The version of the mail-sympa library.
|
11
|
+
VERSION = '0.1.0'
|
12
|
+
|
13
|
+
# The session cookie returned by the login method.
|
14
|
+
attr_reader :cookie
|
15
|
+
|
16
|
+
# The endpoint URL of the SOAP service.
|
17
|
+
attr_reader :endpoint
|
18
|
+
|
19
|
+
# The URN namespace. The default is 'urn:sympasoap'.
|
20
|
+
attr_reader :namespace
|
21
|
+
|
22
|
+
# Creates and returns a new Mail::Sympa object based on the +endpoint+
|
23
|
+
# (the endpoint URL) and a +namespace+ which defaults to 'urn:sympasoap'.
|
24
|
+
#
|
25
|
+
# Example:
|
26
|
+
#
|
27
|
+
# sympa = Mail::Sympa.new('http://your.sympa.home/sympasoap')
|
28
|
+
#
|
29
|
+
def initialize(endpoint, namespace = 'urn:sympasoap')
|
30
|
+
@endpoint = endpoint.to_s # Allow for URI objects
|
31
|
+
@namespace = namespace
|
32
|
+
|
33
|
+
@soap = SOAP::RPC::Driver.new(endpoint, namespace)
|
34
|
+
|
35
|
+
@email = nil
|
36
|
+
@password = nil
|
37
|
+
@cookie = nil
|
38
|
+
|
39
|
+
@soap.add_method('login', 'email', 'password')
|
40
|
+
|
41
|
+
@soap.add_method(
|
42
|
+
'authenticateAndRun',
|
43
|
+
'email',
|
44
|
+
'cookie',
|
45
|
+
'service',
|
46
|
+
'parameters'
|
47
|
+
)
|
48
|
+
|
49
|
+
@soap.add_method(
|
50
|
+
'authenticateRemoteAppAndRun',
|
51
|
+
'appname',
|
52
|
+
'apppassword',
|
53
|
+
'vars',
|
54
|
+
'service',
|
55
|
+
'parameters'
|
56
|
+
)
|
57
|
+
end
|
58
|
+
|
59
|
+
# Authenticate with the Sympa server. This method must be called before
|
60
|
+
# any other methods can be used successfully.
|
61
|
+
#
|
62
|
+
# Example:
|
63
|
+
#
|
64
|
+
# sympa = Mail::Sympa.new(url)
|
65
|
+
# sympa.login(email, password)
|
66
|
+
#
|
67
|
+
def login(email, password)
|
68
|
+
@email = email
|
69
|
+
@password = password
|
70
|
+
@cookie = @soap.login(email, password)
|
71
|
+
end
|
72
|
+
|
73
|
+
# Returns an array of available mailing lists based on +topic+ and
|
74
|
+
# +sub_topic+. If +sub_topic+ is nil then all sub-topics are returned.
|
75
|
+
# If +topic+ is nil then all lists are returned.
|
76
|
+
#
|
77
|
+
# The returned lists contains an array of strings. If you prefer objects
|
78
|
+
# with methods corresponding to keys, see complex_lists instead.
|
79
|
+
#
|
80
|
+
# Example:
|
81
|
+
#
|
82
|
+
# sympa = Mail::Sympa.new(url)
|
83
|
+
# sympa.login(email, password)
|
84
|
+
#
|
85
|
+
# sympa.lists.each{ |list| puts list }
|
86
|
+
#
|
87
|
+
def lists(topic='', sub_topic='')
|
88
|
+
raise Error 'must login first' unless @cookie
|
89
|
+
@soap.authenticateAndRun(@email, @cookie, 'lists', [topic, sub_topic])
|
90
|
+
end
|
91
|
+
|
92
|
+
# Returns an array of available mailing lists in complex object format,
|
93
|
+
# i.e. these are SOAP::Mapping objects that you can call methods on.
|
94
|
+
#
|
95
|
+
# Example:
|
96
|
+
#
|
97
|
+
# sympa = Mail::Sympa.new(url)
|
98
|
+
# sympa.login(email, password)
|
99
|
+
#
|
100
|
+
# sympa.complex_lists.each{ |list|
|
101
|
+
# puts list.subject
|
102
|
+
# puts list.homepage
|
103
|
+
# }
|
104
|
+
#
|
105
|
+
def complex_lists(topic='', sub_topic='')
|
106
|
+
raise Error 'must login first' unless @cookie
|
107
|
+
args = [topic, sub_topic]
|
108
|
+
@soap.authenticateAndRun(@email, @cookie, 'complexLists', args)
|
109
|
+
end
|
110
|
+
|
111
|
+
alias complexLists complex_lists
|
112
|
+
|
113
|
+
# Returns a description about the given +list_name+. This is a
|
114
|
+
# SOAP::Mapping object.
|
115
|
+
#
|
116
|
+
# Example:
|
117
|
+
#
|
118
|
+
# sympa = Mail::Sympa.new(url)
|
119
|
+
# sympa.login(email, password)
|
120
|
+
#
|
121
|
+
# info = sympa.info(list)
|
122
|
+
#
|
123
|
+
# puts info.subject
|
124
|
+
# puts info.homepage
|
125
|
+
# puts info.isOwner
|
126
|
+
#
|
127
|
+
def info(list_name)
|
128
|
+
raise Error, 'must login first' unless @cookie
|
129
|
+
@soap.authenticateAndRun(@email, @cookie, 'info', [list_name])
|
130
|
+
end
|
131
|
+
|
132
|
+
# Returns an array of members that belong to the given +list_name+.
|
133
|
+
#
|
134
|
+
# Example:
|
135
|
+
#
|
136
|
+
# sympa = Mail::Sympa.new(url)
|
137
|
+
# sympa.login(email, password)
|
138
|
+
#
|
139
|
+
# sympa.review(list)
|
140
|
+
#
|
141
|
+
def review(list_name)
|
142
|
+
raise Error, 'must login first' unless @cookie
|
143
|
+
@soap.authenticateAndRun(@email, @cookie, 'review', [list_name])
|
144
|
+
end
|
145
|
+
|
146
|
+
# Returns an array of lists that the +user+ is subscribed to. The +user+
|
147
|
+
# should include the proxy variable setup in the trusted_applications.conf
|
148
|
+
# file.
|
149
|
+
#
|
150
|
+
# The +app_name+ is whatever is set in your trusted_applications.conf file.
|
151
|
+
# The +app_password+ for that app must also be provided.
|
152
|
+
#
|
153
|
+
# Example:
|
154
|
+
#
|
155
|
+
# sympa = Mail::Sympa.new(url)
|
156
|
+
# sympa.login(email, password)
|
157
|
+
#
|
158
|
+
# # If vars contains USER_EMAIL
|
159
|
+
# sympa.which('USER_EMAIL=some_user@foo.com', 'my_app', 'my_password')
|
160
|
+
#
|
161
|
+
# An alternative is to use complex_lists + review, though it's slower.
|
162
|
+
#
|
163
|
+
def which(user, app_name, app_passwd)
|
164
|
+
raise Error, 'must login first' unless @cookie
|
165
|
+
@soap.authenticateRemoteAppAndRun(app_name, app_passwd, user, 'which', [''])
|
166
|
+
end
|
167
|
+
|
168
|
+
# Same as the Sympa#which method, but returns an array of SOAP::Mapping
|
169
|
+
# objects that you can call methods on.
|
170
|
+
#
|
171
|
+
def complex_which(user, app_name, app_passwd)
|
172
|
+
raise Error, 'must login first' unless @cookie
|
173
|
+
@soap.authenticateRemoteAppAndRun(app_name, app_passwd, user, 'complexWhich', [''])
|
174
|
+
end
|
175
|
+
|
176
|
+
alias complexWhich complex_which
|
177
|
+
|
178
|
+
# Returns a boolean indicating whether or not +user+ has +function+
|
179
|
+
# on +list_name+. The two possible values for +function+ are 'editor'
|
180
|
+
# and 'owner'.
|
181
|
+
#
|
182
|
+
def am_i?(user, list_name, function = 'editor')
|
183
|
+
raise Error, 'must login first' unless @cookie
|
184
|
+
|
185
|
+
unless ['editor', 'owner'].include?(function)
|
186
|
+
raise Error, 'invalid function name "#{editor}"'
|
187
|
+
end
|
188
|
+
|
189
|
+
@soap.authenticateAndRun(@email, @cookie, 'amI', [list_name, function, user])
|
190
|
+
end
|
191
|
+
|
192
|
+
alias amI am_i?
|
193
|
+
|
194
|
+
# Adds the given +email+ to +list_name+ using +name+ (gecos). If +quiet+
|
195
|
+
# is set to true (the default) then no email notification is sent.
|
196
|
+
#--
|
197
|
+
# TODO: Determine why this method does not return a boolean.
|
198
|
+
#
|
199
|
+
def add(email, list_name, name, quiet=true)
|
200
|
+
raise Error, 'must login first' unless @cookie
|
201
|
+
@soap.authenticateAndRun(@email, @cookie, 'add', [list_name, email, name, quiet])
|
202
|
+
end
|
203
|
+
|
204
|
+
# Deletes the given +email+ from +list_name+. If +quiet+ is set to true
|
205
|
+
# (the default) then no email notification is sent.
|
206
|
+
#--
|
207
|
+
# TODO: Determine why this method does not return a boolean.
|
208
|
+
#
|
209
|
+
def del(email, list_name, quiet=true)
|
210
|
+
raise Error, 'must login first' unless @cookie
|
211
|
+
@soap.authenticateAndRun(@email, @cookie, 'del', [list_name, email, quiet])
|
212
|
+
end
|
213
|
+
|
214
|
+
# Subscribes the currently logged in user to +list_name+. By default the
|
215
|
+
# +name+ (gecos) will be the email address.
|
216
|
+
#
|
217
|
+
def subscribe(list_name, name = @email)
|
218
|
+
raise Error, 'must login first' unless @cookie
|
219
|
+
@soap.authenticateAndRun(@email, @cookie, 'subscribe', [list_name, name])
|
220
|
+
end
|
221
|
+
|
222
|
+
# Removes the currently logged in user from +list_name+.
|
223
|
+
#
|
224
|
+
def signoff(list_name)
|
225
|
+
raise Error, 'must login first' unless @cookie
|
226
|
+
@soap.authenticateAndRun(@email, @cookie, 'signoff', [list_name, @email])
|
227
|
+
end
|
228
|
+
|
229
|
+
alias delete del
|
230
|
+
alias unsubscribe signoff
|
231
|
+
alias url endpoint
|
232
|
+
end
|
233
|
+
end
|
data/mail-sympa.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
|
3
|
+
Gem::Specification.new do |gem|
|
4
|
+
gem.name = 'mail-sympa'
|
5
|
+
gem.version = '0.1.0'
|
6
|
+
gem.authors = ['Daniel J. Berger', 'David Salisbury', 'Mark Sallee']
|
7
|
+
gem.license = 'Artistic 2.0'
|
8
|
+
gem.description = 'Ruby interface for the Sympa mailing list server'
|
9
|
+
gem.email = 'djberg96@gmail.com'
|
10
|
+
gem.files = Dir['**/*'].reject{ |f| f.include?('git') }
|
11
|
+
gem.test_files = ['test/test_mail_sympa.rb']
|
12
|
+
gem.has_rdoc = true
|
13
|
+
gem.homepage = 'http://github.com/djberg96/mail-sympa'
|
14
|
+
|
15
|
+
gem.extra_rdoc_files = ['README', 'CHANGES', 'MANIFEST']
|
16
|
+
|
17
|
+
gem.add_dependency('soap4r', '>= 1.5.8')
|
18
|
+
|
19
|
+
gem.summary = <<-EOF
|
20
|
+
The mail-sympa library provides a Ruby interface to the Sympa mailing
|
21
|
+
list server software. This is a convenient and pretty wrapper for the
|
22
|
+
various SOAP functions that Sympa server publishes.
|
23
|
+
|
24
|
+
See http://www.sympa.org for more information.
|
25
|
+
EOF
|
26
|
+
end
|
@@ -0,0 +1,290 @@
|
|
1
|
+
##############################################################################
|
2
|
+
# test_mail_sympa.rb
|
3
|
+
#
|
4
|
+
# This is the test suite for the mail-sympa library. You should run these
|
5
|
+
# tests via the test rake task.
|
6
|
+
#
|
7
|
+
# In order for these tests to run successfully you must use the dbi-dbrc
|
8
|
+
# library, and create an entry for 'test_sympa'. The user name should include
|
9
|
+
# the full domain, e.g. foo@bar.org. and the driver should be set to the URL:
|
10
|
+
#
|
11
|
+
# test_sympa postmaster@foo.org xxx http://foo.bar.org/sympasoap
|
12
|
+
#
|
13
|
+
# For all tests to complete successfully, you must use admin credentials.
|
14
|
+
##############################################################################
|
15
|
+
require 'rubygems'
|
16
|
+
gem 'test-unit'
|
17
|
+
|
18
|
+
require 'test/unit'
|
19
|
+
require 'mail/sympa'
|
20
|
+
require 'dbi/dbrc'
|
21
|
+
|
22
|
+
class MailSympaTest < Test::Unit::TestCase
|
23
|
+
def self.startup
|
24
|
+
@@info = DBI::DBRC.new('test_sympa')
|
25
|
+
@@url = @@info.driver
|
26
|
+
end
|
27
|
+
|
28
|
+
def setup
|
29
|
+
@mail = Mail::Sympa.new(@@url)
|
30
|
+
@user = @@info.user
|
31
|
+
@pass = @@info.passwd
|
32
|
+
@list = 'testlist'
|
33
|
+
@nosub = 'partners'
|
34
|
+
end
|
35
|
+
|
36
|
+
# Because most methods won't work without logging in first
|
37
|
+
def login
|
38
|
+
@mail.login(@user, @pass)
|
39
|
+
end
|
40
|
+
|
41
|
+
test "version constant is expected value" do
|
42
|
+
assert_equal('0.1.0', Mail::Sympa::VERSION)
|
43
|
+
end
|
44
|
+
|
45
|
+
test "endpoint method basic functionality" do
|
46
|
+
assert_respond_to(@mail, :endpoint)
|
47
|
+
assert_nothing_raised{ @mail.endpoint }
|
48
|
+
assert_kind_of(String, @mail.endpoint)
|
49
|
+
end
|
50
|
+
|
51
|
+
test "endpoint method returns expected result" do
|
52
|
+
assert_equal(@@url, @mail.endpoint)
|
53
|
+
end
|
54
|
+
|
55
|
+
test "endpoint method is a readonly attribute" do
|
56
|
+
assert_raise(NoMethodError){ @mail.endpoint = 'foo' }
|
57
|
+
end
|
58
|
+
|
59
|
+
test "namespace method basic functionality" do
|
60
|
+
assert_respond_to(@mail, :namespace)
|
61
|
+
assert_nothing_raised{ @mail.namespace }
|
62
|
+
assert_kind_of(String, @mail.namespace)
|
63
|
+
end
|
64
|
+
|
65
|
+
test "namespace method returns expected result" do
|
66
|
+
assert_equal("urn:sympasoap", @mail.namespace)
|
67
|
+
end
|
68
|
+
|
69
|
+
test "namespace method is a readonly attrubite" do
|
70
|
+
assert_raise(NoMethodError){ @mail.namespace = 'foo' }
|
71
|
+
end
|
72
|
+
|
73
|
+
test "login method basic functionality" do
|
74
|
+
assert_respond_to(@mail, :login)
|
75
|
+
end
|
76
|
+
|
77
|
+
test "login method works as expected with proper credentials" do
|
78
|
+
assert_nothing_raised{ @mail.login(@user, @pass) }
|
79
|
+
assert_not_nil(@mail.cookie)
|
80
|
+
assert_kind_of(String, @mail.login(@user, @pass))
|
81
|
+
end
|
82
|
+
|
83
|
+
test "login method raises an error if the credentials are invalid" do
|
84
|
+
assert_raise(SOAP::FaultError){ @mail.login('bogus', 'bogus') }
|
85
|
+
end
|
86
|
+
|
87
|
+
test "login method requires two arguments" do
|
88
|
+
assert_raise(ArgumentError){ @mail.login }
|
89
|
+
assert_raise(ArgumentError){ @mail.login('bogus') }
|
90
|
+
end
|
91
|
+
|
92
|
+
test "lists method basic functionality" do
|
93
|
+
login
|
94
|
+
assert_respond_to(@mail, :lists)
|
95
|
+
assert_nothing_raised{ @mail.lists }
|
96
|
+
end
|
97
|
+
|
98
|
+
test "lists method with no arguments returns all lists" do
|
99
|
+
login
|
100
|
+
assert_kind_of(Array, @mail.lists)
|
101
|
+
assert_kind_of(String, @mail.lists.first)
|
102
|
+
end
|
103
|
+
|
104
|
+
test "lists method accepts a topic and subtopic" do
|
105
|
+
login
|
106
|
+
assert_kind_of(Array, @mail.lists(@list))
|
107
|
+
assert_kind_of(Array, @mail.lists(@list, @list))
|
108
|
+
end
|
109
|
+
|
110
|
+
test "lists method returns empty array if topic or subtopic is not found" do
|
111
|
+
login
|
112
|
+
assert_equal([], @mail.lists('bogus'))
|
113
|
+
assert_equal([], @mail.lists(@list, 'bogus'))
|
114
|
+
end
|
115
|
+
|
116
|
+
test "lists method accepts a maximum of two arguments" do
|
117
|
+
assert_raise(ArgumentError){ @mail.lists(@list, @list, @list) }
|
118
|
+
end
|
119
|
+
|
120
|
+
test "complex_lists method basic functionality" do
|
121
|
+
login
|
122
|
+
assert_respond_to(@mail, :complex_lists)
|
123
|
+
assert_nothing_raised{ @mail.complex_lists }
|
124
|
+
end
|
125
|
+
|
126
|
+
test "complex_lists method with no arguments returns all lists" do
|
127
|
+
login
|
128
|
+
assert_kind_of(Array, @mail.lists)
|
129
|
+
assert_kind_of(SOAP::Mapping::Object, @mail.complex_lists.first)
|
130
|
+
end
|
131
|
+
|
132
|
+
test "complex_lists method accepts a topic and subtopic" do
|
133
|
+
login
|
134
|
+
assert_kind_of(Array, @mail.complex_lists(@list))
|
135
|
+
assert_kind_of(Array, @mail.complex_lists(@list, @list))
|
136
|
+
end
|
137
|
+
|
138
|
+
test "lists method returns empty array if topic or subtopic is not found" do
|
139
|
+
login
|
140
|
+
assert_equal([], @mail.complex_lists('bogus'))
|
141
|
+
assert_equal([], @mail.complex_lists(@list, 'bogus'))
|
142
|
+
end
|
143
|
+
|
144
|
+
test "lists method accepts a maximum of two arguments" do
|
145
|
+
assert_raise(ArgumentError){ @mail.complex_lists(@list, @list, @list) }
|
146
|
+
end
|
147
|
+
|
148
|
+
test "info method basic functionality" do
|
149
|
+
login
|
150
|
+
assert_respond_to(@mail, :info)
|
151
|
+
assert_nothing_raised{ @mail.info(@list) }
|
152
|
+
end
|
153
|
+
|
154
|
+
test "info method expected results" do
|
155
|
+
login
|
156
|
+
assert_kind_of(SOAP::Mapping::Object, @mail.info(@list))
|
157
|
+
end
|
158
|
+
|
159
|
+
test "review method basic functionality" do
|
160
|
+
login
|
161
|
+
assert_respond_to(@mail, :review)
|
162
|
+
assert_nothing_raised{ @mail.review(@list) }
|
163
|
+
end
|
164
|
+
|
165
|
+
test "review method returns expected results" do
|
166
|
+
login
|
167
|
+
assert_kind_of(Array, @mail.review(@list))
|
168
|
+
assert_kind_of(String, @mail.review(@list).first)
|
169
|
+
end
|
170
|
+
|
171
|
+
test "review method returns 'no_subscribers' if list has no subscribers" do
|
172
|
+
login
|
173
|
+
assert_equal(['no_subscribers'], @mail.review(@nosub))
|
174
|
+
end
|
175
|
+
|
176
|
+
test "review method raises an error if list isn't found" do
|
177
|
+
login
|
178
|
+
assert_raise(SOAP::FaultError){ @mail.review('bogusxxxyyyzzz') }
|
179
|
+
end
|
180
|
+
|
181
|
+
test "which basic functionality" do
|
182
|
+
assert_respond_to(@mail, :which)
|
183
|
+
end
|
184
|
+
|
185
|
+
test "complex_which basic functionality" do
|
186
|
+
assert_respond_to(@mail, :complex_which)
|
187
|
+
end
|
188
|
+
|
189
|
+
test "complexWhich is an alias for complex_which" do
|
190
|
+
assert_alias_method(@mail, :complexWhich, :complex_which)
|
191
|
+
end
|
192
|
+
|
193
|
+
test "am_i basic functionality" do
|
194
|
+
login
|
195
|
+
assert_respond_to(@mail, :am_i?)
|
196
|
+
assert_nothing_raised{ @mail.am_i?(@user, @list) }
|
197
|
+
assert_nothing_raised{ @mail.am_i?(@user, @list, 'owner') }
|
198
|
+
end
|
199
|
+
|
200
|
+
test "am_i returns expected result" do
|
201
|
+
login
|
202
|
+
assert_boolean(@mail.am_i?(@user, @list))
|
203
|
+
end
|
204
|
+
|
205
|
+
test "am_i function name must be owner or editor" do
|
206
|
+
assert_raise(Mail::Sympa::Error){ @mail.am_i?(@user, @list, 'bogus') }
|
207
|
+
end
|
208
|
+
|
209
|
+
test "amI is an alias for am_i?" do
|
210
|
+
assert_alias_method(@mail, :amI, :am_i?)
|
211
|
+
end
|
212
|
+
|
213
|
+
test "add basic functionality" do
|
214
|
+
assert_respond_to(@mail, :add)
|
215
|
+
end
|
216
|
+
|
217
|
+
test "add returns expected result" do
|
218
|
+
login
|
219
|
+
notify("The documentation says this should return a boolean")
|
220
|
+
assert_boolean(@mail.add('test@foo.com', @list, 'test'))
|
221
|
+
end
|
222
|
+
|
223
|
+
test "add requires at least three arguments" do
|
224
|
+
assert_raise(ArgumentError){ @mail.add }
|
225
|
+
assert_raise(ArgumentError){ @mail.add('test@foo.com') }
|
226
|
+
assert_raise(ArgumentError){ @mail.add('test@foo.com', @list) }
|
227
|
+
end
|
228
|
+
|
229
|
+
test "del basic functionality" do
|
230
|
+
assert_respond_to(@mail, :del)
|
231
|
+
end
|
232
|
+
|
233
|
+
test "del returns expected result" do
|
234
|
+
login
|
235
|
+
notify("The documentation says this should return a boolean")
|
236
|
+
assert_boolean(@mail.del('test@foo.com', @list))
|
237
|
+
end
|
238
|
+
|
239
|
+
test "delete is an alias for del" do
|
240
|
+
assert_alias_method(@mail, :delete, :del)
|
241
|
+
end
|
242
|
+
|
243
|
+
test "del requires at least two arguments" do
|
244
|
+
assert_raise(ArgumentError){ @mail.delete }
|
245
|
+
assert_raise(ArgumentError){ @mail.delete('test@foo.com') }
|
246
|
+
end
|
247
|
+
|
248
|
+
test "subscribe basic functionality" do
|
249
|
+
assert_respond_to(@mail, :subscribe)
|
250
|
+
end
|
251
|
+
|
252
|
+
test "subscribe expected results" do
|
253
|
+
login
|
254
|
+
assert_boolean(@mail.subscribe(@list, 'test'))
|
255
|
+
end
|
256
|
+
|
257
|
+
test "subscribe requires at least one argument" do
|
258
|
+
assert_raise(ArgumentError){ @mail.subscribe }
|
259
|
+
end
|
260
|
+
|
261
|
+
test "signoff basic functionality" do
|
262
|
+
assert_respond_to(@mail, :signoff)
|
263
|
+
end
|
264
|
+
|
265
|
+
test "signoff expected results" do
|
266
|
+
login
|
267
|
+
assert_boolean(@mail.signoff(@list))
|
268
|
+
end
|
269
|
+
|
270
|
+
test "unsubscribe is an alias for signoff" do
|
271
|
+
assert_alias_method(@mail, :unsubscribe, :signoff)
|
272
|
+
end
|
273
|
+
|
274
|
+
test "signoff requires one argument only" do
|
275
|
+
assert_raise(ArgumentError){ @mail.signoff }
|
276
|
+
assert_raise(ArgumentError){ @mail.signoff(@user, @list) }
|
277
|
+
end
|
278
|
+
|
279
|
+
def teardown
|
280
|
+
@mail = nil
|
281
|
+
@user = nil
|
282
|
+
@pass = nil
|
283
|
+
@list = nil
|
284
|
+
end
|
285
|
+
|
286
|
+
def self.shutdown
|
287
|
+
@@url = nil
|
288
|
+
@@info = nil
|
289
|
+
end
|
290
|
+
end
|
metadata
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mail-sympa
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Daniel J. Berger
|
8
|
+
- David Salisbury
|
9
|
+
- Mark Sallee
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
|
14
|
+
date: 2010-04-13 00:00:00 -06:00
|
15
|
+
default_executable:
|
16
|
+
dependencies:
|
17
|
+
- !ruby/object:Gem::Dependency
|
18
|
+
name: soap4r
|
19
|
+
type: :runtime
|
20
|
+
version_requirement:
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
requirements:
|
23
|
+
- - ">="
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: 1.5.8
|
26
|
+
version:
|
27
|
+
description: Ruby interface for the Sympa mailing list server
|
28
|
+
email: djberg96@gmail.com
|
29
|
+
executables: []
|
30
|
+
|
31
|
+
extensions: []
|
32
|
+
|
33
|
+
extra_rdoc_files:
|
34
|
+
- README
|
35
|
+
- CHANGES
|
36
|
+
- MANIFEST
|
37
|
+
files:
|
38
|
+
- CHANGES
|
39
|
+
- lib/mail/sympa.rb
|
40
|
+
- mail-sympa.gemspec
|
41
|
+
- MANIFEST
|
42
|
+
- Rakefile
|
43
|
+
- README
|
44
|
+
- test/test_mail_sympa.rb
|
45
|
+
has_rdoc: true
|
46
|
+
homepage: http://github.com/djberg96/mail-sympa
|
47
|
+
licenses:
|
48
|
+
- Artistic 2.0
|
49
|
+
post_install_message:
|
50
|
+
rdoc_options: []
|
51
|
+
|
52
|
+
require_paths:
|
53
|
+
- lib
|
54
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
55
|
+
requirements:
|
56
|
+
- - ">="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: "0"
|
59
|
+
version:
|
60
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: "0"
|
65
|
+
version:
|
66
|
+
requirements: []
|
67
|
+
|
68
|
+
rubyforge_project:
|
69
|
+
rubygems_version: 1.3.5
|
70
|
+
signing_key:
|
71
|
+
specification_version: 3
|
72
|
+
summary: The mail-sympa library provides a Ruby interface to the Sympa mailing list server software. This is a convenient and pretty wrapper for the various SOAP functions that Sympa server publishes. See http://www.sympa.org for more information.
|
73
|
+
test_files:
|
74
|
+
- test/test_mail_sympa.rb
|