Class: TicketMaster::Provider::Teambox::Comment
- Inherits:
-
Base::Comment
- Object
- Base::Comment
- TicketMaster::Provider::Teambox::Comment
- Defined in:
- lib/provider/comment.rb
Overview
The comment class for ticketmaster-teambox
Do any mapping between Ticketmaster and your system’s comment model here versions of the ticket.
Constant Summary collapse
- API =
The class to access the api’s comments
TeamboxAPI::Comment
Class Method Summary collapse
- .find_by_attributes(project_id, task_id, attributes = {}) ⇒ Object
- .find_by_id(project_id, task_id, id) ⇒ Object
- .search(project_id, task_id, options = {}, limit = 1000) ⇒ Object
Instance Method Summary collapse
- #created_at ⇒ Object
-
#initialize(*object) ⇒ Comment
constructor
declare needed overloaded methods here.
- #updated_at ⇒ Object
Constructor Details
#initialize(*object) ⇒ Comment
declare needed overloaded methods here
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/provider/comment.rb', line 12 def initialize(*object) if object.first object = object.first @system_data = {:client => object} unless object.is_a? Hash hash = {:body => object.body, :user_id => object.user_id, :target_id => object.target_id, :created_at => object.created_at, :updated_at => object.updated_at, :id => object.id, :project_id => object.[:project_id]} else hash = object end super hash end end |
Class Method Details
.find_by_attributes(project_id, task_id, attributes = {}) ⇒ Object
36 37 38 |
# File 'lib/provider/comment.rb', line 36 def self.find_by_attributes(project_id, task_id, attributes = {}) search_by_attribute(self.search(project_id, task_id), attributes) end |
.find_by_id(project_id, task_id, id) ⇒ Object
32 33 34 |
# File 'lib/provider/comment.rb', line 32 def self.find_by_id(project_id, task_id, id) self.search(project_id, task_id).select { |task| task.id == id }.first end |
.search(project_id, task_id, options = {}, limit = 1000) ⇒ Object
40 41 42 |
# File 'lib/provider/comment.rb', line 40 def self.search(project_id, task_id, = {}, limit = 1000) comments = API.find(:all, :params => {:project_id => project_id, :task_id => task_id, :count => 0}).collect { |comment| self.new comment } end |
Instance Method Details
#created_at ⇒ Object
52 53 54 55 56 57 58 |
# File 'lib/provider/comment.rb', line 52 def created_at @updated_at ||= begin Time.parse(self[:created_at]) rescue self[:created_at] end end |
#updated_at ⇒ Object
44 45 46 47 48 49 50 |
# File 'lib/provider/comment.rb', line 44 def updated_at @updated_at ||= begin Time.parse(self[:updated_at]) rescue self[:updated_at] end end |