class Zendesk2::CreateTopicComment

Public Class Methods

accepted_attributes() click to toggle source
# File lib/zendesk2/create_topic_comment.rb, line 9
def self.accepted_attributes
  %w(user_id body informative)
end

Public Instance Methods

mock() click to toggle source
# File lib/zendesk2/create_topic_comment.rb, line 21
def mock
  identity = cistern.serial_id

  record = {
    'id'         => identity,
    'url'        => url_for("/topics/#{topic_id}/comments/#{identity}.json"),
    'created_at' => timestamp,
    'updated_at' => timestamp,
    'topic_id'   => topic_id,
  }.merge(topic_comment_params)

  data[:topic_comments][identity] = record

  mock_response('topic_comment' => record)
end
topic_comment_params() click to toggle source
# File lib/zendesk2/create_topic_comment.rb, line 17
def topic_comment_params
  Cistern::Hash.slice(params.fetch('topic_comment'), *self.class.accepted_attributes)
end
topic_id() click to toggle source
# File lib/zendesk2/create_topic_comment.rb, line 13
def topic_id
  params.fetch('topic_comment').fetch('topic_id').to_i
end