i'll add some documentaton, but it should be pretty straight forward from the comments
add gem 'zendesk_api', '~> 1.4.3' to your gemfile
<% content_for :title do %>Zendesk View Dashboard<% end %> | |
<div class="gridster"> | |
<ul> | |
<li data-row="1" data-col="1" data-sizex="1" data-sizey="1"> | |
<div data-id="1234" data-view="Number" data-title="Some cool view" data-suffix=""></div> | |
</li> | |
<li data-row="1" data-col="2" data-sizex="1" data-sizey="1"> | |
<div data-id="1235" data-view="Number" data-title="Another cool view" data-suffix=""></div> | |
</li> | |
</div> |
require 'zendesk_api' | |
client = ZendeskAPI::Client.new do |config| | |
config.url = "https://domain.zendesk.com/api/v2" # e.g. https://mydesk.zendesk.com/api/v2 | |
config.username = "[email protected]" | |
config.token = "TOKEN_HERE" | |
config.retry = true | |
end | |
# array of view IDs to check, these are your data-id's in your erb file. | |
views = [1234,1235] | |
SCHEDULER.every '1m', :first_in => 0 do |job| | |
counts = client.view_counts(:ids => views, :path => 'views/count_many') | |
counts.all do |ct| | |
if ct.fresh | |
puts "sending "+ct.view_id.to_s+" : "+ct.value.to_s | |
send_event(ct.view_id.to_i, { current: ct.value.to_i}) | |
end | |
end | |
end |
@G4ce2020 Going to guess that since he's using the Number
widget, it doesn't have a special widget type.
Thanks so much!
Hi,
Did someone managed to display the difference between current and last value ?
can't figure it out.
Thanks
It uses the standard dashing Number widget. You likely need to modify the widget to work as you want.
Hi do you have examples of the .coffee, .html and .scss files?