ruby-bugzilla 0.5.2 → 0.5.3

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0307f396074f4bfc609205e13921d0998140cdaf
4
+ data.tar.gz: db4d1be9d736eb65ee0e71076bb9a4b03181b720
5
+ SHA512:
6
+ metadata.gz: af978391061ce95cce0f9e8ff1099f710861eee3800d634a6ef352e6a6530197bb0a93fa9e06899adea6786f83f52914fe48acdef4b6c21ad05edf61417f74e9
7
+ data.tar.gz: f3c22d1e96bae90fca980d7ba769771263bdb350ee4531e5c6ad8f16f5317bb028bedea651b74d4313401bd82619e8c6535c75ff28f2b5fec36f12e929a08241
data/README.rdoc CHANGED
@@ -12,7 +12,7 @@ APIs are available:
12
12
 
13
13
  == Copyright
14
14
 
15
- Copyright (c) 2010-2012 Red Hat, Inc. See COPYING for details.
15
+ Copyright (c) 2010-2014 Red Hat, Inc. See COPYING for details.
16
16
 
17
17
  == License
18
18
 
data/bin/bzconsole CHANGED
@@ -1,7 +1,7 @@
1
1
  #! /usr/bin/env ruby
2
2
  # -*- coding: utf-8 -*-
3
3
  # bzconsole
4
- # Copyright (C) 2010-2012 Red Hat, Inc.
4
+ # Copyright (C) 2010-2014 Red Hat, Inc.
5
5
  #
6
6
  # Authors:
7
7
  # Akira TAGOH <tagoh@redhat.com>
@@ -215,7 +215,7 @@ module BzConsole
215
215
  proxy_host, proxy_port = get_proxy(info)
216
216
  timeout = opts[:timeout].nil? ? 60 : opts[:timeout]
217
217
 
218
- xmlrpc = Bugzilla::XMLRPC.new(host, port, path, proxy_host, proxy_port, timeout)
218
+ xmlrpc = Bugzilla::XMLRPC.new(host, port, path, proxy_host, proxy_port, timeout, uri.user, uri.password)
219
219
  user = Bugzilla::User.new(xmlrpc)
220
220
  begin
221
221
  result = user.login({'login'=>login, 'password'=>pass, 'remember'=>true})
@@ -321,7 +321,7 @@ module BzConsole
321
321
 
322
322
  @plugin.run(:pre, host, :getbug, opts)
323
323
 
324
- xmlrpc = Bugzilla::XMLRPC.new(host, port, path, proxy_host, proxy_port, timeout)
324
+ xmlrpc = Bugzilla::XMLRPC.new(host, port, path, proxy_host, proxy_port, timeout, uri.user, uri.password)
325
325
  user = Bugzilla::User.new(xmlrpc)
326
326
  user.session(login, pass) do
327
327
  bug = Bugzilla::Bug.new(xmlrpc)
@@ -435,7 +435,7 @@ module BzConsole
435
435
 
436
436
  @plugin.run(:pre, host, :search, opts[:command][:query])
437
437
 
438
- xmlrpc = Bugzilla::XMLRPC.new(host, port, path, proxy_host, proxy_port, timeout)
438
+ xmlrpc = Bugzilla::XMLRPC.new(host, port, path, proxy_host, proxy_port, timeout, uri.user, uri.password)
439
439
  user = Bugzilla::User.new(xmlrpc)
440
440
  user.session(login, pass) do
441
441
  bug = Bugzilla::Bug.new(xmlrpc)
@@ -514,7 +514,7 @@ module BzConsole
514
514
 
515
515
  @plugin.run(:pre, host, :show, opts)
516
516
 
517
- xmlrpc = Bugzilla::XMLRPC.new(host, port, path, proxy_host, proxy_port, timeout)
517
+ xmlrpc = Bugzilla::XMLRPC.new(host, port, path, proxy_host, proxy_port, timeout, uri.user, uri.password)
518
518
  user = Bugzilla::User.new(xmlrpc)
519
519
  user.session(login, pass) do
520
520
  if opts[:command][:show][:mode] == :field then
@@ -524,7 +524,6 @@ module BzConsole
524
524
 
525
525
  @plugin.run(:post, host, :show, result)
526
526
 
527
- pp result
528
527
  else
529
528
  product = Bugzilla::Product.new(xmlrpc)
530
529
 
@@ -678,7 +677,7 @@ module BzConsole
678
677
  proxy_host, proxy_port = get_proxy(info)
679
678
  timeout = opts[:timeout].nil? ? 60 : opts[:timeout]
680
679
 
681
- xmlrpc = Bugzilla::XMLRPC.new(host, port, path, proxy_host, proxy_port, timeout)
680
+ xmlrpc = Bugzilla::XMLRPC.new(host, port, path, proxy_host, proxy_port, timeout, uri.user, uri.password)
682
681
  user = Bugzilla::User.new(xmlrpc)
683
682
  user.session(login, pass) do
684
683
  bug = Bugzilla::Bug.new(xmlrpc)
@@ -862,7 +861,7 @@ module BzConsole
862
861
 
863
862
  @plugin.run(:pre, host, :newbug, opts)
864
863
 
865
- xmlrpc = Bugzilla::XMLRPC.new(host, port, path, proxy_host, proxy_port, timeout)
864
+ xmlrpc = Bugzilla::XMLRPC.new(host, port, path, proxy_host, proxy_port, timeout, uri.user, uri.password)
866
865
  user = Bugzilla::User.new(xmlrpc)
867
866
  user.session(login, pass) do
868
867
  bug = Bugzilla::Bug.new(xmlrpc)
@@ -1,5 +1,5 @@
1
1
  # bugzilla.rb
2
- # Copyright (C) 2010-2012 Red Hat, Inc.
2
+ # Copyright (C) 2010-2014 Red Hat, Inc.
3
3
  #
4
4
  # Authors:
5
5
  # Akira TAGOH <tagoh@redhat.com>
@@ -0,0 +1,161 @@
1
+ # bugzilla.rb
2
+ # Copyright (C) 2010-2012 Red Hat, Inc.
3
+ #
4
+ # Authors:
5
+ # Akira TAGOH <tagoh@redhat.com>
6
+ #
7
+ # This library is free software: you can redistribute it and/or
8
+ # modify it under the terms of the GNU Lesser General Public
9
+ # License as published by the Free Software Foundation, either
10
+ # version 3 of the License, or (at your option) any later version.
11
+ #
12
+ # This library 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, see <http://www.gnu.org/licenses/>.
19
+
20
+ require 'bugzilla/skeleton'
21
+
22
+ module Bugzilla
23
+
24
+ =begin rdoc
25
+
26
+ === Bugzilla::Bugzilla
27
+
28
+ Bugzilla::Bugzilla class is to access the
29
+ Bugzilla::WebService::Bugzilla API that provides functions
30
+ tell you about Bugzilla in general.
31
+
32
+ =end
33
+
34
+ class Bugzilla < Skeleton
35
+
36
+ =begin rdoc
37
+
38
+ ==== Bugzilla::Bugzilla#check_version(version_)
39
+
40
+ Returns Array contains the result of the version check and
41
+ Bugzilla version that is running on.
42
+
43
+ =end
44
+
45
+ def check_version(version_)
46
+ v = version
47
+ f = false
48
+ if v.kind_of?(Hash) && v.include?("version") &&
49
+ v['version'] >= "#{version_}" then
50
+ f = true
51
+ end
52
+
53
+ [f, v['version']]
54
+ end # def check_version
55
+
56
+ =begin rdoc
57
+
58
+ ==== Bugzilla::Bugzilla#requires_version(cmd, version_)
59
+
60
+ Raise an exception if the Bugzilla doesn't satisfy
61
+ the requirement of the _version_.
62
+
63
+ =end
64
+
65
+ def requires_version(cmd, version_)
66
+ v = check_version(version_)
67
+ raise NoMethodError, sprintf("%s is not supported in Bugzilla %s", cmd, v[1]) unless v[0]
68
+ end # def requires_version
69
+
70
+ =begin rdoc
71
+
72
+ ==== Bugzilla::Bugzilla#version
73
+
74
+ Raw Bugzilla API to obtain the Bugzilla version.
75
+
76
+ See http://www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/Bugzilla.html
77
+
78
+ =end
79
+
80
+ =begin rdoc
81
+
82
+ ==== Bugzilla::Bugzilla#extensions
83
+
84
+ Raw Bugzilla API to obtain the information about
85
+ the extensions that are currently installed and enabled in
86
+ the Bugzilla.
87
+
88
+ See http://www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/Bugzilla.html
89
+
90
+ =end
91
+
92
+ =begin rdoc
93
+
94
+ ==== Bugzilla::Bugzilla#timezone
95
+
96
+ Raw Bugzilla API to obtain the timezone that Bugzilla
97
+ expects dates and times in.
98
+
99
+ See http://www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/Bugzilla.html
100
+
101
+ =end
102
+
103
+ =begin rdoc
104
+
105
+ ==== Bugzilla::Bugzilla#time
106
+
107
+ Raw Bugzilla API to obtain the information about what time
108
+ the bugzilla server thinks it is, and what timezone it's
109
+ running on.
110
+
111
+ See http://www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/Bugzilla.html
112
+
113
+ =end
114
+
115
+ =begin rdoc
116
+
117
+ ==== Bugzilla::Bugzilla#parameters
118
+
119
+ Raw Bugzilla API to obtain parameter values currently used in Bugzilla.
120
+
121
+ See http://www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/Bugzilla.html
122
+
123
+ =end
124
+
125
+ protected
126
+
127
+ def _version(cmd, *args)
128
+ @iface.call(cmd)
129
+ end # def _version
130
+
131
+ def _extensions(cmd, *args)
132
+ requires_version(cmd, 3.2)
133
+
134
+ @iface.call(cmd)
135
+ end # def _extensions
136
+
137
+ def _timezone(cmd, *args)
138
+ @iface.call(cmd)
139
+ end # def _timezone
140
+
141
+ def _time(cmd, *args)
142
+ requires_version(cmd, 3.4)
143
+
144
+ @iface.call(cmd)
145
+ end # def _time
146
+
147
+ def _parameters(cmd, *args)
148
+ requires_version(cmd, 4.4)
149
+
150
+ @iface.call(cmd)
151
+ end # def _parameters
152
+
153
+ def __last_audit_time(cmd, *args)
154
+ requires_version(cmd, 4.4)
155
+
156
+ # FIXME
157
+ end # def _last_audit_time
158
+
159
+ end # class Bugzilla
160
+
161
+ end # module Bugzilla
@@ -1,5 +1,5 @@
1
1
  # skeleton.rb
2
- # Copyright (C) 2010-2012 Red Hat, Inc.
2
+ # Copyright (C) 2010-2014 Red Hat, Inc.
3
3
  #
4
4
  # Authors:
5
5
  # Akira TAGOH <tagoh@redhat.com>
@@ -36,7 +36,7 @@ module Bugzilla
36
36
  m = "_#{symbol}"
37
37
  klass = self.class.to_s.sub(/\ABugzilla::/, '')
38
38
  fm = "#{klass}.#{symbol}"
39
- if self.respond_to?(m) then
39
+ if self.respond_to?(m, true) then
40
40
  __send__(m, fm, *args)
41
41
  else
42
42
  raise NoMethodError, sprintf("No such Bugzilla APIs: %s.%s", klass, symbol)
