Skip to content

Instantly share code, notes, and snippets.

@luizfaias
Created December 16, 2014 15:26
Show Gist options
  • Save luizfaias/c2d9a6232821f491625f to your computer and use it in GitHub Desktop.
Save luizfaias/c2d9a6232821f491625f to your computer and use it in GitHub Desktop.
create dummy tickets inside Zendesk for testing purposes
require 'zendesk_api'
require 'net/http'
client = ZendeskAPI::Client.new do |config|
config.url = "https://{{subdomain}}.zendesk.com/api/v2"
config.username = "email_here"
config.token = "token_here"
config.retry = true
end
for i in 1..50
resp = Net::HTTP.get_response(URI.parse('http://loripsum.net/api/1/plaintext/headers/short'))
subject = resp.body.match(/^(.*)$/)[0].to_s
resp = Net::HTTP.get_response(URI.parse('http://jaspervdj.be/lorem-markdownum/markdown-html.html?num-blocks=3'))
description = resp.body
ticket = client.tickets.create(:subject => subject, :comment => { :value => description })
p ticket.url
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment