Class: Zendesk2::CreateTicketField
- Inherits:
-
Object
- Object
- Zendesk2::CreateTicketField
show all
- Includes:
- Request
- Defined in:
- lib/zendesk2/create_ticket_field.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_ticket_field.rb', line 9
def self.accepted_attributes
%w(type title description position active required collapsed_for_agents regexp_for_validation title_in_portal
visible_in_portal editable_in_portal required_in_portal tag custom_field_options agent_description)
end
|
Instance Method Details
#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
41
42
43
44
|
# File 'lib/zendesk2/create_ticket_field.rb', line 18
def mock
identity = cistern.serial_id
record = {
'active' => true,
'collapsed_for_agents' => false,
'created_at' => timestamp,
'description' => params['title'],
'editable_in_portal' => false,
'id' => identity,
'position' => 9999,
'regexp_for_validation' => '',
'removable' => true,
'required' => false,
'required_in_portal' => false,
'tag' => '',
'title_in_portal' => params['title'],
'updated_at' => timestamp,
'url' => url_for("/ticket_fields/#{identity}.json"),
'visible_in_portal' => false,
'agent_description' => '',
}.merge(ticket_field_params)
data[:ticket_fields][identity] = record
mock_response('ticket_field' => record)
end
|
#ticket_field_params ⇒ Object
14
15
16
|
# File 'lib/zendesk2/create_ticket_field.rb', line 14
def ticket_field_params
Cistern::Hash.slice(params.fetch('ticket_field'), *self.class.accepted_attributes)
end
|