@@ -0,0 +1,48 @@
1
+ # skeleton.rb
2
+ # Copyright (C) 2010-2012 Red Hat, Inc.
3
+ #
4
+ # Authors:
5
+ # Akira TAGOH <tagoh@redhat.com>
6
+ #
7
+ # This library is free software: you can redistribute it and/or
8
+ # modify it under the terms of the GNU Lesser General Public
9
+ # License as published by the Free Software Foundation, either
10
+ # version 3 of the License, or (at your option) any later version.
11
+ #
12
+ # This library 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, see <http://www.gnu.org/licenses/>.
19
+
20
+
21
+ module Bugzilla
22
+
23
+ =begin rdoc
24
+
25
+ === Bugzilla::Skeleton
26
+
27
+ =end
28
+
29
+ class Skeleton
30
+
31
+ def initialize(iface)
32
+ @iface = iface
33
+ end # def initialize
34
+
35
+ def method_missing(symbol, *args)
36
+ m = "_#{symbol}"
37
+ klass = self.class.to_s.sub(/\ABugzilla::/, '')
38
+ fm = "#{klass}.#{symbol}"
39
+ if self.respond_to?(m) then
40
+ __send__(m, fm, *args)
41
+ else
42
+ raise NoMethodError, sprintf("No such Bugzilla APIs: %s.%s", klass, symbol)
43
+ end
44
+ end # def method_missing
45
+
46
+ end # class Skeleton
47
+
48
+ end # module Bugzilla
data/lib/bugzilla/user.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # user.rb
2
- # Copyright (C) 2010-2012 Red Hat, Inc.
2
+ # Copyright (C) 2010-2014 Red Hat, Inc.
3
3
  #
4
4
  # Authors:
5
5
  # Akira TAGOH <tagoh@redhat.com>
@@ -43,28 +43,48 @@ Keeps the bugzilla session during doing something in the block.
43
43
  =end
44
44
 
45
45
  def session(user, password)
46
- fname = File.join(ENV['HOME'], '.ruby-bugzilla-cookie.yml')
46
+ r = check_version('4.4.3')
47
+ key = :cookie
48
+ if r[0] then
49
+ # Usisng tokens
50
+ key = :token
51
+ fname = File.join(ENV['HOME'], '.ruby-bugzilla-token.yml')
52
+ else
53
+ fname = File.join(ENV['HOME'], '.ruby-bugzilla-cookie.yml')
54
+ end
55
+ host = @iface.instance_variable_get(:@xmlrpc).instance_variable_get(:@host)
56
+ val = nil
57
+
47
58
  if File.exist?(fname) && File.lstat(fname).mode & 0600 == 0600 then
48
59
  conf = YAML.load(File.open(fname).read)
49
- host = @iface.instance_variable_get(:@xmlrpc).instance_variable_get(:@host)
50
- cookie = conf[host]
51
- unless cookie.nil? then
52
- @iface.cookie = cookie
60
+ val = conf[host]
61
+ else
62
+ conf = {}
63
+ end
64
+ if !val.nil? then
65
+ if key == :token then
66
+ print "Using token\n"
67
+ @iface.token = val
68
+ else
53
69
  print "Using cookie\n"
54
- yield
55
- conf[host] = @iface.cookie
56
- File.open(fname, 'w') {|f| f.chmod(0600); f.write(conf.to_yaml)}
57
- return
70
+ @iface.cookie = cookie
58
71
  end
59
- end
60
- if user.nil? || password.nil? then
61
72
  yield
73
+ elsif user.nil? || password.nil? then
74
+ yield
75
+ return
62
76
  else
63
77
  login({'login'=>user, 'password'=>password, 'remember'=>true})
64
78
  yield
65
- logout
66
79
  end
67
-
80
+ if key == :token then
81
+ conf[host] = @iface.token
82
+ else
83
+ conf[host] = @iface.cookie
84
+ end
85
+ File.open(fname, 'w') {|f| f.chmod(0600); f.write(conf.to_yaml)}
86
+
87
+ return key
68
88
  end # def session
69
89
 
70
90
  =begin rdoc
