Skip to content

Instantly share code, notes, and snippets.

@DeskWOW
Created July 14, 2014 21:05
Show Gist options
  • Save DeskWOW/0d078c2dab557c90f502 to your computer and use it in GitHub Desktop.
Save DeskWOW/0d078c2dab557c90f502 to your computer and use it in GitHub Desktop.
require 'desk_api'
ticket = DeskApi.cases.create({
external_id: 123456,
subject: 'Subject',
description: 'Description',
priority: 1,
status: 'resolved',
type: 'email',
labels: ['Label 1', 'Label 2'],
custom_fields: {
my_key: 'My Value'
},
message: {
direction: 'in',
from: 'Customer <[email protected]>',
to: 'Support <[email protected]>',
subject: 'Subject',
status: 'received',
body: 'Some body',
created_at: '2014-07-14T13:06:19-07:00',
updated_at: '2014-07-14T13:06:19-07:00'
},
_links: {
assigned_user: { href: '/api/v2/users/123456' },
assigned_group: { href: '/api/v2/groups/123456' },
customer: { href: '/api/v2/customers/123456' }
},
created_at: '2014-07-14T13:06:19-07:00',
updated_at: '2014-07-14T13:06:19-07:00'
})
ticket.replies.create({
direction: 'out',
to: 'Customer <[email protected]>',
from: 'Support <[email protected]>',
subject: 'Subject',
status: 'sent',
body: 'Some body',
created_at: '2014-07-14T13:06:19-07:00',
updated_at: '2014-07-14T13:06:19-07:00'
})
ticket.notes.create({
body: 'Some note'
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment