Class: Zendesk2::CreateBrand
- Inherits:
-
Object
- Object
- Zendesk2::CreateBrand
show all
- Includes:
- Request
- Defined in:
- lib/zendesk2/create_brand.rb
Instance Attribute Summary
Attributes included from Request
#params
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Request
#call, cistern_included, #data, #delete!, #error!, #find!, #html_url_for, included, #mock_response, #page, #page_params!, #page_params?, #pluralize, #real, #real_request, #request_body, #request_params, #request_path, #resources, #response, #timestamp, #url_for
Class Method Details
.accepted_attributes ⇒ Object
9
10
11
12
|
# 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
|
Instance Method Details
#brand_params ⇒ Object
14
15
16
|
# File 'lib/zendesk2/create_brand.rb', line 14
def brand_params
Cistern::Hash.slice(params.fetch('brand'), *self.class.accepted_attributes)
end
|
#mock ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# 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
|