Sha256: 755f903888f1b3846ac026be63d7bdd23d403f10d877da23eb1371eb95d00cf7
Contents?: true
Size: 1.09 KB
Versions: 21
Compression:
Stored size: 1.09 KB
Contents
class Zendesk2::Client::CreateHelpCenterCategory < Zendesk2::Client::Request request_method :post request_path { |_| "/help_center/categories.json" } request_body { |r| {"category" => r.category_params} } def self.accepted_attributes %w[category_id description locale name position sorting] end def category_params Cistern::Hash.slice(params.fetch("category"), *self.class.accepted_attributes) end def mock identity = service.serial_id locale = params["locale"] ||= "en-us" position = self.data[:help_center_categories].size record = { "id" => identity, "url" => url_for("/help_center/#{locale}/categories/#{identity}.json"), "html_url" => html_url_for("/hc/#{locale}/categories/#{identity}.json"), "author_id" => service.current_user["id"], "position" => position, "created_at" => Time.now.iso8601, "updated_at" => Time.now.iso8601, "description" => "", }.merge(category_params) self.data[:help_center_categories][identity] = record mock_response("category" => record) end end
Version data entries
21 entries across 21 versions & 1 rubygems