Sha256: 886fe3a0b5a0c9f0c3b5a291b5397a59fe92407182580e844cf74ea126f641db
Contents?: true
Size: 1.32 KB
Versions: 4
Compression:
Stored size: 1.32 KB
Contents
# frozen_string_literal: true class Zendesk2::CreateHelpCenterTranslation include Zendesk2::Request include Zendesk2::HelpCenter::TranslationSource::Request request_method :post request_path { |r| "/help_center/#{r.source_type_url}/#{r.source_id}/translations/#{r.locale}.json" } request_body { |r| { 'translation' => r.translation_params } } def self.accepted_attributes %w(locale title body outdated draft) end def translation_params Cistern::Hash.slice(params.fetch('translation'), *self.class.accepted_attributes) end def mock identity = cistern.serial_id record = { 'id' => identity, 'url' => url_for("/help_center/#{source_type_url}/#{source_id}/translation/#{locale}.json"), 'html_url' => html_url_for("/hc/#{locale}/#{source_type_url}/#{source_id}"), 'created_at' => timestamp, 'updated_at' => timestamp, 'title' => params.fetch('translation').fetch('title'), 'body' => (params.fetch('translation')['body'] || ''), 'outdated' => false, 'draft' => false, 'locale' => locale, }.merge(translation_params) cistern.data[:help_center_translations][mock_translation_key] = record mock_response('translation' => record) end end
Version data entries
4 entries across 4 versions & 1 rubygems