Sha256: e086ae0ecb3e19a23202f27d6b4afca632c08112e937b5dce19ab35ea4b08f59
Contents?: true
Size: 850 Bytes
Versions: 21
Compression:
Stored size: 850 Bytes
Contents
class Zendesk2::Client::CreateForum < Zendesk2::Client::Request request_method :post request_path { |_| "/forums.json" } request_body { |r| {"forum" => r.forum_params } } def self.accepted_attributes %w[name description category_id organization_id locale_id locked position forum_type access] end def forum_params Cistern::Hash.slice(params.fetch("forum"), *self.class.accepted_attributes) end def mock identity = service.serial_id record = { "id" => identity, "url" => url_for("/forums/#{identity}.json"), "created_at" => Time.now.iso8601, "updated_at" => Time.now.iso8601, }.merge(Cistern::Hash.slice(params.fetch("forum"), *self.class.accepted_attributes)) service.data[:forums][identity] = record mock_response({"forum" => record}, {status: 201}) end end
Version data entries
21 entries across 21 versions & 1 rubygems
Version | Path |
---|---|
zendesk2-1.5.3 | lib/zendesk2/client/requests/create_forum.rb |