Class: TicketMaster::Provider::Github::Comment
- Inherits:
-
Base::Comment
- Object
- Base::Comment
- TicketMaster::Provider::Github::Comment
- Defined in:
- lib/provider/comment.rb
Overview
The comment class for ticketmaster-github
Do any mapping between Ticketmaster and your system’s comment model here versions of the ticket.
Instance Attribute Summary collapse
-
#prefix_options ⇒ Object
Returns the value of attribute prefix_options.
Class Method Summary collapse
- .create(project_id, ticket_id, comment) ⇒ Object
-
.find(project_id, ticket_id) ⇒ Object
declare needed overloaded methods here.
Instance Method Summary collapse
- #created_at ⇒ Object
-
#initialize(*options) ⇒ Comment
constructor
A new instance of Comment.
- #updated_at ⇒ Object
Constructor Details
#initialize(*options) ⇒ Comment
Returns a new instance of Comment.
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/provider/comment.rb', line 11 def initialize(*) if .first.is_a? Hash object = .first @system_data = {:client => object} object[:author] = object['user'] object[:project_id] = [1] object[:ticket_id] = [2] super object end end |
Instance Attribute Details
#prefix_options ⇒ Object
Returns the value of attribute prefix_options.
9 10 11 |
# File 'lib/provider/comment.rb', line 9 def @prefix_options end |
Class Method Details
.create(project_id, ticket_id, comment) ⇒ Object
44 45 46 |
# File 'lib/provider/comment.rb', line 44 def self.create(project_id, ticket_id, comment) self.new TicketMaster::Provider::Github.api.add_comment("#{TicketMaster::Provider::Github.login}/#{project_id}", ticket_id, comment) end |
.find(project_id, ticket_id) ⇒ Object
declare needed overloaded methods here
40 41 42 |
# File 'lib/provider/comment.rb', line 40 def self.find(project_id, ticket_id) TicketMaster::Provider::Github.api.issue_comments("#{TicketMaster::Provider::Github.login}/#{project_id}", ticket_id).collect { |comment| self.new comment } end |
Instance Method Details
#created_at ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/provider/comment.rb', line 22 def created_at @created_at ||= begin Time.parse(self[:created_at]) rescue self[:created_at] end end |
#updated_at ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/provider/comment.rb', line 30 def updated_at @updated_at ||= begin Time.parse(self[:updated_at]) rescue self[:updated_at] end end |