@@ -92,7 +112,12 @@ See http://www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/User.html
92
112
  def _login(cmd, *args)
93
113
  raise ArgumentError, "Invalid parameters" unless args[0].kind_of?(Hash)
94
114
 
95
- @iface.call(cmd,args[0])
115
+ res = @iface.call(cmd,args[0])
116
+ unless res['token'].nil? then
117
+ @iface.token = res['token']
118
+ end
119
+
120
+ return res
96
121
  end # def _login
97
122
 
98
123
  def _logout(cmd, *args)
@@ -0,0 +1,138 @@
1
+ # user.rb
2
+ # Copyright (C) 2010-2012 Red Hat, Inc.
3
+ #
4
+ # Authors:
5
+ # Akira TAGOH <tagoh@redhat.com>
6
+ #
7
+ # This library is free software: you can redistribute it and/or
8
+ # modify it under the terms of the GNU Lesser General Public
9
+ # License as published by the Free Software Foundation, either
10
+ # version 3 of the License, or (at your option) any later version.
11
+ #
12
+ # This library 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, see <http://www.gnu.org/licenses/>.
19
+
20
+ require 'yaml'
21
+ require 'bugzilla/api_tmpl'
22
+
23
+ module Bugzilla
24
+
25
+ =begin rdoc
26
+
27
+ === Bugzilla::User
28
+
29
+ Bugzilla::User class is to access the
30
+ Bugzilla::WebService::User API that allows you to create
31
+ User Accounts and log in/out using an existing account.
32
+
33
+ =end
34
+
35
+ class User < APITemplate
36
+
37
+ =begin rdoc
38
+
39
+ ==== Bugzilla::User#session(user, password)
40
+
41
+ Keeps the bugzilla session during doing something in the block.
42
+
43
+ =end
44
+
45
+ def session(user, password)
46
+ r = check_version('4.4.3')
47
+ key = :cookie
48
+ if r[0] then
49
+ # Usisng tokens
50
+ key = :token
51
+ fname = File.join(ENV['HOME'], '.ruby-bugzilla-token.yml')
52
+ else
53
+ fname = File.join(ENV['HOME'], '.ruby-bugzilla-cookie.yml')
54
+ end
55
+ if File.exist?(fname) && File.lstat(fname).mode & 0600 == 0600 then
56
+ conf = YAML.load(File.open(fname).read)
57
+ host = @iface.instance_variable_get(:@xmlrpc).instance_variable_get(:@host)
58
+ val = conf[host]
59
+ unless val.nil? then
60
+ if key == :token then
61
+ print "Using token\n"
62
+ @iface.token = val
63
+ else
64
+ print "Using cookie\n"
65
+ @iface.cookie = cookie
66
+ end
67
+ yield
68
+ if key == :token then
69
+ conf[host] = @iface.token
70
+ else
71
+ conf[host] = @iface.cookie
72
+ end
73
+ File.open(fname, 'w') {|f| f.chmod(0600); f.write(conf.to_yaml)}
74
+ return
75
+ end
76
+ end
77
+ if user.nil? || password.nil? then
78
+ yield
79
+ else
80
+ login({'login'=>user, 'password'=>password, 'remember'=>true})
81
+ yield
82
+ logout
83
+ end
84
+
85
+ end # def session
86
+
87
+ =begin rdoc
88
+
89
+ ==== Bugzilla::User#login(params)
90
+
91
+ Raw Bugzilla API to log into Bugzilla.
92
+
93
+ See http://www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/User.html
94
+
95
+ =end
96
+
97
+ =begin rdoc
98
+
99
+ ==== Bugzilla::User#logout
100
+
101
+ Raw Bugzilla API to log out the user.
102
+
103
+ See http://www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/User.html
104
+
105
+ =end
106
+
107
+ protected
108
+
109
+ def _login(cmd, *args)
110
+ raise ArgumentError, "Invalid parameters" unless args[0].kind_of?(Hash)
111
+
112
+ @iface.call(cmd,args[0])
113
+ end # def _login
114
+
115
+ def _logout(cmd, *args)
116
+ @iface.call(cmd)
117
+ end # def _logout
118
+
119
+ def __offer_account_by_email(cmd, *args)
120
+ # FIXME
121
+ end # def _offer_account_by_email
122
+
123
+ def __create(cmd, *args)
124
+ # FIXME
125
+ end # def _create
126
+
127
+ def __update(cmd, *args)
128
+ # FIXME
129
+ end # def _update
130
+
131
+ def __get(cmd, *args)
132
+ requires_version(cmd, 3.4)
133
+ # FIXME
134
+ end # def _get
135
+
136
+ end # class User
137
+
138
+ end # module Bugzilla
@@ -1,5 +1,5 @@
1
1
  # version.rb
