class Zendesk2::CreateCategory

Public Class Methods

accepted_attributes() click to toggle source
# File lib/zendesk2/create_category.rb, line 9
def self.accepted_attributes
  %w(id name description position)
end

Public Instance Methods

mock() click to toggle source
# File lib/zendesk2/create_category.rb, line 13
def mock
  identity = cistern.serial_id

  record = {
    'id'         => identity,
    'url'        => url_for("/categories/#{identity}.json"),
    'created_at' => timestamp,
    'updated_at' => timestamp,
  }.merge(Cistern::Hash.slice(params.fetch('category'), *self.class.accepted_attributes))

  cistern.data[:categories][identity] = record

  mock_response({ 'category' => record }, { status: 201 })
end