Sha256: 9ef551fbd3a7a1ff50683927b675477311a2a0c3a53418107d36d4cbf1516e99
Contents?: true
Size: 926 Bytes
Versions: 4
Compression:
Stored size: 926 Bytes
Contents
# frozen_string_literal: true class Zendesk2::CreateTopicComment include Zendesk2::Request request_method :post request_path { |r| "/topics/#{r.topic_id}/comments.json" } request_body { |r| { 'topic_comment' => r.topic_comment_params } } def self.accepted_attributes %w(user_id body informative) end def topic_id params.fetch('topic_comment').fetch('topic_id').to_i end def topic_comment_params Cistern::Hash.slice(params.fetch('topic_comment'), *self.class.accepted_attributes) end 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 end
Version data entries
4 entries across 4 versions & 1 rubygems