class Zendesk2::TopicComment

Public Instance Methods

destroy!() click to toggle source
# 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
reload() click to toggle source
# 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!() click to toggle source
# 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