Class: TicketMaster::Provider::Jira::Ticket

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

Overview

Ticket class for ticketmaster-jira

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*object) ⇒ Ticket

API = Jira::Ticket # The class to access the api’s tickets declare needed overloaded methods here



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

def initialize(*object)
  if object.first
    object = object.first
    unless object.is_a? Hash
      @system_data = {:client => object}
      hash = {:id => object.id.to_i, 
        :status => object.status,
        :priority => object.priority,
        :title => object.summary,
        :resolution => object.resolution,
        :created_at => object.created,
        :updated_at => object.updated,
        :description => object.description,
        :assignee => object.assignee,
        :requestor => object.reporter}
    else
      hash = object
    end
    super(hash)
  end
end

Class Method Details

.find_all(project_id) ⇒ Object



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

def self.find_all(project_id)
  $jira.getIssuesFromJqlSearch("project = #{project_id}", 200).map do |ticket|
    self.new ticket
  end
end

.find_by_attributes(project_id, attributes = {}) ⇒ Object



43
44
45
# File 'lib/provider/ticket.rb', line 43

def self.find_by_attributes(project_id, attributes = {})
  search_by_attribute(self.find_all(project_id), attributes)
end

.find_by_id(project_id, id) ⇒ Object



47
48
49
# File 'lib/provider/ticket.rb', line 47

def self.find_by_id(project_id, id)
  self.find_all(project_id).select { |ticket| ticket.id == id }.first
end

Instance Method Details

#comment(*options) ⇒ Object



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

def comment(*options)
  nil
end

#comments(*options) ⇒ Object



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

def comments(*options)
  Comment.find(self.id, options)
end

#created_atObject



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

def created_at
  normalize_datetime(self[:created_at])
end

#idObject



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

def id
  self[:id].to_i
end

#updated_atObject



35
36
37
# File 'lib/provider/ticket.rb', line 35

def updated_at
  normalize_datetime(self[:updated_at])
end