Class: Bugzilla::XMLRPC

Inherits:
Object
  • Object
show all
Defined in:
lib/bugzilla/xmlrpc.rb

Overview

Bugzilla::XMLRPC

Instance Method Summary collapse

Constructor Details

#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) ⇒ XMLRPC

Bugzilla::XMLRPC#new(host, port = 443, path = ‘/xmlrpc.cgi’, proxy_host = nil, proxy_port = nil)



38
39
40
41
42
43
44
45
# File 'lib/bugzilla/xmlrpc.rb', line 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)
  path ||= '/xmlrpc.cgi'
  use_ssl = port == 443 ? true : false
  @xmlrpc = ::XMLRPC::Client.new(host, path, port, proxy_host, proxy_port, http_basic_auth_user, http_basic_auth_pass, use_ssl, timeout)

  # workaround for https://bugs.ruby-lang.org/issues/8182
  @xmlrpc.http_header_extra = {'accept-encoding' => 'identity'}
end

Instance Method Details

#call(cmd, params = {}, user = nil, password = nil) ⇒ Object

Bugzilla::XMLRPC#call(cmd, params, user = nil, password = nil)



53
54
55
56
57
58
59
# File 'lib/bugzilla/xmlrpc.rb', line 53

def call(cmd, params = {}, user = nil, password = nil)
  params = {} if params.nil?
  params['Bugzilla_login'] = user unless user.nil? || password.nil?
  params['Bugzilla_password'] = password unless user.nil? || password.nil?
  params['Bugzilla_token'] = @token unless @token.nil?
  @xmlrpc.call(cmd, params)
end

Bugzilla::XMLRPC#cookie



67
68
69
# File 'lib/bugzilla/xmlrpc.rb', line 67

def cookie
  @xmlrpc.cookie
end

#cookie=(val) ⇒ Object

Bugzilla::XMLRPC#cookie=(val)



77
78
79
# File 'lib/bugzilla/xmlrpc.rb', line 77

def cookie=(val)
  @xmlrpc.cookie = val
end

#tokenObject

Bugzilla::XMLRPC#token



87
88
89
# File 'lib/bugzilla/xmlrpc.rb', line 87

def token
  @token
end

#token=(val) ⇒ Object

Bugzilla::XMLRPC#token=(val)



97
98
99
# File 'lib/bugzilla/xmlrpc.rb', line 97

def token=(val)
  @token = val
end