Class: TicketSharing::Comment
- Inherits:
-
Base
- Object
- Base
- TicketSharing::Comment
show all
- Defined in:
- lib/ticket_sharing/comment.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#as_json, field_list, #field_list, fields, first_ancestor, #to_json
Constructor Details
#initialize(params = {}) ⇒ Comment
Returns a new instance of Comment.
11
12
13
14
15
16
17
18
19
|
# File 'lib/ticket_sharing/comment.rb', line 11
def initialize(params={})
self.public = true
super(params)
if Hash === author
self.author = Actor.new(author)
end
end
|
Class Method Details
.parse(json) ⇒ Object
21
22
23
24
|
# File 'lib/ticket_sharing/comment.rb', line 21
def self.parse(json)
attributes = JsonSupport.decode(json)
new(attributes)
end
|
Instance Method Details
#attachments=(attachments) ⇒ Object
30
31
32
33
34
|
# File 'lib/ticket_sharing/comment.rb', line 30
def attachments=(attachments)
@attachments = attachments && attachments.map do |attachment|
attachment.is_a?(Attachment) ? attachment : Attachment.new(attachment)
end
end
|
#authored_at=(value) ⇒ Object
26
27
28
|
# File 'lib/ticket_sharing/comment.rb', line 26
def authored_at=(value)
@authored_at = TicketSharing::Time.new(value)
end
|
#public? ⇒ Boolean
36
37
38
|
# File 'lib/ticket_sharing/comment.rb', line 36
def public?
self.public
end
|