Class: TaskMapper::Provider::Zendesk::Ticket
- Inherits:
-
Base::Ticket
- Object
- Base::Ticket
- TaskMapper::Provider::Zendesk::Ticket
- Defined in:
- lib/provider/ticket.rb
Constant Summary collapse
- SEARCH_API =
declare needed overloaded methods here
ZendeskAPI::Search
- API =
ZendeskAPI::Ticket
- USER_API =
ZendeskAPI::User
Class Method Summary collapse
- .create(options) ⇒ Object
- .find_by_attributes(project_id, attributes = {}) ⇒ Object
- .find_by_id(project_id, ticket_id) ⇒ Object
- .search(project_id) ⇒ Object
Instance Method Summary collapse
- #created_at ⇒ Object
- #id ⇒ Object
-
#initialize(*object) ⇒ Ticket
constructor
A new instance of Ticket.
- #title ⇒ Object
- #updated_at ⇒ Object
Constructor Details
#initialize(*object) ⇒ Ticket
Returns a new instance of Ticket.
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/provider/ticket.rb', line 10 def initialize(*object) @system_data = {} @cache = {} first = object.shift case first when Hash super first.to_hash else @system_data[:client] = first super first.attributes end end |
Class Method Details
.create(options) ⇒ Object
56 57 58 |
# File 'lib/provider/ticket.rb', line 56 def create() super translate , {:title => :description} end |
.find_by_attributes(project_id, attributes = {}) ⇒ Object
52 53 54 |
# File 'lib/provider/ticket.rb', line 52 def find_by_attributes(project_id, attributes = {}) search_by_attribute(self.search(project_id), attributes) end |
.find_by_id(project_id, ticket_id) ⇒ Object
48 49 50 |
# File 'lib/provider/ticket.rb', line 48 def find_by_id(project_id, ticket_id) self.new zendesk_ticket(ticket_id).attributes.merge! :project_id => project_id end |
.search(project_id) ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/provider/ticket.rb', line 40 def search(project_id) SEARCH_API.find(:all, :params => {:query => "status:open"}).collect do |ticket| ticket.requester_id = requestor(ticket) ticket.assignee_id = assignee(ticket) self.new ticket.attributes.merge! :project_id => project_id end end |
Instance Method Details
#created_at ⇒ Object
31 32 33 |
# File 'lib/provider/ticket.rb', line 31 def created_at Time.parse(self[:created_at]) end |
#id ⇒ Object
23 24 25 |
# File 'lib/provider/ticket.rb', line 23 def id self.nice_id end |
#title ⇒ Object
27 28 29 |
# File 'lib/provider/ticket.rb', line 27 def title self.subject end |
#updated_at ⇒ Object
35 36 37 |
# File 'lib/provider/ticket.rb', line 35 def updated_at Time.parse(self[:updated_at]) end |