class Zendesk2::CreateHelpCenterArticle
Public Class Methods
accepted_attributes()
click to toggle source
# File lib/zendesk2/help_center/create_help_center_article.rb, line 16 def self.accepted_attributes %w( author_id body comments_disabled draft label_names locale position promoted section_id title user_segment_id permission_group_id ) end
Public Instance Methods
article_params()
click to toggle source
# File lib/zendesk2/help_center/create_help_center_article.rb, line 32 def article_params @_article_params ||= Cistern::Hash.slice(params.fetch('article'), *self.class.accepted_attributes) end
mock()
click to toggle source
# File lib/zendesk2/help_center/create_help_center_article.rb, line 40 def mock identity = cistern.serial_id locale = params['locale'] ||= 'en-us' position = data[:help_center_articles].values.select { |a| a['section_id'] == section_id }.size record = { 'id' => identity, 'url' => url_for("/help_center/#{locale}/articles/#{identity}.json"), 'html_url' => html_url_for("/hc/#{locale}/articles/#{identity}.json"), 'author_id' => cistern.current_user['id'], 'comments_disabled' => false, 'label_names' => [], 'draft' => false, 'promoted' => false, 'position' => position, 'vote_sum' => 0, 'vote_count' => 0, 'section_id' => section_id, 'created_at' => timestamp, 'updated_at' => timestamp, 'title' => '', 'body' => '', 'source_locale' => locale, 'outdated' => false, 'user_segment_id' => 0, 'permission_group_id' => 0, }.merge(article_params) data[:help_center_articles][identity] = record mock_response('article' => record) end
section_id()
click to toggle source
# File lib/zendesk2/help_center/create_help_center_article.rb, line 36 def section_id params.fetch('article').fetch('section_id') end