Skip to content

Instantly share code, notes, and snippets.

@chechuironman
Last active August 29, 2015 14:01
Show Gist options
  • Save chechuironman/9f89441888c41772a9ba to your computer and use it in GitHub Desktop.
Save chechuironman/9f89441888c41772a9ba to your computer and use it in GitHub Desktop.
Get Tickets
#!/usr/bin/ruby
##################################################################################
# Get all tickets from an Account
# ©Copyright IBM Corporation 2014.
# LICENSE: MIT (http://opensource.org/licenses/MIT)
# gems used:
# rubygems, softlayer-api
##################################################################################
require 'rubygems'
require 'softlayer_api'
user='xxx'
api='xxx'
account = SoftLayer::Service.new("SoftLayer_Account",:username => user,:api_key => api)
tickets=account.getTickets
ticket = SoftLayer::Service.new("SoftLayer_Ticket",:username => user,:api_key => api)
for item in tickets
puts ""
puts ""
puts "#################################################################"
puts "#################################################################"
puts "#################### NEW TICKET ##############################"
puts "#################################################################"
puts "#################################################################"
puts ""
updates= ticket.object_with_id(item['id']).getUpdates
puts " ID: #{item['id']}, Title: #{item['title']}"
for update in updates
if update['editorType'] != 'AUTO' then
puts ""
puts "########################## COMMENT ##############################################"
puts "Editor: #{update['editorType']}"
puts "Comments: #{update['entry']}"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment