Class: TicketMaster::Provider::Bugherd::Ticket

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

Overview

Ticket class for ticketmaster-bugherd

Constant Summary collapse

API =

The class to access the api’s tickets

BugherdAPI::Task
STATUS =
%w{new todo active declined fixed closed}
PRIORITY =
%w{- critical important normal minor}

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.search(project_id, options = {}, limit = 1000) ⇒ Object



31
32
33
34
35
# File 'lib/provider/ticket.rb', line 31

def self.search(project_id, options = {}, limit = 1000)
  API.find(:all, :params => {:project_id => project_id}).collect do |task|
    self.new task
  end
end

Instance Method Details

#assigneeObject



20
21
22
23
24
25
# File 'lib/provider/ticket.rb', line 20

def assignee
  user = BugherdAPI::User.find(:all).select do |user|
    user.id == self[:assigned_to_id]
  end.first
  "#{user.name} #{user.surname}"
end

#comments(*options) ⇒ Object



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

def comments(*options)
  warn "Bugherd API doesn't support comments"
  []
end

#priorityObject



16
17
18
# File 'lib/provider/ticket.rb', line 16

def priority
  PRIORITY[self[:priority_id]]
end

#project_idObject



27
28
29
# File 'lib/provider/ticket.rb', line 27

def project_id
  self.prefix_options[:project_id]
end

#statusObject

declare needed overloaded methods here



12
13
14
# File 'lib/provider/ticket.rb', line 12

def status
  STATUS[self[:status_id]]
end