module Zendesk2::HelpCenter::TranslationSource::Request

allow requests to read common pieces of information about the translation source

Public Instance Methods

locale() click to toggle source
# File lib/zendesk2/help_center/translation_source.rb, line 38
def locale
  (params['translation'] || params).fetch('locale') || 'en-us'
end
mock_translation_key() click to toggle source

Since Zendesk2::Request#find! calls .to_i on hash keys, we need an integer key for this.

# File lib/zendesk2/help_center/translation_source.rb, line 44
def mock_translation_key
  [source_type, source_id, locale].join('-').each_byte.reduce(0) { |a, e| a + e }
end
source_id() click to toggle source
# File lib/zendesk2/help_center/translation_source.rb, line 19
def source_id
  Integer((params['translation'] || params).fetch('source_id'))
end
source_type() click to toggle source
# File lib/zendesk2/help_center/translation_source.rb, line 23
def source_type
  (params['translation'] || params).fetch('source_type')
end
source_type_url() click to toggle source
# File lib/zendesk2/help_center/translation_source.rb, line 27
def source_type_url
  case source_type
  when 'Article'
    'articles'
  when 'Section'
    'sections'
  when 'Category'
    'categories'
  end
end