2
- # Copyright (C) 2010-2012 Red Hat, Inc.
2
+ # Copyright (C) 2010-2014 Red Hat, Inc.
3
3
  #
4
4
  # Authors:
5
5
  # Akira TAGOH <tagoh@redhat.com>
@@ -26,6 +26,6 @@
26
26
 
27
27
  module Bugzilla
28
28
 
29
- VERSION = "0.5.2"
29
+ VERSION = "0.5.3"
30
30
 
31
31
  end # module Bugzilla
@@ -0,0 +1,31 @@
1
+ # version.rb
2
+ # Copyright (C) 2010-2012 Red Hat, Inc.
3
+ #
4
+ # Authors:
5
+ # Akira TAGOH <tagoh@redhat.com>
6
+ #
7
+ # This library is free software: you can redistribute it and/or
8
+ # modify it under the terms of the GNU Lesser General Public
9
+ # License as published by the Free Software Foundation, either
10
+ # version 3 of the License, or (at your option) any later version.
11
+ #
12
+ # This library 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, see <http://www.gnu.org/licenses/>.
19
+
20
+
21
+ =begin rdoc
22
+
23
+ == Bugzilla
24
+
25
+ =end
26
+
27
+ module Bugzilla
28
+
29
+ VERSION = "0.5.2"
30
+
31
+ end # module Bugzilla
@@ -1,5 +1,5 @@
1
1
  # xmlrpc.rb
2
- # Copyright (C) 2010-2012 Red Hat, Inc.
2
+ # Copyright (C) 2010-2014 Red Hat, Inc.
3
3
  #
4
4
  # Authors:
5
5
  # Akira TAGOH <tagoh@redhat.com>
@@ -35,10 +35,13 @@ module Bugzilla
35
35
 
36
36
  =end
37
37
 
38
- def initialize(host, port = 443, path = '/xmlrpc.cgi', proxy_host = nil, proxy_port = nil, timeout = 60)
38
+ def initialize(host, port = 443, path = '/xmlrpc.cgi', proxy_host = nil, proxy_port = nil, timeout = 60, http_basic_auth_user = nil, http_basic_auth_pass = nil)
39
39
  path ||= '/xmlrpc.cgi'
40
40
  use_ssl = port == 443 ? true : false
41
- @xmlrpc = ::XMLRPC::Client.new(host, path, port, proxy_host, proxy_port, nil, nil, use_ssl, timeout)
41
+ @xmlrpc = ::XMLRPC::Client.new(host, path, port, proxy_host, proxy_port, http_basic_auth_user, http_basic_auth_pass, use_ssl, timeout)
42
+
43
+ # workaround for https://bugs.ruby-lang.org/issues/8182
44
+ @xmlrpc.http_header_extra = {'accept-encoding' => 'identity'}
42
45
  end # def initialize
43
46
 
44
47
  =begin rdoc
@@ -51,6 +54,7 @@ module Bugzilla
51
54
  params = {} if params.nil?
52
55
  params['Bugzilla_login'] = user unless user.nil? || password.nil?
53
56
  params['Bugzilla_password'] = password unless user.nil? || password.nil?
