ruby-bugzilla 0.3.3 → 0.4.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/bin/bzconsole +105 -11
- data/bin/bzconsole~ +100 -14
- data/lib/bugzilla/api_tmpl.rb +52 -0
- data/lib/bugzilla/api_tmpl.rb~ +51 -0
- data/lib/bugzilla/bug.rb +346 -0
- data/lib/bugzilla/bug.rb~ +323 -0
- data/lib/bugzilla/bugzilla.rb +141 -0
- data/lib/bugzilla/bugzilla.rb~ +140 -0
- data/lib/bugzilla/plugin.rb +82 -0
- data/lib/bugzilla/plugin.rb~ +82 -0
- data/lib/bugzilla/product.rb +156 -0
- data/lib/bugzilla/skeleton.rb +50 -0
- data/lib/bugzilla/skelton.rb~ +50 -0
- data/lib/bugzilla/user.rb +114 -0
- data/lib/bugzilla/user.rb~ +114 -0
- data/lib/bugzilla/version.rb +33 -0
- data/lib/bugzilla/xmlrpc.rb +81 -0
- data/lib/ruby-bugzilla/rhbugzilla.rb +1 -1
- data/lib/ruby-bugzilla/rhbugzilla.rb~ +173 -10
- metadata +101 -99
- data/lib/bugzilla.rb +0 -826
- data/lib/bugzilla.rb~ +0 -788
@@ -0,0 +1,51 @@
|
|
1
|
+
# api_tmpl.rb
|
2
|
+
# Copyright (C) 2010-2012 Red Hat, Inc.
|
3
|
+
#
|
4
|
+
# Authors:
|
5
|
+
# Akira TAGOH <tagoh@redhat.com>
|
6
|
+
#
|
7
|
+
# This program is free software; you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation; either version 2 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# This program is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with this program; if not, write to the Free Software
|
19
|
+
# Foundation, Inc., 59 Temple Place - Suite 330,
|
20
|
+
# Boston, MA 02111-1307, USA.
|
21
|
+
|
22
|
+
require 'bugzilla/skeleton'
|
23
|
+
|
24
|
+
|
25
|
+
module Bugzilla
|
26
|
+
|
27
|
+
=begin rdoc
|
28
|
+
|
29
|
+
=== Bugzilla::APITemplate
|
30
|
+
|
31
|
+
=end
|
32
|
+
|
33
|
+
class APITemplate < Skeleton
|
34
|
+
|
35
|
+
def initialize(iface)
|
36
|
+
super
|
37
|
+
|
38
|
+
@bz = Bugzilla.new(iface)
|
39
|
+
end # def initialize
|
40
|
+
|
41
|
+
def method_missing(symbol, *args)
|
42
|
+
if @bz.respond_to?(symbol) then
|
43
|
+
@bz.__send__(symbol, *args)
|
44
|
+
else
|
45
|
+
super
|
46
|
+
end
|
47
|
+
end # def method_missing
|
48
|
+
|
49
|
+
end # class APITemplate
|
50
|
+
|
51
|
+
end # module Bugzilla
|
data/lib/bugzilla/bug.rb
ADDED
@@ -0,0 +1,346 @@
|
|
1
|
+
# bug.rb
|
2
|
+
# Copyright (C) 2010-2012 Red Hat, Inc.
|
3
|
+
#
|
4
|
+
# Authors:
|
5
|
+
# Akira TAGOH <tagoh@redhat.com>
|
6
|
+
#
|
7
|
+
# This program is free software; you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation; either version 2 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# This program is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with this program; if not, write to the Free Software
|
19
|
+
# Foundation, Inc., 59 Temple Place - Suite 330,
|
20
|
+
# Boston, MA 02111-1307, USA.
|
21
|
+
|
22
|
+
require 'bugzilla/api_tmpl'
|
23
|
+
|
24
|
+
module Bugzilla
|
25
|
+
|
26
|
+
=begin rdoc
|
27
|
+
|
28
|
+
=== Bugzilla::Bug
|
29
|
+
|
30
|
+
Bugzilla::Bug class is to access
|
31
|
+
the Bugzilla::WebService::Bug API that allows you to file
|
32
|
+
a new bug in Bugzilla or get information about bugs that
|
33
|
+
have already been filed.
|
34
|
+
|
35
|
+
=end
|
36
|
+
|
37
|
+
class Bug < APITemplate
|
38
|
+
|
39
|
+
FIELDS_SUMMARY = ["id", "product", "component", "status", "severity", "summary"]
|
40
|
+
FIELDS_DETAILS = FIELDS_SUMMARY + ["assigned_to", "internals", "priority", "resolution"]
|
41
|
+
FIELDS_ALL = ["alias", "assigned_to", "blocks", "cc", "classification",
|
42
|
+
"component", "creation_time", "creator", "deadline",
|
43
|
+
"depends_on", "dupe_of", "estimated_time", "groups",
|
44
|
+
"id", "is_cc_accessible", "is_confirmed", "is_open",
|
45
|
+
"is_creator_accessible", "keywords", "last_change_time",
|
46
|
+
"op_sys", "platform", "priority", "product", "qa_contact",
|
47
|
+
"remaining_time", "resolution", "see_also", "severity",
|
48
|
+
"status", "summary", "target_milestone", "update_token",
|
49
|
+
"url", "version", "whiteboard",
|
50
|
+
"external_bugs", "internals"]
|
51
|
+
|
52
|
+
=begin rdoc
|
53
|
+
|
54
|
+
==== Bugzilla::Bug#get_bugs(bugs, fields = Bugzilla::Bug::FIELDS_SUMMARY)
|
55
|
+
|
56
|
+
Get the _bugs_ information from Bugzilla. either of String
|
57
|
+
or Numeric or Array would be acceptable for _bugs_. you can
|
58
|
+
specify the fields you want to look up with _fields_.
|
59
|
+
|
60
|
+
FWIW this name conflicts to Bugzilla API but this isn's a
|
61
|
+
primitive method since get_bugs method in WebService API is
|
62
|
+
actually deprecated.
|
63
|
+
|
64
|
+
=end
|
65
|
+
|
66
|
+
def get_bugs(bugs, fields = ::Bugzilla::Bug::FIELDS_SUMMARY)
|
67
|
+
params = {}
|
68
|
+
|
69
|
+
if bugs.kind_of?(Array) then
|
70
|
+
params['ids'] = bugs
|
71
|
+
elsif bugs.kind_of?(Integer) ||
|
72
|
+
bugs.kind_of?(String) then
|
73
|
+
params['ids'] = [bugs]
|
74
|
+
else
|
75
|
+
raise ArgumentError, sprintf("Unknown type of arguments: %s", bugs.class)
|
76
|
+
end
|
77
|
+
unless fields.nil? then
|
78
|
+
unless (fields - ::Bugzilla::Bug::FIELDS_ALL).empty? then
|
79
|
+
raise ArgumentError, sprintf("Invalid fields: %s", (::Bugzilla::Bug::FIELDS_ALL - fields).join(' '))
|
80
|
+
end
|
81
|
+
params['include_fields'] = fields
|
82
|
+
end
|
83
|
+
|
84
|
+
result = get(params)
|
85
|
+
|
86
|
+
if fields.nil? || fields == ::Bugzilla::Bug::FIELDS_ALL then
|
87
|
+
get_comments(bugs).each do |id, c|
|
88
|
+
result['bugs'].each do |r|
|
89
|
+
if r['id'].to_s == id then
|
90
|
+
r['comments'] = c['comments']
|
91
|
+
r['comments'] = [] if r['comments'].nil?
|
92
|
+
break
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
# 'bugs' is only in interests.
|
99
|
+
# XXX: need to deal with 'faults' ?
|
100
|
+
result['bugs']
|
101
|
+
end # def get_bugs
|
102
|
+
|
103
|
+
=begin rdoc
|
104
|
+
|
105
|
+
==== Bugzilla::Bug#get_comments(bugs)
|
106
|
+
|
107
|
+
=end
|
108
|
+
|
109
|
+
def get_comments(bugs)
|
110
|
+
params = {}
|
111
|
+
|
112
|
+
if bugs.kind_of?(Array) then
|
113
|
+
params['ids'] = bugs
|
114
|
+
elsif bugs.kind_of?(Integer) ||
|
115
|
+
bugs.kind_of?(String) then
|
116
|
+
params['ids'] = [bugs]
|
117
|
+
else
|
118
|
+
raise ArgumentError, sprintf("Unknown type of arguments: %s", bugs.class)
|
119
|
+
end
|
120
|
+
|
121
|
+
result = comments(params)
|
122
|
+
|
123
|
+
# not supporting comment_ids. so drop "comments".
|
124
|
+
result['bugs']
|
125
|
+
end # def get_comments
|
126
|
+
|
127
|
+
=begin rdoc
|
128
|
+
|
129
|
+
==== Bugzilla::Bug#fields(params)
|
130
|
+
|
131
|
+
Raw Bugzilla API to obtain the information about valid bug
|
132
|
+
fields, including the lists of legal values for each field.
|
133
|
+
|
134
|
+
See http://www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/Bug.html
|
135
|
+
|
136
|
+
=end
|
137
|
+
|
138
|
+
=begin rdoc
|
139
|
+
|
140
|
+
==== Bugzilla::Bug#legal_values(params)
|
141
|
+
|
142
|
+
Raw Bugzilla API to obtain the information what values are
|
143
|
+
allowed for a particular field.
|
144
|
+
|
145
|
+
See http://www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/Bug.html
|
146
|
+
|
147
|
+
=end
|
148
|
+
|
149
|
+
=begin rdoc
|
150
|
+
|
151
|
+
==== Bugzilla::Bug#attachments(params)
|
152
|
+
|
153
|
+
Raw Bugzilla API to obtain the information about
|
154
|
+
attachments, given a list of bugs and/or attachment ids.
|
155
|
+
|
156
|
+
See http://www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/Bug.html
|
157
|
+
|
158
|
+
=end
|
159
|
+
|
160
|
+
=begin rdoc
|
161
|
+
|
162
|
+
==== Bugzilla::Bug#comments(params)
|
163
|
+
|
164
|
+
Raw Bugzilla API to obtain the information about comments,
|
165
|
+
given a list of bugs and/or comment ids.
|
166
|
+
|
167
|
+
See http://www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/Bug.html
|
168
|
+
|
169
|
+
=end
|
170
|
+
|
171
|
+
=begin rdoc
|
172
|
+
|
173
|
+
==== Bugzilla::Bug#get(params)
|
174
|
+
|
175
|
+
Raw Bugzilla API to obtain the information about particular
|
176
|
+
bugs in the database.
|
177
|
+
|
178
|
+
=end
|
179
|
+
|
180
|
+
=begin rdoc
|
181
|
+
|
182
|
+
==== Bugzilla::Bug#history(params)
|
183
|
+
|
184
|
+
Raw Bugzilla API to obtain the history of changes for
|
185
|
+
particular bugs in the database.
|
186
|
+
|
187
|
+
=end
|
188
|
+
|
189
|
+
=begin rdoc
|
190
|
+
|
191
|
+
==== Bugzilla::Bug#search(params)
|
192
|
+
|
193
|
+
Raw Bugzilla API to search for bugs based on particular
|
194
|
+
criteria.
|
195
|
+
|
196
|
+
=end
|
197
|
+
|
198
|
+
protected
|
199
|
+
|
200
|
+
def _fields(cmd, *args)
|
201
|
+
requires_version(cmd, 3.6)
|
202
|
+
params = {}
|
203
|
+
|
204
|
+
if args[0].kind_of?(Array) then
|
205
|
+
x = args[0].map {|x| x.kind_of?(Integer)}.uniq
|
206
|
+
if x.length == 1 && x[0] then
|
207
|
+
params['ids'] = args[0]
|
208
|
+
else
|
209
|
+
x = args[0].map {|x| x.kind_of?(String)}.uniq
|
210
|
+
if x.length == 1 && x[0] then
|
211
|
+
params['names'] = args[0]
|
212
|
+
end
|
213
|
+
end
|
214
|
+
elsif args[0].kind_of?(Hash) then
|
215
|
+
params = args[0]
|
216
|
+
elsif args[0].kind_of?(Integer) then
|
217
|
+
params['ids'] = [args[0]]
|
218
|
+
elsif args[0].kind_of?(String) then
|
219
|
+
params['names'] = [args[0]]
|
220
|
+
elsif args[0].nil? then
|
221
|
+
else
|
222
|
+
raise ArgumentError, "Invalid parameters"
|
223
|
+
end
|
224
|
+
|
225
|
+
@iface.call(cmd, params)
|
226
|
+
end # def _fields
|
227
|
+
|
228
|
+
def _legal_values(cmd, *args)
|
229
|
+
raise ArgumentError, "Invalid parameters" unless args[0].kind_of?(Hash)
|
230
|
+
|
231
|
+
@iface.call(cmd, args[0])
|
232
|
+
end # def _legal_values
|
233
|
+
|
234
|
+
def _attachments(cmd, *args)
|
235
|
+
requires_version(cmd, 3.6)
|
236
|
+
|
237
|
+
raise ArgumentError, "Invalid parameters" unless args[0].kind_of?(Hash)
|
238
|
+
|
239
|
+
@iface.call(cmd, args[0])
|
240
|
+
end # def _attachments
|
241
|
+
|
242
|
+
def _comments(cmd, *args)
|
243
|
+
requires_version(cmd, 3.4)
|
244
|
+
|
245
|
+
raise ArgumentError, "Invalid parameters" unless args[0].kind_of?(Hash)
|
246
|
+
|
247
|
+
@iface.call(cmd, args[0])
|
248
|
+
end # def _comments
|
249
|
+
|
250
|
+
def _get(cmd, *args)
|
251
|
+
params = {}
|
252
|
+
|
253
|
+
if args[0].kind_of?(Hash) then
|
254
|
+
params = args[0]
|
255
|
+
elsif args[0].kind_of?(Array) then
|
256
|
+
params['ids'] = args[0]
|
257
|
+
elsif args[0].kind_of?(Integer) ||
|
258
|
+
args[0].kind_of?(String) then
|
259
|
+
params['ids'] = [args[0]]
|
260
|
+
else
|
261
|
+
raise ArgumentError, "Invalid parameters"
|
262
|
+
end
|
263
|
+
if check_version(3.4)[0] then
|
264
|
+
params['permissive'] = true
|
265
|
+
end
|
266
|
+
|
267
|
+
@iface.call(cmd, params)
|
268
|
+
end # def _get
|
269
|
+
|
270
|
+
def _history(cmd, *args)
|
271
|
+
requires_version(cmd, 3.4)
|
272
|
+
|
273
|
+
params = {}
|
274
|
+
|
275
|
+
if args[0].kind_of?(Hash) then
|
276
|
+
params = args[0]
|
277
|
+
elsif args[0].kind_of?(Array) then
|
278
|
+
params['ids'] = args[0]
|
279
|
+
elsif args[0].kind_of?(Integer) ||
|
280
|
+
args[0].kind_of?(String) then
|
281
|
+
params['ids'] = [args[0]]
|
282
|
+
else
|
283
|
+
raise ArgumentError, "Invalid parameters"
|
284
|
+
end
|
285
|
+
|
286
|
+
@iface.call(cmd, params)
|
287
|
+
end # def _history
|
288
|
+
|
289
|
+
def _search(cmd, *args)
|
290
|
+
requires_version(cmd, 3.4)
|
291
|
+
|
292
|
+
raise ArgumentError, "Invalid parameters" unless args[0].kind_of?(Hash)
|
293
|
+
|
294
|
+
@iface.call(cmd, args[0])
|
295
|
+
end # def _search
|
296
|
+
|
297
|
+
def _create(cmd, *args)
|
298
|
+
raise ArgumentError, "Invalid parameters" unless args[0].kind_of?(Hash)
|
299
|
+
|
300
|
+
required_fields = [:product, :component, :summary, :version]
|
301
|
+
defaulted_fields = [:description, :op_sys, :platform, :priority, :severity]
|
302
|
+
|
303
|
+
res = check_version("3.0.4")
|
304
|
+
unless res[0] then
|
305
|
+
required_fields.push(*defaulted_fields)
|
306
|
+
end
|
307
|
+
required_fields.each do |f|
|
308
|
+
raise ArgumentError, sprintf("Required fields isn't given: %s", f) unless args[0].include?(f)
|
309
|
+
end
|
310
|
+
res = check_version(4.0)
|
311
|
+
unless res[0] then
|
312
|
+
raise ArgumentError, "groups field isn't available in this bugzilla" if args[0].include?("groups")
|
313
|
+
raise ArgumentError, "comment_is_private field isn't available in this bugzilla" if args[0].include?("comment_is_private")
|
314
|
+
else
|
315
|
+
if args[0].include?("commentprivacy") then
|
316
|
+
args[0]["comment_is_private"] = args[0]["commentprivacy"]
|
317
|
+
args[0].delete("commentprivacy")
|
318
|
+
end
|
319
|
+
end
|
320
|
+
|
321
|
+
@iface.call(cmd, args[0])
|
322
|
+
end # def _create
|
323
|
+
|
324
|
+
def __add_attachment(cmd, *args)
|
325
|
+
requires_version(cmd, 4.0)
|
326
|
+
# FIXME
|
327
|
+
end # def _add_attachment
|
328
|
+
|
329
|
+
def __add_comment(cmd, *args)
|
330
|
+
requires_version(cmd, 3.2)
|
331
|
+
# FIXME
|
332
|
+
end # def _add_comment
|
333
|
+
|
334
|
+
def __update(cmd, *args)
|
335
|
+
requires_version(cmd, 4.0)
|
336
|
+
# FIXME
|
337
|
+
end # def _update
|
338
|
+
|
339
|
+
def __update_see_also(cmd, *args)
|
340
|
+
requires_version(cmd, 3.4)
|
341
|
+
# FIXME
|
342
|
+
end # def _update_see_also
|
343
|
+
|
344
|
+
end # class Bug
|
345
|
+
|
346
|
+
end # module Bugzilla
|
@@ -0,0 +1,323 @@
|
|
1
|
+
# product.rb
|
2
|
+
# Copyright (C) 2010-2012 Red Hat, Inc.
|
3
|
+
#
|
4
|
+
# Authors:
|
5
|
+
# Akira TAGOH <tagoh@redhat.com>
|
6
|
+
#
|
7
|
+
# This program is free software; you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation; either version 2 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# This program is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with this program; if not, write to the Free Software
|
19
|
+
# Foundation, Inc., 59 Temple Place - Suite 330,
|
20
|
+
# Boston, MA 02111-1307, USA.
|
21
|
+
|
22
|
+
require 'bugzilla/api_tmpl'
|
23
|
+
|
24
|
+
module Bugzilla
|
25
|
+
|
26
|
+
=begin rdoc
|
27
|
+
|
28
|
+
=== Bugzilla::Bug
|
29
|
+
|
30
|
+
Bugzilla::Bug class is to access
|
31
|
+
the Bugzilla::WebService::Bug API that allows you to file
|
32
|
+
a new bug in Bugzilla or get information about bugs that
|
33
|
+
have already been filed.
|
34
|
+
|
35
|
+
=end
|
36
|
+
|
37
|
+
class Bug < APITemplate
|
38
|
+
|
39
|
+
FIELDS_SUMMARY = ["id", "product", "component", "status", "severity", "summary"]
|
40
|
+
FIELDS_DETAILS = FIELDS_SUMMARY + ["assigned_to", "internals", "priority", "resolution"]
|
41
|
+
FIELDS_ALL = ["alias", "assigned_to", "blocks", "cc", "classification",
|
42
|
+
"component", "creation_time", "creator", "deadline",
|
43
|
+
"depends_on", "dupe_of", "estimated_time", "groups",
|
44
|
+
"id", "is_cc_accessible", "is_confirmed", "is_open",
|
45
|
+
"is_creator_accessible", "keywords", "last_change_time",
|
46
|
+
"op_sys", "platform", "priority", "product", "qa_contact",
|
47
|
+
"remaining_time", "resolution", "see_also", "severity",
|
48
|
+
"status", "summary", "target_milestone", "update_token",
|
49
|
+
"url", "version", "whiteboard",
|
50
|
+
"external_bugs", "internals"]
|
51
|
+
|
52
|
+
=begin rdoc
|
53
|
+
|
54
|
+
==== Bugzilla::Bug#get_bugs(bugs, fields = Bugzilla::Bug::FIELDS_SUMMARY)
|
55
|
+
|
56
|
+
Get the _bugs_ information from Bugzilla. either of String
|
57
|
+
or Numeric or Array would be acceptable for _bugs_. you can
|
58
|
+
specify the fields you want to look up with _fields_.
|
59
|
+
|
60
|
+
FWIW this name conflicts to Bugzilla API but this isn's a
|
61
|
+
primitive method since get_bugs method in WebService API is
|
62
|
+
actually deprecated.
|
63
|
+
|
64
|
+
=end
|
65
|
+
|
66
|
+
def get_bugs(bugs, fields = ::Bugzilla::Bug::FIELDS_SUMMARY)
|
67
|
+
params = {}
|
68
|
+
|
69
|
+
if bugs.kind_of?(Array) then
|
70
|
+
params['ids'] = bugs
|
71
|
+
elsif bugs.kind_of?(Integer) ||
|
72
|
+
bugs.kind_of?(String) then
|
73
|
+
params['ids'] = [bugs]
|
74
|
+
else
|
75
|
+
raise ArgumentError, sprintf("Unknown type of arguments: %s", bugs.class)
|
76
|
+
end
|
77
|
+
unless fields.nil? then
|
78
|
+
unless (fields - ::Bugzilla::Bug::FIELDS_ALL).empty? then
|
79
|
+
raise ArgumentError, sprintf("Invalid fields: %s", (::Bugzilla::Bug::FIELDS_ALL - fields).join(' '))
|
80
|
+
end
|
81
|
+
params['include_fields'] = fields
|
82
|
+
end
|
83
|
+
|
84
|
+
result = get(params)
|
85
|
+
|
86
|
+
if fields.nil? || fields == ::Bugzilla::Bug::FIELDS_ALL then
|
87
|
+
get_comments(bugs).each do |id, c|
|
88
|
+
result['bugs'].each do |r|
|
89
|
+
if r['id'].to_s == id then
|
90
|
+
r['comments'] = c['comments']
|
91
|
+
r['comments'] = [] if r['comments'].nil?
|
92
|
+
break
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
# 'bugs' is only in interests.
|
99
|
+
# XXX: need to deal with 'faults' ?
|
100
|
+
result['bugs']
|
101
|
+
end # def get_bugs
|
102
|
+
|
103
|
+
=begin rdoc
|
104
|
+
|
105
|
+
==== Bugzilla::Bug#get_comments(bugs)
|
106
|
+
|
107
|
+
=end
|
108
|
+
|
109
|
+
def get_comments(bugs)
|
110
|
+
params = {}
|
111
|
+
|
112
|
+
if bugs.kind_of?(Array) then
|
113
|
+
params['ids'] = bugs
|
114
|
+
elsif bugs.kind_of?(Integer) ||
|
115
|
+
bugs.kind_of?(String) then
|
116
|
+
params['ids'] = [bugs]
|
117
|
+
else
|
118
|
+
raise ArgumentError, sprintf("Unknown type of arguments: %s", bugs.class)
|
119
|
+
end
|
120
|
+
|
121
|
+
result = comments(params)
|
122
|
+
|
123
|
+
# not supporting comment_ids. so drop "comments".
|
124
|
+
result['bugs']
|
125
|
+
end # def get_comments
|
126
|
+
|
127
|
+
=begin rdoc
|
128
|
+
|
129
|
+
==== Bugzilla::Bug#fields(params)
|
130
|
+
|
131
|
+
Raw Bugzilla API to obtain the information about valid bug
|
132
|
+
fields, including the lists of legal values for each field.
|
133
|
+
|
134
|
+
See http://www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/Bug.html
|
135
|
+
|
136
|
+
=end
|
137
|
+
|
138
|
+
=begin rdoc
|
139
|
+
|
140
|
+
==== Bugzilla::Bug#legal_values(params)
|
141
|
+
|
142
|
+
Raw Bugzilla API to obtain the information what values are
|
143
|
+
allowed for a particular field.
|
144
|
+
|
145
|
+
See http://www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/Bug.html
|
146
|
+
|
147
|
+
=end
|
148
|
+
|
149
|
+
=begin rdoc
|
150
|
+
|
151
|
+
==== Bugzilla::Bug#attachments(params)
|
152
|
+
|
153
|
+
Raw Bugzilla API to obtain the information about
|
154
|
+
attachments, given a list of bugs and/or attachment ids.
|
155
|
+
|
156
|
+
See http://www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/Bug.html
|
157
|
+
|
158
|
+
=end
|
159
|
+
|
160
|
+
=begin rdoc
|
161
|
+
|
162
|
+
==== Bugzilla::Bug#comments(params)
|
163
|
+
|
164
|
+
Raw Bugzilla API to obtain the information about comments,
|
165
|
+
given a list of bugs and/or comment ids.
|
166
|
+
|
167
|
+
See http://www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/Bug.html
|
168
|
+
|
169
|
+
=end
|
170
|
+
|
171
|
+
=begin rdoc
|
172
|
+
|
173
|
+
==== Bugzilla::Bug#get(params)
|
174
|
+
|
175
|
+
Raw Bugzilla API to obtain the information about particular
|
176
|
+
bugs in the database.
|
177
|
+
|
178
|
+
=end
|
179
|
+
|
180
|
+
=begin rdoc
|
181
|
+
|
182
|
+
==== Bugzilla::Bug#history(params)
|
183
|
+
|
184
|
+
Raw Bugzilla API to obtain the history of changes for
|
185
|
+
particular bugs in the database.
|
186
|
+
|
187
|
+
=end
|
188
|
+
|
189
|
+
=begin rdoc
|
190
|
+
|
191
|
+
==== Bugzilla::Bug#search(params)
|
192
|
+
|
193
|
+
Raw Bugzilla API to search for bugs based on particular
|
194
|
+
criteria.
|
195
|
+
|
196
|
+
=end
|
197
|
+
|
198
|
+
protected
|
199
|
+
|
200
|
+
def _fields(cmd, *args)
|
201
|
+
requires_version(cmd, 3.6)
|
202
|
+
params = {}
|
203
|
+
|
204
|
+
if args[0].kind_of?(Array) then
|
205
|
+
x = args[0].map {|x| x.kind_of?(Integer)}.uniq
|
206
|
+
if x.length == 1 && x[0] then
|
207
|
+
params['ids'] = args[0]
|
208
|
+
else
|
209
|
+
x = args[0].map {|x| x.kind_of?(String)}.uniq
|
210
|
+
if x.length == 1 && x[0] then
|
211
|
+
params['names'] = args[0]
|
212
|
+
end
|
213
|
+
end
|
214
|
+
elsif args[0].kind_of?(Hash) then
|
215
|
+
params = args[0]
|
216
|
+
elsif args[0].kind_of?(Integer) then
|
217
|
+
params['ids'] = [args[0]]
|
218
|
+
elsif args[0].kind_of?(String) then
|
219
|
+
params['names'] = [args[0]]
|
220
|
+
elsif args[0].nil? then
|
221
|
+
else
|
222
|
+
raise ArgumentError, "Invalid parameters"
|
223
|
+
end
|
224
|
+
|
225
|
+
@iface.call(cmd, params)
|
226
|
+
end # def _fields
|
227
|
+
|
228
|
+
def _legal_values(cmd, *args)
|
229
|
+
raise ArgumentError, "Invalid parameters" unless args[0].kind_of?(Hash)
|
230
|
+
|
231
|
+
@iface.call(cmd, args[0])
|
232
|
+
end # def _legal_values
|
233
|
+
|
234
|
+
def _attachments(cmd, *args)
|
235
|
+
requires_version(cmd, 3.6)
|
236
|
+
|
237
|
+
raise ArgumentError, "Invalid parameters" unless args[0].kind_of?(Hash)
|
238
|
+
|
239
|
+
@iface.call(cmd, args[0])
|
240
|
+
end # def _attachments
|
241
|
+
|
242
|
+
def _comments(cmd, *args)
|
243
|
+
requires_version(cmd, 3.4)
|
244
|
+
|
245
|
+
raise ArgumentError, "Invalid parameters" unless args[0].kind_of?(Hash)
|
246
|
+
|
247
|
+
@iface.call(cmd, args[0])
|
248
|
+
end # def _comments
|
249
|
+
|
250
|
+
def _get(cmd, *args)
|
251
|
+
params = {}
|
252
|
+
|
253
|
+
if args[0].kind_of?(Hash) then
|
254
|
+
params = args[0]
|
255
|
+
elsif args[0].kind_of?(Array) then
|
256
|
+
params['ids'] = args[0]
|
257
|
+
elsif args[0].kind_of?(Integer) ||
|
258
|
+
args[0].kind_of?(String) then
|
259
|
+
params['ids'] = [args[0]]
|
260
|
+
else
|
261
|
+
raise ArgumentError, "Invalid parameters"
|
262
|
+
end
|
263
|
+
if check_version(3.4)[0] then
|
264
|
+
params['permissive'] = true
|
265
|
+
end
|
266
|
+
|
267
|
+
@iface.call(cmd, params)
|
268
|
+
end # def _get
|
269
|
+
|
270
|
+
def _history(cmd, *args)
|
271
|
+
requires_version(cmd, 3.4)
|
272
|
+
|
273
|
+
params = {}
|
274
|
+
|
275
|
+
if args[0].kind_of?(Hash) then
|
276
|
+
params = args[0]
|
277
|
+
elsif args[0].kind_of?(Array) then
|
278
|
+
params['ids'] = args[0]
|
279
|
+
elsif args[0].kind_of?(Integer) ||
|
280
|
+
args[0].kind_of?(String) then
|
281
|
+
params['ids'] = [args[0]]
|
282
|
+
else
|
283
|
+
raise ArgumentError, "Invalid parameters"
|
284
|
+
end
|
285
|
+
|
286
|
+
@iface.call(cmd, params)
|
287
|
+
end # def _history
|
288
|
+
|
289
|
+
def _search(cmd, *args)
|
290
|
+
requires_version(cmd, 3.4)
|
291
|
+
|
292
|
+
raise ArgumentError, "Invalid parameters" unless args[0].kind_of?(Hash)
|
293
|
+
|
294
|
+
@iface.call(cmd, args[0])
|
295
|
+
end # def _search
|
296
|
+
|
297
|
+
def __create(cmd, *args)
|
298
|
+
# FIXME
|
299
|
+
end # def _create
|
300
|
+
|
301
|
+
def __add_attachment(cmd, *args)
|
302
|
+
requires_version(cmd, 4.0)
|
303
|
+
# FIXME
|
304
|
+
end # def _add_attachment
|
305
|
+
|
306
|
+
def __add_comment(cmd, *args)
|
307
|
+
requires_version(cmd, 3.2)
|
308
|
+
# FIXME
|
309
|
+
end # def _add_comment
|
310
|
+
|
311
|
+
def __update(cmd, *args)
|
312
|
+
requires_version(cmd, 4.0)
|
313
|
+
# FIXME
|
314
|
+
end # def _update
|
315
|
+
|
316
|
+
def __update_see_also(cmd, *args)
|
317
|
+
requires_version(cmd, 3.4)
|
318
|
+
# FIXME
|
319
|
+
end # def _update_see_also
|
320
|
+
|
321
|
+
end # class Bug
|
322
|
+
|
323
|
+
end # module Bugzilla
|