ruby-bugzilla 0.6.1 → 0.6.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 70c304ab94d3415a420efdaa9e56db36cb6e97f1
4
- data.tar.gz: df4153ad143ca24560a2d9af0ce4c37a585abbfc
2
+ SHA256:
3
+ metadata.gz: e1012b784652144a7cb0701aa0d2de92a6d056eb916772bec125abdcc56924d1
4
+ data.tar.gz: c10985bfcd700e37d478cd9b633ba46dde66b9fa88099ba9e7b7c10675b1c6c1
5
5
  SHA512:
6
- metadata.gz: b39f1d7b94b245423c9683d947a8ea4bfcb5ec25084b75930daee6ff0f58271c246e495b5f55cde967bf783bb426301700d5770f09ef814d1429b33c83a157c3
7
- data.tar.gz: 1f24843f384cdf3764ee06392f2d73ba2064f858e576e39a3564863fe400f86ca4a58ae1229a7285cde8e203206e4f8b2b456a6a5934d483a7eed7f03c5032c8
6
+ metadata.gz: 87b36a0f8fdcd34c9497de14dc0be00c9c76447a9dc78f3438628c6de86b726ea8b8b3dc8eefc4c9df41405b7d5828dc06249c643dea49734bad8a3cd467f3af
7
+ data.tar.gz: 85f7a6175632a9ed6c0603ec0107de0e907954a66c6709e558f68d7b3a93ada1424e183d88d20f85f231f859b04ae44876b75d3cad4b585f42d31bab496b2be2
data/README.md CHANGED
@@ -1,17 +1,17 @@
1
- = Ruby binding for Bugzilla WebService APIs
1
+ # Ruby binding for Bugzilla WebService APIs #
2
2
 
3
3
  This aims to provide similar features in Ruby to access to Bugzilla
4
- through {WebService APIs}[http://www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService.html]. currently the following
4
+ through [WebService APIs](http://www.bugzilla.org/docs/tip/en/html/api/Bugzilla/webService.html). currently the following
5
5
  APIs are available:
6
6
 
7
- * Bugzilla::WebService::Bug[http://www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/Bug.html]
8
- * Bugzilla::WebService::Bugzilla[http://www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/Bugzilla.html]
9
- * Bugzilla::WebService::Classification[http://www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/Classification.html]
10
- * Bugzilla::WebService::Product[http://www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/Product.html]
11
- * Bugzilla::WebService::User[http://www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/User.html]
7
+ * [Bugzilla::WebService::Bug](http://www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/Bug.html)
8
+ * [Bugzilla::WebService::Bugzilla](http://www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/Bugzilla.html)
9
+ * [Bugzilla::WebService::Classification](http://www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/Classification.html)
10
+ * [Bugzilla::WebService::Product](http://www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/Product.html)
11
+ * [Bugzilla::WebService::User](http://www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/User.html)
12
12
 
13
13
 
14
- == bzconsole usage
14
+ ## bzconsole usage ##
15
15
 
16
16
  as example, in the bin directory, we have a tool named bzconsole. with that, you can login, search and get a bug. some examples:
17
17
 
@@ -38,17 +38,18 @@ get a specific bug:
38
38
  ````
39
39
  bzconsole getbug nvbz:889526
40
40
  ````
41
- == Copyright
41
+
42
+ ## Copyright ##
42
43
 
43
44
  Copyright (c) 2010-2014 Red Hat, Inc. See COPYING for details.
44
45
 
45
- == License
46
+ ## License ##
46
47
 
47
48
  This library is free software: you can redistribute it and/or
48
49
  modify it under the terms of the GNU Lesser General Public
49
50
  License as published by the Free Software Foundation, either
50
51
  version 3 of the License, or (at your option) any later version.
51
52
 
52
- == Authors
53
+ ## Authors ##
53
54
 
54
- Akira TAGOH
55
+ Akira TAGOH
data/bin/bzconsole CHANGED
@@ -333,8 +333,13 @@ module BzConsole
333
333
  end
334
334
 
335
335
  info = conf[prefix]
336
- login = info[:User].nil? ? ask("Bugzilla ID: ") : info[:User]
337
- pass = info[:Password].nil? ? ask("Bugzilla password: ") {|q| q.echo = false} : info[:Password]
336
+ if opts[:command][:anonymous] == true then
337
+ login = nil
338
+ pass = nil
339
+ else
340
+ login = info[:User].nil? ? ask("Bugzilla ID: ") : info[:User]
341
+ pass = info[:Password].nil? ? ask("Bugzilla password: ") {|q| q.echo = false} : info[:Password]
342
+ end
338
343
 
339
344
  xmlrpc,host = get_xmlrpc(conf[prefix],opts) do |h|
340
345
  @plugin.run(:pre, h, :getbug, opts)
@@ -388,7 +393,7 @@ module BzConsole
388
393
  parser.on('--platform=PLATFORMS', 'filter out the result by the platform') {|v| opts[:query][:platform] ||= []; opts[:query][:platform].push(*v.split(','))}
389
394
  parser.on('--priority=PRIORITY', 'filter out the result by the priority') {|v| opts[:query][:priority] ||= []; opts[:query][:priority].push(*v.split(','))}
390
395
  parser.on('-p', '--product=PRODUCTS', 'filter out the result by the specific products') {|v| opts[:query][:product] ||= []; opts[:query][:product].push(*v.split(','))}
391
- parser.on('--resolution=RESOLUSIONS', 'filter out the result by the resolusions') {|v| opts[:query][:resolution] ||= []; opts[:query][:resolusion].push(*v.split(','))}
396
+ parser.on('--resolution=RESOLUTIONS', 'filter out the result by the resolutions') {|v| opts[:query][:resolution] ||= []; opts[:query][:resolution].push(*v.split(','))}
392
397
  parser.on('--severity=SEVERITY', 'filter out the result by the severity') {|v| opts[:query][:severity] ||= []; opts[:query][:severity].push(*v.split(','))}
393
398
  parser.on('-s', '--status=STATUSES', 'filter out the result by the status') {|v| opts[:query][:status] ||= []; opts[:query][:status].push(*v.split(','))}
394
399
  parser.on('--summary=SUMMARY', 'filter out the result by the summary') {|v| opts[:query][:summary] ||= []; opts[:query][:summary] << v}
@@ -446,8 +451,13 @@ module BzConsole
446
451
  host = uri.host
447
452
  port = uri.port
448
453
  path = uri.path.empty? ? nil : uri.path
449
- login = opts[:command][:anonymous] == true ? nil : info[:User]
450
- pass = opts[:command][:anonymous] == true ? nil : info[:Password]
454
+ if opts[:command][:anonymous] == true then
455
+ login = nil
456
+ pass = nil
457
+ else
458
+ login = info[:User].nil? ? ask("Bugzilla ID: ") : info[:User]
459
+ pass = info[:Password].nil? ? ask("Bugzilla password: ") {|q| q.echo = false} : info[:Password]
460
+ end
451
461
  proxy_host, proxy_port = get_proxy(info)
452
462
  timeout = opts[:timeout].nil? ? 60 : opts[:timeout]
453
463
 
@@ -525,8 +535,13 @@ module BzConsole
525
535
  host = uri.host
526
536
  port = uri.port
527
537
  path = uri.path.empty? ? nil : uri.path
528
- login = opts[:command][:anonymous] == true ? nil : info[:User]
529
- pass = opts[:command][:anonymous] == true ? nil : info[:Password]
538
+ if opts[:command][:anonymous] == true then
539
+ login = nil
540
+ pass = nil
541
+ else
542
+ login = info[:User].nil? ? ask("Bugzilla ID: ") : info[:User]
543
+ pass = info[:Password].nil? ? ask("Bugzilla password: ") {|q| q.echo = false} : info[:Password]
544
+ end
530
545
  proxy_host, proxy_port = get_proxy(info)
531
546
  timeout = opts[:timeout].nil? ? 60 : opts[:timeout]
532
547
 
@@ -686,8 +701,13 @@ module BzConsole
686
701
  end
687
702
 
688
703
  info = conf[prefix]
689
- login = info[:User].nil? ? ask("Bugzilla ID: ") : info[:User]
690
- pass = info[:Password].nil? ? ask("Bugzilla password: ") {|q| q.echo = false} : info[:Password]
704
+ if opts[:command][:anonymous] == true then
705
+ login = nil
706
+ pass = nil
707
+ else
708
+ login = info[:User].nil? ? ask("Bugzilla ID: ") : info[:User]
709
+ pass = info[:Password].nil? ? ask("Bugzilla password: ") {|q| q.echo = false} : info[:Password]
710
+ end
691
711
 
692
712
 
693
713
  xmlrpc,host = get_xmlrpc(conf[prefix],opts)
@@ -865,8 +885,8 @@ module BzConsole
865
885
  host = uri.host
866
886
  port = uri.port
867
887
  path = uri.path.empty? ? nil : uri.path
868
- login = opts[:command][:anonymous] == true ? nil : info[:User]
869
- pass = opts[:command][:anonymous] == true ? nil : info[:Password]
888
+ login = info[:User].nil? ? ask("Bugzilla ID: ") : info[:User]
889
+ pass = info[:Password].nil? ? ask("Bugzilla password: ") {|q| q.echo = false} : info[:Password]
870
890
  proxy_host, proxy_port = get_proxy(info)
871
891
  timeout = opts[:timeout].nil? ? 60 : opts[:timeout]
872
892
 
@@ -979,8 +999,13 @@ module BzConsole
979
999
  end
980
1000
 
981
1001
  info = conf[prefix]
982
- login = info[:User].nil? ? ask("Bugzilla ID: ") : info[:User]
983
- pass = info[:Password].nil? ? ask("Bugzilla password: ") {|q| q.echo = false} : info[:Password]
1002
+ if opts[:command][:anonymous] == true then
1003
+ login = nil
1004
+ pass = nil
1005
+ else
1006
+ login = info[:User].nil? ? ask("Bugzilla ID: ") : info[:User]
1007
+ pass = info[:Password].nil? ? ask("Bugzilla password: ") {|q| q.echo = false} : info[:Password]
1008
+ end
984
1009
 
985
1010
  xmlrpc, host = get_xmlrpc(conf[prefix], opts)
986
1011
  user = Bugzilla::User.new(xmlrpc)
data/lib/bugzilla/bug.rb CHANGED
@@ -119,7 +119,19 @@ actually deprecated.
119
119
  result = comments(params)
120
120
 
121
121
  # not supporting comment_ids. so drop "comments".
122
- result['bugs']
122
+ ret = result['bugs']
123
+ # creation_time was added in Bugzilla 4.4. copy the 'time' value to creation_time if not available for compatibility.
124
+ unless check_version(4.4)[0] then
125
+ ret.each do |id, o|
126
+ o['comments'].each do |c|
127
+ unless c.include?('creation_time') then
128
+ c['creation_time'] = c['time']
129
+ end
130
+ end
131
+ end
132
+ end
133
+
134
+ ret
123
135
  end # def get_comments
124
136
 
125
137
  =begin rdoc
@@ -46,7 +46,7 @@ Bugzilla version that is running on.
46
46
  v = version
47
47
  f = false
48
48
  if v.kind_of?(Hash) && v.include?("version") &&
49
- v['version'] >= "#{version_}" then
49
+ Gem::Version.new(v['version']) >= Gem::Version.new("#{version_}") then
50
50
  f = true
51
51
  end
52
52
 
data/lib/bugzilla/user.rb CHANGED
@@ -43,14 +43,21 @@ Keeps the bugzilla session during doing something in the block.
43
43
  =end
44
44
 
45
45
  def session(user, password)
46
- r = check_version('4.4.3')
47
- key = :cookie
46
+ r = check_version('5.0.0')
47
+
48
48
  if r[0] then
49
- # Usisng tokens
50
- key = :token
51
- fname = File.join(ENV['HOME'], '.ruby-bugzilla-token.yml')
49
+ key = :api_key
50
+ fname = File.join(ENV['HOME'], '.ruby-bugzilla-api.yml')
52
51
  else
53
- fname = File.join(ENV['HOME'], '.ruby-bugzilla-cookie.yml')
52
+ r = check_version('4.4.3')
53
+
54
+ if r[0] then
55
+ key = :token
56
+ fname = File.join(ENV['HOME'], '.ruby-bugzilla-token.yml')
57
+ else
58
+ key = :cookie
59
+ fname = File.join(ENV['HOME'], '.ruby-bugzilla-cookie.yml')
60
+ end
54
61
  end
55
62
  host = @iface.instance_variable_get(:@xmlrpc).instance_variable_get(:@host)
56
63
  val = nil
@@ -62,12 +69,12 @@ Keeps the bugzilla session during doing something in the block.
62
69
  conf = {}
63
70
  end
64
71
  if !val.nil? then
65
- if key == :token then
66
- print "Using token\n"
72
+ if key == :api_key then
73
+ @iface.api_key = val
74
+ elsif key == :token then
67
75
  @iface.token = val
68
76
  else
69
- print "Using cookie\n"
70
- @iface.cookie = cookie
77
+ @iface.cookie = val
71
78
  end
72
79
  yield
73
80
  elsif user.nil? || password.nil? then
@@ -26,6 +26,6 @@
26
26
 
27
27
  module Bugzilla
28
28
 
29
- VERSION = "0.6.1"
29
+ VERSION = "0.6.5"
30
30
 
31
31
  end # module Bugzilla
@@ -55,6 +55,7 @@ module Bugzilla
55
55
  params['Bugzilla_login'] = user unless user.nil? || password.nil?
56
56
  params['Bugzilla_password'] = password unless user.nil? || password.nil?
57
57
  params['Bugzilla_token'] = @token unless @token.nil?
58
+ @xmlrpc.http_header_extra['Authorization'] = "Bearer #{@api_key}" unless @api_key.nil?
58
59
  @xmlrpc.call(cmd, params)
59
60
  end # def call
60
61
 
@@ -98,6 +99,26 @@ module Bugzilla
98
99
  @token = val
99
100
  end # def token=
100
101
 
102
+ =begin rdoc
103
+
104
+ ==== Bugzilla::XMLRPC#api_key
105
+
106
+ =end
107
+
108
+ def api_key
109
+ @api_key
110
+ end # def
111
+
112
+ =begin rdoc
113
+
114
+ ==== Bugzilla::XMLRPC#api_key=(val)
115
+
116
+ =end
117
+
118
+ def api_key=(val)
119
+ @api_key = val
120
+ end # def
121
+
101
122
  end # class XMLRPC
102
123
 
103
124
  end # module Bugzilla
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-bugzilla
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Akira TAGOH
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-08 00:00:00.000000000 Z
11
+ date: 2022-01-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -42,28 +42,14 @@ dependencies:
42
42
  name: highline
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: rmagick
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :runtime
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
52
+ - - ">="
67
53
  - !ruby/object:Gem::Version
68
54
  version: '0'
69
55
  - !ruby/object:Gem::Dependency
@@ -110,7 +96,7 @@ homepage: http://rubygems.org/gems/ruby-bugzilla
110
96
  licenses:
111
97
  - LGPL-3.0+
112
98
  metadata: {}
113
- post_install_message:
99
+ post_install_message:
114
100
  rdoc_options: []
115
101
  require_paths:
116
102
  - lib
@@ -125,9 +111,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
125
111
  - !ruby/object:Gem::Version
126
112
  version: 1.3.6
127
113
  requirements: []
128
- rubyforge_project:
129
- rubygems_version: 2.2.2
130
- signing_key:
114
+ rubygems_version: 3.2.32
115
+ signing_key:
131
116
  specification_version: 4
132
117
  summary: Ruby binding for Bugzilla WebService APIs
133
118
  test_files: []