Skip to content

How to configure columns of a View? #143

Open
broom9 opened this Issue Dec 17, 2013 · 0 comments

1 participant

@broom9
broom9 commented Dec 17, 2013

I can retrieve the View object and it seems I should modify the "execution" attribute of the View object to configure columns. However it doesn't seem to track the changes and send them to Zendesk server.

In the long code block below you can see I tried to retrieve a View object, print its "execution" attribute, modify its values (the "columns" and "fields" attributes) then save the View object. But nothing is changed on server side.

(byebug) $client.view.find(:id => 43882703)
I, [2013-12-17T00:55:19.375546 #7327]  INFO -- : get https://freewheel.zendesk.com/api/v2/views/43882703
D, [2013-12-17T00:55:19.375668 #7327] DEBUG -- :   Accept: "application/json"
  Accept-Encoding: "gzip;q=1.0,deflate;q=0.6,identity;q=0.3"
  User-Agent: "ZendeskAPI API 1.1.1"
I, [2013-12-17T00:55:20.185854 #7327]  INFO -- : Status 200
D, [2013-12-17T00:55:20.186244 #7327] DEBUG -- :   server: "nginx/1.4.2"
  date: "Tue, 17 Dec 2013 05:55:20 GMT"
  content-type: "application/json; charset=UTF-8"
  transfer-encoding: "chunked"
  connection: "close"
  status: "200 OK"
  x-zendesk-api-version: "v2"
  x-ua-compatible: "IE=Edge,chrome=1"
  cache-control: "must-revalidate, private, max-age=0"
  x-zendesk-origin-server: "app14.pod1.ord.zdsys.com"
  x-zendesk-user-id: "391374951"
  x-request-id: "26389d2b410efb6465da2f84eef05277"
  x-runtime: "0.078915"
  x-rack-cache: "miss"
  x-zendesk-request-id: "afc5f7f427acff00d31e"
  x-content-type-options: "nosniff"
  content-encoding: "gzip"
{"view"=>{"url"=>"https://freewheel.zendesk.com/api/v2/views/43882703.json", "id"=>43882703, "title"=>"Tickets for Amy Pisano", "active"=>true, "updated_at"=>2013-12-14 05:31:14 UTC, "created_at"=>2013-12-11 23:46:17 UTC, "restriction"=>{"type"=>"Group", "id"=>21469683}, "sla_id"=>nil, "execution"=>{"group_by"=>nil, "group_order"=>"desc", "sort_by"=>nil, "sort_order"=>"desc", "group"=>nil, "sort"=>nil, "columns"=>[{"id"=>"subject", "title"=>"Subject"}, {"id"=>"requester", "title"=>"Requester"}, {"id"=>"created", "title"=>"Requested"}, {"id"=>"updated", "title"=>"Updated"}, {"id"=>"group", "title"=>"Group"}, {"id"=>"assignee", "title"=>"Assignee"}], "fields"=>[{"id"=>"subject", "title"=>"Subject"}, {"id"=>"requester", "title"=>"Requester"}, {"id"=>"created", "title"=>"Requested"}, {"id"=>"updated", "title"=>"Updated"}, {"id"=>"group", "title"=>"Group"}, {"id"=>"assignee", "title"=>"Assignee"}], "custom_fields"=>[]}, "conditions"=>{"all"=>[{"field"=>"status", "operator"=>"less_than", "value"=>"solved"}, {"field"=>"current_tags", "operator"=>"includes", "value"=>"srm_amy_pisano"}], "any"=>[]}}}
#<ZendeskAPI::View {"url"=>"https://freewheel.zendesk.com/api/v2/views/43882703.json", "id"=>43882703, "title"=>"Tickets for Amy Pisano", "active"=>true, "updated_at"=>2013-12-14 05:31:14 UTC, "created_at"=>2013-12-11 23:46:17 UTC, "restriction"=>{"type"=>"Group", "id"=>21469683}, "sla_id"=>nil, "execution"=>{"group_by"=>nil, "group_order"=>"desc", "sort_by"=>nil, "sort_order"=>"desc", "group"=>nil, "sort"=>nil, "columns"=>[{"id"=>"subject", "title"=>"Subject"}, {"id"=>"requester", "title"=>"Requester"}, {"id"=>"created", "title"=>"Requested"}, {"id"=>"updated", "title"=>"Updated"}, {"id"=>"group", "title"=>"Group"}, {"id"=>"assignee", "title"=>"Assignee"}], "fields"=>[{"id"=>"subject", "title"=>"Subject"}, {"id"=>"requester", "title"=>"Requester"}, {"id"=>"created", "title"=>"Requested"}, {"id"=>"updated", "title"=>"Updated"}, {"id"=>"group", "title"=>"Group"}, {"id"=>"assignee", "title"=>"Assignee"}], "custom_fields"=>[]}, "conditions"=>{"all"=>[{"field"=>"status", "operator"=>"less_than", "value"=>"solved"}, {"field"=>"current_tags", "operator"=>"includes", "value"=>"srm_amy_pisano"}], "any"=>[]}}>
(byebug) v.execution
#<ZendeskAPI::RuleExecution {"group_by"=>nil, "group_order"=>"desc", "sort_by"=>nil, "sort_order"=>"desc", "group"=>nil, "sort"=>nil, "columns"=>[{"id"=>"subject", "title"=>"Subject"}, {"id"=>"requester", "title"=>"Requester"}, {"id"=>"created", "title"=>"Requested"}, {"id"=>"updated", "title"=>"Updated"}, {"id"=>"group", "title"=>"Group"}, {"id"=>"assignee", "title"=>"Assignee"}], "fields"=>[{"id"=>"subject", "title"=>"Subject"}, {"id"=>"requester", "title"=>"Requester"}, {"id"=>"created", "title"=>"Requested"}, {"id"=>"updated", "title"=>"Updated"}, {"id"=>"group", "title"=>"Group"}, {"id"=>"assignee", "title"=>"Assignee"}], "custom_fields"=>[]}>
(byebug) v.execution.columns = [{"id"=>"subject", "title"=>"Subject"}, {"id"=>"requester", "title"=>"Requester"}, {"id"=>"created", "title"=>"Requested"}, {"id"=>"updated", "title"=>"Updated"}, {"id"=>"group", "title"=>"Group"}, {"id"=>"assignee", "title"=>"Assignee"}, {"id"=>"organization", "title"=>"Organization"}]
[{"id"=>"subject", "title"=>"Subject"}, {"id"=>"requester", "title"=>"Requester"}, {"id"=>"created", "title"=>"Requested"}, {"id"=>"updated", "title"=>"Updated"}, {"id"=>"group", "title"=>"Group"}, {"id"=>"assignee", "title"=>"Assignee"}, {"id"=>"organization", "title"=>"Organization"}]
(byebug) v.execution.fields = [{"id"=>"subject", "title"=>"Subject"}, {"id"=>"requester", "title"=>"Requester"}, {"id"=>"created", "title"=>"Requested"}, {"id"=>"updated", "title"=>"Updated"}, {"id"=>"group", "title"=>"Group"}, {"id"=>"assignee", "title"=>"Assignee"}, {"id"=>"organization", "title"=>"Organization"}]
[{"id"=>"subject", "title"=>"Subject"}, {"id"=>"requester", "title"=>"Requester"}, {"id"=>"created", "title"=>"Requested"}, {"id"=>"updated", "title"=>"Updated"}, {"id"=>"group", "title"=>"Group"}, {"id"=>"assignee", "title"=>"Assignee"}, {"id"=>"organization", "title"=>"Organization"}]
(byebug) v.save
I, [2013-12-17T00:57:20.244593 #7327]  INFO -- : put https://freewheel.zendesk.com/api/v2/views/43882703.json
D, [2013-12-17T00:57:20.246130 #7327] DEBUG -- :   Accept: "application/json"
  Accept-Encoding: "gzip;q=1.0,deflate;q=0.6,identity;q=0.3"
  User-Agent: "ZendeskAPI API 1.1.1"
{:view=>#<Hashie::Mash actions=nil conditions=#<ZendeskAPI::Trackie all=[#<ZendeskAPI::Trackie field="status" operator="less_than" value="solved">, #<ZendeskAPI::Trackie field="current_tags" operator="includes" value="srm_amy_pisano">] any=[]> output=nil>}
I, [2013-12-17T00:57:20.979960 #7327]  INFO -- : Status 200
D, [2013-12-17T00:57:20.980467 #7327] DEBUG -- :   server: "nginx/1.4.2"
  date: "Tue, 17 Dec 2013 05:57:20 GMT"
  content-type: "application/json; charset=UTF-8"
  transfer-encoding: "chunked"
  connection: "close"
  status: "200 OK"
  x-zendesk-api-version: "v2"
  x-zendesk-api-warn: "Removed restricted keys [\"any\", \"actions\", \"output\"] from parameters according to whitelist"
  x-ua-compatible: "IE=Edge,chrome=1"
  cache-control: "max-age=0, private, must-revalidate"
  x-zendesk-origin-server: "app38.pod1.ord.zdsys.com"
  x-zendesk-user-id: "391374951"
  x-request-id: "4d146a93e3fda76417e3421e1ab6f45c"
  x-runtime: "0.296308"
  x-rack-cache: "invalidate, pass"
  x-zendesk-request-id: "a254a3ee76b18d697425"
  x-content-type-options: "nosniff"
  content-encoding: "gzip"
{"view"=>{"url"=>"https://freewheel.zendesk.com/api/v2/views/43882703.json", "id"=>43882703, "title"=>"Tickets for Amy Pisano", "active"=>true, "updated_at"=>2013-12-17 05:57:20 UTC, "created_at"=>2013-12-11 23:46:17 UTC, "restriction"=>{"type"=>"Group", "id"=>21469683}, "sla_id"=>nil, "execution"=>{"group_by"=>nil, "group_order"=>"desc", "sort_by"=>nil, "sort_order"=>"desc", "group"=>nil, "sort"=>nil, "columns"=>[{"id"=>"subject", "title"=>"Subject"}, {"id"=>"requester", "title"=>"Requester"}, {"id"=>"created", "title"=>"Requested"}, {"id"=>"updated", "title"=>"Updated"}, {"id"=>"group", "title"=>"Group"}, {"id"=>"assignee", "title"=>"Assignee"}], "fields"=>[{"id"=>"subject", "title"=>"Subject"}, {"id"=>"requester", "title"=>"Requester"}, {"id"=>"created", "title"=>"Requested"}, {"id"=>"updated", "title"=>"Updated"}, {"id"=>"group", "title"=>"Group"}, {"id"=>"assignee", "title"=>"Assignee"}], "custom_fields"=>[]}, "conditions"=>{"all"=>[{"field"=>"status", "operator"=>"less_than", "value"=>"solved"}, {"field"=>"current_tags", "operator"=>"includes", "value"=>"srm_amy_pisano"}], "any"=>[]}}}
W, [2013-12-17T00:57:20.980591 #7327]  WARN -- : WARNING: Removed restricted keys ["any", "actions", "output"] from parameters according to whitelist
true
(byebug)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.