Class: TicketMaster::Provider::Kanbanpad::Comment
- Inherits:
-
Base::Comment
- Object
- Base::Comment
- TicketMaster::Provider::Kanbanpad::Comment
- Defined in:
- lib/provider/comment.rb
Overview
The comment class for ticketmaster-kanbanpad
Do any mapping between Ticketmaster and your system’s comment model here versions of the ticket.
Not supported by Kanbanpad API
Constant Summary collapse
- API =
declare needed overloaded methods here
KanbanpadAPI::TaskComment
Class Method Summary collapse
- .create(project_id, ticket_id, step_id, *options) ⇒ Object
- .find_by_attributes(project_id, ticket_id, attributes = {}) ⇒ Object
- .find_by_id(project_id, ticket_id, id) ⇒ Object
- .search(project_id, ticket_id, options = {}, limit = 1000) ⇒ Object
Instance Method Summary collapse
- #created_at ⇒ Object
-
#initialize(*object) ⇒ Comment
constructor
A new instance of Comment.
- #updated_at ⇒ Object
Constructor Details
#initialize(*object) ⇒ Comment
Returns a new instance of Comment.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/provider/comment.rb', line 13 def initialize(*object) if object.first object = object.first unless object.is_a? Hash hash = {:id => object.id, :author => object., :body => object.body, :created_at => object.created_at, :updated_at => object.updated_at} else hash = object end super hash end end |
Class Method Details
.create(project_id, ticket_id, step_id, *options) ⇒ Object
57 58 59 60 61 62 63 64 65 |
# File 'lib/provider/comment.rb', line 57 def self.create(project_id, ticket_id, step_id, *) .first.merge!( :project_id => project_id, :task_id => ticket_id, :step_id => step_id) task_comment = KanbanpadAPI::TaskCommentCreator.new(.first) task_comment.save self.new task_comment end |
.find_by_attributes(project_id, ticket_id, attributes = {}) ⇒ Object
33 34 35 |
# File 'lib/provider/comment.rb', line 33 def self.find_by_attributes(project_id, ticket_id, attributes = {}) search_by_attribute(self.search(project_id, ticket_id), attributes) end |
.find_by_id(project_id, ticket_id, id) ⇒ Object
29 30 31 |
# File 'lib/provider/comment.rb', line 29 def self.find_by_id(project_id, ticket_id, id) self.search(project_id, ticket_id).select { |ticket| ticket.id == id }.first end |
.search(project_id, ticket_id, options = {}, limit = 1000) ⇒ Object
37 38 39 |
# File 'lib/provider/comment.rb', line 37 def self.search(project_id, ticket_id, = {}, limit = 1000) comments = API.find(:all, :params => {:project_id => project_id, :task_id => ticket_id}).collect { |comment| self.new comment } end |
Instance Method Details
#created_at ⇒ Object
49 50 51 52 53 54 55 |
# File 'lib/provider/comment.rb', line 49 def created_at @updated_at ||= begin Time.parse(self[:created_at]) rescue self[:created_at] end end |
#updated_at ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/provider/comment.rb', line 41 def updated_at @updated_at ||= begin Time.parse(self[:updated_at]) rescue self[:updated_at] end end |