class Zendesk2::CreateHelpCenterPost

Public Class Methods

accepted_attributes() click to toggle source
# File lib/zendesk2/help_center/create_help_center_post.rb, line 9
def self.accepted_attributes
  %w(title details author_id topic_id pinned featured closed status created_at)
end

Public Instance Methods

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

  record = {
    'id'             => identity,
    'url'            => url_for("/community/posts/#{identity}.json"),
    'html_url'       => html_url_for("/hc/posts/#{identity}.json"),
    'created_at'     => timestamp,
    'updated_at'     => timestamp,
    'vote_count'     => 0,
    'vote_sum'       => 0,
    'comment_count'  => 0,
    'follower_count' => 0,
    'details'        => '',
  }.merge(post_params)

  data[:help_center_posts][identity] = record

  mock_response('post' => record)
end
post_params() click to toggle source
# File lib/zendesk2/help_center/create_help_center_post.rb, line 13
def post_params
  Cistern::Hash.slice(params.fetch('post'), *self.class.accepted_attributes)
end