57
+ params['Bugzilla_token'] = @token unless @token.nil?
54
58
  @xmlrpc.call(cmd, params)
55
59
  end # def call
56
60
 
@@ -72,7 +76,27 @@ module Bugzilla
72
76
 
73
77
  def cookie=(val)
74
78
  @xmlrpc.cookie = val
75
- end # def cookie
79
+ end # def cookie=
80
+
81
+ =begin rdoc
82
+
83
+ ==== Bugzilla::XMLRPC#token
84
+
85
+ =end
86
+
87
+ def token
88
+ @token
89
+ end # def token
90
+
91
+ =begin rdoc
92
+
93
+ ==== Bugzilla::XMLRPC#token=(val)
94
+
95
+ =end
96
+
97
+ def token=(val)
98
+ @token = val
99
+ end # def token=
76
100
 
77
101
  end # class XMLRPC
78
102
 
@@ -0,0 +1,100 @@
1
+ # xmlrpc.rb
2
+ # Copyright (C) 2010-2012 Red Hat, Inc.
3
+ #
4
+ # Authors:
5
+ # Akira TAGOH <tagoh@redhat.com>
6
+ #
7
+ # This library is free software: you can redistribute it and/or
8
+ # modify it under the terms of the GNU Lesser General Public
9
+ # License as published by the Free Software Foundation, either
10
+ # version 3 of the License, or (at your option) any later version.
11
+ #
12
+ # This library 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, see <http://www.gnu.org/licenses/>.
19
+
20
+ require 'xmlrpc/client'
21
+
22
+ module Bugzilla
23
+
24
+ =begin rdoc
25
+
26
+ === Bugzilla::XMLRPC
27
+
28
+ =end
29
+
30
+ class XMLRPC
31
+
32
+ =begin rdoc
33
+
34
+ ==== Bugzilla::XMLRPC#new(host, port = 443, path = '/xmlrpc.cgi', proxy_host = nil, proxy_port = nil)
35
+
36
+ =end
37
+
38
+ def initialize(host, port = 443, path = '/xmlrpc.cgi', proxy_host = nil, proxy_port = nil, timeout = 60, http_basic_auth_user = nil, http_basic_auth_pass = nil)
39
+ path ||= '/xmlrpc.cgi'
40
+ use_ssl = port == 443 ? true : false
41
+ @xmlrpc = ::XMLRPC::Client.new(host, path, port, proxy_host, proxy_port, http_basic_auth_user, http_basic_auth_pass, use_ssl, timeout)
42
+ end # def initialize
43
+
44
+ =begin rdoc
45
+
46
+ ==== Bugzilla::XMLRPC#call(cmd, params, user = nil, password = nil)
47
+
48
+ =end
49
+
50
+ def call(cmd, params = {}, user = nil, password = nil)
51
+ params = {} if params.nil?
52
+ params['Bugzilla_login'] = user unless user.nil? || password.nil?
53
+ params['Bugzilla_password'] = password unless user.nil? || password.nil?
54
+ params['Bugzilla_token'] = @token unless user.nil? || @token.nil?
55
+ @xmlrpc.call(cmd, params)
56
+ end # def call
57
+
58
+ =begin rdoc
59
+
60
+ ==== Bugzilla::XMLRPC#cookie
61
+
62
+ =end
63
+
64
+ def cookie
65
+ @xmlrpc.cookie
66
+ end # def cookie
67
+
68
+ =begin rdoc
69
+
70
+ ==== Bugzilla::XMLRPC#cookie=(val)
71
+
72
+ =end
73
+
74
+ def cookie=(val)
75
+ @xmlrpc.cookie = val
76
+ end # def cookie=
77
+
78
+ =begin rdoc
79
+
80
+ ==== Bugzilla::XMLRPC#token
81
+
82
+ =end
83
+
84
+ def token
85
+ @token
86
+ end # def token
87
+
88
+ =begin rdoc
89
+
90
+ ==== Bugzilla::XMLRPC#token=(val)
91
+
92
+ =end
93
+
94
+ def token=(val)
95
+ @token = val
96
+ end # def token=
97
+
98
+ end # class XMLRPC
99
+
100
+ end # module Bugzilla
@@ -70,12 +70,10 @@ module Bugzilla
70
70
  opts.delete(:summary)
