Class: TicketMaster::Provider::Trac::Ticket

Inherits:
Base::Ticket
  • Object
show all
Defined in:
lib/provider/ticket.rb

Overview

Ticket class for ticketmaster-yoursystem

Constant Summary collapse

API =

declare needed overloaded methods here

TracAPI

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*object) ⇒ Ticket

Returns a new instance of Ticket.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/provider/ticket.rb', line 10

def initialize(*object)
  if object.first
    object = object.first
    unless object.is_a? Hash
      @system_data = {:client => object}
      hash = {:id => object.id,
        :severity => object.severity,
        :milestone => object.milestone,
        :status => object.status,
        :type => object.type, 
        :priority => object.priority,
        :version => object.version,
        :reporter => object.reporter,
        :owner => object.owner,
        :cc => object.cc,
        :summary => object.summary,
        :description => object.description,
        :keywords => object.keywords,
        :created_at => object.created_at,
        :updated_at => object.updated_at}
    else
      hash = object
    end
    super(hash)
  end
end

Class Method Details

.create(*options) ⇒ Object



41
42
43
44
45
46
47
48
49
50
# File 'lib/provider/ticket.rb', line 41

def self.create(*options)
  mandatory = options.shift
  attributes = {}
  attributes ||= options.shift
  begin
    self.find_by_id API.api.tickets.create(mandatory[:summary], mandatory[:description], attributes)
  rescue
    self
  end
end

.find_by_id(id) ⇒ Object



37
38
39
# File 'lib/provider/ticket.rb', line 37

def self.find_by_id(id)
  self.new API.api.tickets.get id
end

Instance Method Details

#commentObject



57
58
59
60
# File 'lib/provider/ticket.rb', line 57

def comment
  warn "Trac doesn't support comments"
  nil
end

#comment!Object



62
63
64
65
# File 'lib/provider/ticket.rb', line 62

def comment!
  warn "Trac doesn't support comments"
  [] 
end

#commentsObject



52
53
54
55
# File 'lib/provider/ticket.rb', line 52

def comments
  warn "Trac doesn't support comments"
  []
end