Class: Rubyzilla::Product

Inherits:
Object
  • Object
show all
Defined in:
lib/rubyzilla/product.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id) ⇒ Product

Returns a new instance of Product.



5
6
7
8
9
# File 'lib/rubyzilla/product.rb', line 5

def initialize id
  product = Bugzilla.server.call("Product.get_products", {:ids => [id]})
  @id = id
  @name = product["products"][0]["name"]
end

Instance Attribute Details

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/rubyzilla/product.rb', line 3

def id
  @id
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/rubyzilla/product.rb', line 3

def name
  @name
end

Class Method Details

.list(s = "accessible") ⇒ Object

accessible, enterable, selectable



12
13
14
15
16
17
18
19
20
# File 'lib/rubyzilla/product.rb', line 12

def self.list s="accessible"
  product_list = Array.new
  
  product_ids =
    Bugzilla.server.call("Product.get_#{s}_products")["ids"]
    
  product_ids.map {|id| product_list << Product.new(id)}
  return product_list
end

Instance Method Details

#componentsObject



22
23
24
25
26
27
# File 'lib/rubyzilla/product.rb', line 22

def components
  result = Bugzilla.server.call("Bug.legal_values", {
    :field => 'component', :product_id => @id
  })
  return result["values"]
end

#milestonesObject



29
30
31
32
33
34
# File 'lib/rubyzilla/product.rb', line 29

def milestones
  result = Bugzilla.server.call("Bug.legal_values", {
    :field => 'target_milestone', :product_id => @id
  })
  result["values"]
end

#to_sObject



43
44
45
# File 'lib/rubyzilla/product.rb', line 43

def to_s
  @name
end

#versionsObject



36
37
38
39
40
41
# File 'lib/rubyzilla/product.rb', line 36

def versions
  result = Bugzilla.server.call("Bug.legal_values", {
    :field => 'version', :product_id => @id
  })
  result["values"]
end