class Zendesk2::CreateBrand

Public Class Methods

accepted_attributes() click to toggle source
# File lib/zendesk2/create_brand.rb, line 9
def self.accepted_attributes
  %w(name brand_url has_help_center help_center_state active default ticket_form_ids
     subdomain host_mapping signature_template)
end

Public Instance Methods

brand_params() click to toggle source
# File lib/zendesk2/create_brand.rb, line 14
def brand_params
  Cistern::Hash.slice(params.fetch('brand'), *self.class.accepted_attributes)
end
mock() click to toggle source
# File lib/zendesk2/create_brand.rb, line 18
def mock
  identity = cistern.serial_id

  record = {
    'id'                   => identity,
    'name'                 => params['name'],
    'brand_url'            => '',
    'has_help_center'      => true,
    'help_center_state'    => true,
    'active'               => true,
    'end_user_visible'     => true,
    'default'              => false,
    'ticket_form_ids'      => params['ticket_form_ids'],
    'subdomain'            => params['subdomain'],
    'host_mapping'         => '',
    'signature_template'   => '',
    'url'                  => url_for("/brands/#{identity}.json"),
  }.merge(brand_params)

  data[:brands][identity] = record

  mock_response('brand' => record)
end