Sha256: cf3e9bd23615eb9c9807ac9bdb714756b84d0067aa3f1be2974481ec140d7c72

Contents?: true

Size: 696 Bytes

Versions: 6

Compression:

Stored size: 696 Bytes

Contents

# frozen_string_literal: true
class Zendesk2::UpdateHelpCenterCategory
  include Zendesk2::Request

  request_method :put
  request_body { |r| { 'category' => r.category_params } }
  request_path do |r|
    locale = r.category_params['locale']
    locale ? "/help_center/#{locale}/categories/#{r.category_id}.json" : "/help_center/categories/#{r.category_id}.json"
  end

  def category_params
    Cistern::Hash.slice(params.fetch('category'), *Zendesk2::CreateHelpCenterCategory.accepted_attributes)
  end

  def category_id
    params.fetch('category').fetch('id')
  end

  def mock
    mock_response('category' => find!(:help_center_categories, category_id).merge!(category_params))
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
zendesk2-1.15.0 lib/zendesk2/help_center/update_help_center_category.rb
zendesk2-1.13.1 lib/zendesk2/help_center/update_help_center_category.rb
zendesk2-1.13.0 lib/zendesk2/help_center/update_help_center_category.rb
zendesk2-1.12.0 lib/zendesk2/help_center/update_help_center_category.rb
zendesk2-1.11.0 lib/zendesk2/help_center/update_help_center_category.rb
zendesk2-1.10.0 lib/zendesk2/help_center/update_help_center_category.rb