71
71
  end
72
72
  if opts.include?(:cc) then
73
- i = 1
74
- opts[:cc].each do |e|
75
- opts[eval(":emailcc#{i}")] = 1
76
- opts[eval(":emailtype#{i}")] = :substring
77
- opts[eval(":email#{i}")] = e
78
- end
73
+ # CC should be parsed "any words" by default
74
+ opts[eval(":emailcc1")] = 1
75
+ opts[eval(":emailtype1")] = :anywordssubstr
76
+ opts[eval(":email1")] = opts[:cc]
79
77
  opts.delete(:cc)
80
78
  end
81
79
  if opts.include?(:creation_time) then
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-bugzilla
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
5
- prerelease:
4
+ version: 0.5.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Akira TAGOH
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-12-13 00:00:00.000000000 Z
11
+ date: 2014-09-17 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rspec
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
@@ -30,65 +27,57 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: gruff
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: highline
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: rmagick
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - '>='
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :runtime
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - '>='
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: bundler
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - '>='
84
74
  - !ruby/object:Gem::Version
85
75
  version: '1.0'
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - '>='
92
81
  - !ruby/object:Gem::Version
93
82
  version: '1.0'
94
83
  description: This aims to provide similar features to access to Bugzilla through WebService
@@ -101,13 +90,18 @@ extensions: []
101
90
  extra_rdoc_files: []
102
91
  files:
103
92
  - lib/bugzilla/version.rb
93
+ - lib/bugzilla/bugzilla.rb~
104
94
  - lib/bugzilla/product.rb
105
95
  - lib/bugzilla/skeleton.rb
106
96
  - lib/bugzilla/user.rb
107
97
  - lib/bugzilla/xmlrpc.rb
98
+ - lib/bugzilla/xmlrpc.rb~
99
+ - lib/bugzilla/skeleton.rb~
108
100
  - lib/bugzilla/group.rb
109
101
  - lib/bugzilla/plugin.rb
102
+ - lib/bugzilla/version.rb~
110
103
  - lib/bugzilla/bugzilla.rb
104
+ - lib/bugzilla/user.rb~
111
105
  - lib/bugzilla/classification.rb
112
106
  - lib/bugzilla/bug.rb
113
107
  - lib/bugzilla/api_tmpl.rb
@@ -116,28 +110,27 @@ files:
116
110
  - README.rdoc
117
111
  - COPYING
118
112
  - bin/bzconsole
119
- homepage: http://rubygems.org/ruby-bugzilla
113
+ homepage: http://rubygems.org/gems/ruby-bugzilla
120
114
  licenses: []
115
+ metadata: {}
121
116
  post_install_message:
122
117
  rdoc_options: []
123
118
  require_paths:
124
119
  - lib
125
120
  required_ruby_version: !ruby/object:Gem::Requirement
126
- none: false
127
121
  requirements:
128
- - - ! '>='
122
+ - - '>='
129
123
  - !ruby/object:Gem::Version
130
124
  version: '0'
131
125
  required_rubygems_version: !ruby/object:Gem::Requirement
132
- none: false
133
126
  requirements:
134
- - - ! '>='
127
+ - - '>='
135
128
  - !ruby/object:Gem::Version
136
129
  version: 1.3.6
137
130
  requirements: []
138
131
  rubyforge_project:
139
- rubygems_version: 1.8.24
132
+ rubygems_version: 2.1.11
140
133
  signing_key:
141
- specification_version: 3
134
+ specification_version: 4
142
135
  summary: Ruby binding for Bugzilla WebService APIs
143
136
  test_files: []