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.
Constant Summary collapse
- API =
GithubComment
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_by_attributes(project_id, ticket_id, attributes = {}) ⇒ Object
-
.find_by_id(project_id, ticket_id, id) ⇒ Object
declare needed overloaded methods here.
- .search(project_id, ticket_id, options = {}, limit = 1000) ⇒ Object
Instance Method Summary collapse
- #created_at ⇒ Object
-
#initialize(*options) ⇒ Comment
constructor
A new instance of Comment.
Constructor Details
#initialize(*options) ⇒ Comment
Returns a new instance of Comment.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/provider/comment.rb', line 12 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
53 54 55 |
# File 'lib/provider/comment.rb', line 53 def self.create(project_id, ticket_id, comment) self.new self::API.create(Project.find(:first, [project_id]), ticket_id, comment) end |
.find_by_attributes(project_id, ticket_id, attributes = {}) ⇒ Object
44 45 46 47 |
# File 'lib/provider/comment.rb', line 44 def self.find_by_attributes(project_id, ticket_id, attributes = {}) warn "Github API only gets all comments" self::API.find_all(Project.find(:first, [project_id]), ticket_id).collect {|comment| self.new comment, project_id, ticket_id} end |
.find_by_id(project_id, ticket_id, id) ⇒ Object
declare needed overloaded methods here
40 41 42 |
# File 'lib/provider/comment.rb', line 40 def self.find_by_id(project_id, ticket_id, id) warn "This method is not supported by Github's API" end |
.search(project_id, ticket_id, options = {}, limit = 1000) ⇒ Object
49 50 51 |
# File 'lib/provider/comment.rb', line 49 def self.search(project_id, ticket_id, = {}, limit = 1000) warn "This method is not supported by Github's API" end |
Instance Method Details
#created_at ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/provider/comment.rb', line 23 def created_at @created_at ||= begin Time.parse(self[:created_at]) rescue self[:created_at] end end |