Class: Zendesk2::TopicComment
- Inherits:
-
Object
- Object
- Zendesk2::TopicComment
- Extended by:
- Attributes
- Includes:
- Model
- Defined in:
- lib/zendesk2/topic_comment.rb
Instance Attribute Summary
Attributes included from Model
Instance Method Summary collapse
-
#attachments ⇒ Array
Attachments to this comment as Attachment objects.
-
#body ⇒ String
The comment body.
-
#created_at ⇒ Time
The time the topic_comment was created.
- #destroy! ⇒ Object
-
#id ⇒ Integer
Automatically assigned upon creation.
-
#informative ⇒ Boolean
If the comment has been flagged as informative.
- #reload ⇒ Object
- #save! ⇒ Object
-
#topic_id ⇒ Integer
The id of the topic this comment was made on.
-
#updated_at ⇒ Time
The time of the last update of the topic_comment.
-
#url ⇒ String
The API url of this topic comment.
-
#user_id ⇒ Integer
The id of the user making the topic comment.
Methods included from Attributes
assoc_accessor, assoc_reader, assoc_writer
Methods included from Model
#destroy, #destroyed?, #missing_attributes, #save, #update!
Instance Method Details
#attachments ⇒ Array
Returns Attachments to this comment as Attachment objects.
11 |
# File 'lib/zendesk2/topic_comment.rb', line 11 attribute :attachments, type: :array |
#body ⇒ String
Returns The comment body.
13 |
# File 'lib/zendesk2/topic_comment.rb', line 13 attribute :body, type: :string |
#created_at ⇒ Time
Returns The time the topic_comment was created.
15 |
# File 'lib/zendesk2/topic_comment.rb', line 15 attribute :created_at, type: :time |
#destroy! ⇒ Object
30 31 32 33 34 |
# File 'lib/zendesk2/topic_comment.rb', line 30 def destroy! requires :identity cistern.destroy_topic_comment('topic_comment' => { 'id' => identity, 'topic_id' => topic_id }) end |
#id ⇒ Integer
Returns Automatically assigned upon creation.
8 |
# File 'lib/zendesk2/topic_comment.rb', line 8 identity :id, type: :integer |
#informative ⇒ Boolean
Returns If the comment has been flagged as informative.
17 |
# File 'lib/zendesk2/topic_comment.rb', line 17 attribute :informative, type: :boolean |
#reload ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/zendesk2/topic_comment.rb', line 50 def reload requires :identity data = cistern.topic_comments('topic_id' => topic_id).get(identity) return unless data new_attributes = data.attributes merge_attributes(new_attributes) self end |
#save! ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/zendesk2/topic_comment.rb', line 36 def save! response = if new_record? requires :topic_id, :user_id, :body cistern.create_topic_comment('topic_comment' => attributes) else requires :identity cistern.update_topic_comment('topic_comment' => attributes) end merge_attributes(response.body['topic_comment']) end |
#topic_id ⇒ Integer
Returns The id of the topic this comment was made on.
19 |
# File 'lib/zendesk2/topic_comment.rb', line 19 attribute :topic_id, type: :integer |
#updated_at ⇒ Time
Returns The time of the last update of the topic_comment.
21 |
# File 'lib/zendesk2/topic_comment.rb', line 21 attribute :updated_at, type: :time |
#url ⇒ String
Returns The API url of this topic comment.
23 |
# File 'lib/zendesk2/topic_comment.rb', line 23 attribute :url, type: :string |
#user_id ⇒ Integer
Returns The id of the user making the topic comment.
25 |
# File 'lib/zendesk2/topic_comment.rb', line 25 attribute :user_id, type: :integer |