-
Notifications
You must be signed in to change notification settings - Fork 183
Misc
Steven Davidovitz edited this page Jul 11, 2014
·
3 revisions
Callbacks can be added to the ZendeskAPI::Client instance and will be called (with the response env) after all response middleware on a successful request.
client.insert_callback do |env|
puts env[:response_headers]
end
Use either of the following to obtain the current user instance:
client.users.find(:id => 'me')
client.current_user
Bulk importing tickets allows you to move large amounts of data into Zendesk.
ticket = ZendeskAPI::Ticket.import(client, :subject => "Help", :comments => [{ :author_id => 19, :value => "This is a comment" }])
http://developer.zendesk.com/documentation/rest_api/ticket_import.html
Files can be attached to ticket comments using either a path or the File class and will be automatically uploaded and attached.
ticket = ZendeskAPI::Ticket.new(client, :comment => { :value => "attachments" })
ticket.comment.uploads << "img.jpg"
ticket.comment.uploads << File.new("img.jpg")
ticket.save
client = ZendeskAPI::Client.new do |config|
...
config.client_options = {
:request => {
:timeout => 5,
:open_timeout => 2
}
}
end