class ZendeskAPI::AgentAvailability
client.agent_availabilities.fetch client.agent_availabilities.find 20401208368 both return consistently - ZendeskAPI::AgentAvailability
Public Class Methods
find(client, id)
click to toggle source
# File lib/zendesk_api/resources.rb, line 42 def self.find(client, id) attributes = client.connection.get("#{resource_path}/#{id}").body.fetch(model_key, {}) new(client, attributes) end
model_key()
click to toggle source
# File lib/zendesk_api/resources.rb, line 33 def self.model_key "data" end
new(client, attributes = {})
click to toggle source
Calls superclass method
ZendeskAPI::Data::new
# File lib/zendesk_api/resources.rb, line 37 def initialize(client, attributes = {}) nested_attributes = attributes.delete('attributes') super(client, attributes.merge(nested_attributes)) end
search(client, args_hash)
click to toggle source
Examples: ZendeskAPI::AgentAvailability.search
(client, { channel_status: ‘support:online’ }) ZendeskAPI::AgentAvailability.search
(client, { agent_status_id: 1 }) Just pass a hash that includes the key and value you want to search for, it gets turned into a query string on the format of filter=value Returns a collection of AgentAvailability
objects
# File lib/zendesk_api/resources.rb, line 53 def self.search(client, args_hash) query_string = args_hash.map { |k, v| "filter[#{k}]=#{v}" }.join("&") client.connection.get("#{resource_path}?#{query_string}").body.fetch(model_key, []).map do |attributes| new(client, attributes) end end
Public Instance Methods
channels()
click to toggle source
# File lib/zendesk_api/resources.rb, line 60 def channels @channels ||= begin channel_attributes_array = @client.connection.get(attributes['links']['self']).body.fetch('included') channel_attributes_array.map do |channel_attributes| nested_attributes = channel_attributes.delete('attributes') Channel.new(@client, channel_attributes.merge(nested_attributes)) end end end