class Bugzilla::Product

Bugzilla::Product

Bugzilla::Product class is to access the Bugzilla::WebService::Product API that allows you to list the available Products and get information about them.

Public Instance Methods

accessible_products() click to toggle source

Bugzilla::Product#accessible_products

Returns Hash table for the products information that the user can search or enter bugs against. the Hash key is the product name and containing a Hash table which contains id, name, description, is_active, default_milestone, has_uncomfirmed, classification, components, versions and milestones. please see www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/Product.html#get for more details.

# File lib/bugzilla/product.rb, line 88
def accessible_products
  ids = get_accessible_products
  Hash[*get(ids)['products'].map {|x| [x['name'], x]}.flatten]
end
enterable_products() click to toggle source

Bugzilla::Product#enterable_products

Returns Hash table for the products information that the user can enter bugs against. the Hash key is the product name and containing a Hash table which contains id, name, description, is_active, default_milestone, has_uncomfirmed, classification, components, versions and milestones. please see www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/Product.html#get for more details.

# File lib/bugzilla/product.rb, line 69
def enterable_products
  ids = get_enterable_products
  Hash[*get(ids)['products'].map {|x| [x['name'], x]}.flatten]
end
selectable_products() click to toggle source

Bugzilla::Product#selectable_products

Returns Hash table for the products information that the user can search on. the Hash key is the product name and containing a Hash table which contains id, name, description, is_active, default_milestone, has_uncomfirmed, classification, components, versions and milestones. please see www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/Product.html#get for more details.

# File lib/bugzilla/product.rb, line 50
def selectable_products
  ids = get_selectable_products
  Hash[*get(ids)['products'].map {|x| [x['name'], x]}.flatten]
end

Protected Instance Methods

__create(cmd, *args) click to toggle source
# File lib/bugzilla/product.rb, line 179
def __create(cmd, *args)
  # FIXME
end
__update(cmd, *args) click to toggle source
# File lib/bugzilla/product.rb, line 183
def __update(cmd, *args)
  requires_version(cmd, 4.4)

  # FIXME
end
_get(cmd, ids, *args) click to toggle source
# File lib/bugzilla/product.rb, line 151
def _get(cmd, ids, *args)
  # This is still in experimental and apparently the behavior was changed since 4.2.
  # We don't keep the backward-compatibility and just require the proper version here.
  requires_version(cmd, 4.2)

  params = {}

  if ids.kind_of?(Hash) then
    raise ArgumentError, sprintf("Invalid parameter: %s", ids.inspect) unless ids.include?('ids') || ids.include?('names')
    params[:ids] = ids['ids'] || ids['names']
  elsif ids.kind_of?(Array) then
    r = ids.map {|x| x.kind_of?(Integer) ? x : nil}.compact
    if r.length != ids.length then
      params[:names] = ids
    else
      params[:ids] = ids
    end
  else
    if ids.kind_of?(Integer) then
      params[:ids] = [ids]
    else
      params[:names] = [ids]
    end
  end

  @iface.call(cmd, params)
end
_get_accessible_products(cmd, *args) click to toggle source
# File lib/bugzilla/product.rb, line 147
def _get_accessible_products(cmd, *args)
  @iface.call(cmd)
end
_get_enterable_products(cmd, *args) click to toggle source
# File lib/bugzilla/product.rb, line 143
def _get_enterable_products(cmd, *args)
  @iface.call(cmd)
end
_get_selectable_products(cmd, *args) click to toggle source

Bugzilla::Product#get(params)

Raw Bugzilla API to obtain a list of information about the products passed to it.

See www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/Product.html

# File lib/bugzilla/product.rb, line 139
def _get_selectable_products(cmd, *args)
  @iface.call(cmd)
end