class Rodzilla::WebService

Attributes

base_url[RW]
format[RW]
options[RW]
resource[RW]

Public Class Methods

new(base_url, username, password, format=:json, options={}) click to toggle source

base_url - The String full uri of the Bugzilla api server username - The String containing the bugzilla authorized users username password - The String containing the bugzilla authorized users password format - The request/response format which defaults to :json

# File lib/rodzilla/web_service.rb, line 10
def initialize(base_url, username, password, format=:json, options={})
  @base_url     = base_url
  @username     = username
  @password     = password
  @format       = format
  @options      = options || {}
end

Public Instance Methods

bugs() click to toggle source

Provide a shortcut for instantiation Bug objects

Returns an instance of the Rodzilla::Resource::Bug class

# File lib/rodzilla/web_service.rb, line 21
def bugs
  bugzilla_resource('Bug')
end
bugzilla() click to toggle source

Provide a shortcut for instantiation Bugzilla objects

Returns an instance of the Rodzilla::Resource::Bugzilla class

# File lib/rodzilla/web_service.rb, line 28
def bugzilla
  bugzilla_resource('Bugzilla')
end
classifications() click to toggle source

Provide a shortcut for instantiation Classification objects

Returns an instance of the Rodzilla::Resource::Classification class

# File lib/rodzilla/web_service.rb, line 35
def classifications
  bugzilla_resource('Classification')
end
groups() click to toggle source

Provide a shortcut for instantiation Group objects

Returns an instance of the Rodzilla::Resource::Group class

# File lib/rodzilla/web_service.rb, line 42
def groups
  bugzilla_resource('Group')
end
products() click to toggle source

Provide a shortcut for instantiation Product objects

Returns an instance of the Rodzilla::Resource::Product class

# File lib/rodzilla/web_service.rb, line 49
def products
  bugzilla_resource('Product')
end
users() click to toggle source

Provide a shortcut for instantiation User objects

Returns an instance of the Rodzilla::Resource::User class

# File lib/rodzilla/web_service.rb, line 56
def users
  bugzilla_resource('User')
end

Protected Instance Methods

bugzilla_resource(resource) click to toggle source
# File lib/rodzilla/web_service.rb, line 60
def bugzilla_resource(resource)
  raise Rodzilla::Error::ResourceNotFoundError, "Error: Rodzilla::Resource::#{resource} does not exist." unless Rodzilla::Resource.constants.include?(resource.to_sym)
  @resource = Object.module_eval("Rodzilla::Resource::#{resource}").new(@base_url, @username, @password, @format)
  @resource.service.options = self.options if self.options
  @resource
end