Skip to content

Instantly share code, notes, and snippets.

@gorenje
Created July 9, 2012 12:26
Show Gist options
  • Save gorenje/3076191 to your computer and use it in GitHub Desktop.
Save gorenje/3076191 to your computer and use it in GitHub Desktop.
how to use Zendesk API Gem
require 'zendesk_api'
# retrieve login details from yml file.
z = get_login_details(:zendesk)
client = ZendeskAPI::Client.new do |config|
config.url = "https://#{z.first}.zendesk.com/api/v2"
config.username = z[1]
config.password = z.last
require 'logger'
config.logger = Logger.new(STDOUT)
end
fields = {
"21127457" => 12345,
"21037343" => "loading_problem",
"21362847" => "diamond_dash",
}
client.tickets.create(:subject => "Test Ticket using API",
:description => "This is a test",
:submitter_id => client.current_user.id,
:priority => "urgent",
:fields => fields,
:requester => '[email protected]')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment