Module: Teamsupport::REST::Tickets

Includes:
Utils, Utils
Included in:
API
Defined in:
lib/teamsupport/rest/tickets.rb

Instance Method Summary collapse

Methods included from Utils

flat_pmap, pmap

Instance Method Details

#create_ticket(options = {}) ⇒ Teamsupport::Ticket

Create a ticket

Examples:

teamsupport_api = Teamsupport::REST::Client.new(api_key: 'AK', api_secret: 'AS')
teamsupport_api.create_ticket(Name: 'New Ticket', Description: 'Ticket Description')

Parameters:

  • options (Hash) (defaults to: {})

    A customizable set of options.

Returns:

Raises:

Authentication:

  • Requires Basic Authentication



69
70
71
# File 'lib/teamsupport/rest/tickets.rb', line 69

def create_ticket(options = {})
  perform_post_with_object_from_collection('/api/json/tickets.json', options, Teamsupport::Ticket, :Ticket)
end

#delete_ticket(id, options = {}) ⇒ Object

Deletes the ticket

Examples:

teamsupport_api = Teamsupport::REST::Client.new(api_key: 'AK', api_secret: 'AS')
teamsupport_api.delete_ticket('1')

Parameters:

  • id (Integer)

    A ticket ID.

  • options (Hash) (defaults to: {})

    A customizable set of options.

Raises:

Authentication:

  • Requires Basic Authentication



108
109
110
# File 'lib/teamsupport/rest/tickets.rb', line 108

def delete_ticket(id, options = {})
  perform_delete("/api/json/tickets/#{id}.json", options)
end

#ticket(id, options = {}) ⇒ Teamsupport::Ticket

Returns a customer

Examples:

teamsupport_api = Teamsupport::REST::Client.new(api_key: 'AK', api_secret: 'AS')
teamsupport_api.ticket('1')

Parameters:

  • id (Integer)

    A ticket ID.

  • options (Hash) (defaults to: {})

    A customizable set of options.

Returns:

Raises:

Authentication:

  • Requires Basic Authentication



50
51
52
# File 'lib/teamsupport/rest/tickets.rb', line 50

def ticket(id, options = {})
  perform_get_with_object_from_collection("/api/json/tickets/#{id}.json", options, Teamsupport::Ticket, :Ticket)
end

#ticket_actions(id, options = {}) ⇒ Array<Teamsupport::Product>

Returns the actions for a ticket

Examples:

teamsupport_api = Teamsupport::REST::Client.new(api_key: 'AK', api_secret: 'AS')
teamsupport_api.ticket_actions('1')

Parameters:

  • id (Integer)

    A ticket ID.

  • options (Hash) (defaults to: {})

    A customizable set of options.

Returns:

Raises:

Authentication:

  • Requires Basic Authentication



128
129
130
131
# File 'lib/teamsupport/rest/tickets.rb', line 128

def ticket_actions(id, options = {})
  options = options.dup
  perform_get_with_objects_from_collection("/api/json/tickets/#{id}/actions.json", options, Teamsupport::TicketAction, :Actions)
end

#tickets(options = {}) ⇒ Array<Teamsupport::Ticket>

Returns all available tickets for the TeamSupport organization

Examples:

teamsupport_api = Teamsupport::REST::Client.new(api_key: 'AK', api_secret: 'AS')
teamsupport_api.tickets()

Parameters:

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • :count (Integer)

    Specifies the number of records to retrieve.

Returns:

Raises:

See Also:

Authentication:

  • Requires Basic Authentication



30
31
32
# File 'lib/teamsupport/rest/tickets.rb', line 30

def tickets(options = {})
  perform_get_with_objects_from_collection('/api/json/tickets.json', options, Teamsupport::Ticket, :Tickets)
end

#update_ticket(id, options = {}) ⇒ Teamsupport::Ticket

Updates the ticket

Examples:

teamsupport_api = Teamsupport::REST::Client.new(api_key: 'AK', api_secret: 'AS')
teamsupport_api.update_ticket('1', Name: 'Updated Ticket Name')

Parameters:

  • id (Integer)

    A ticket ID.

  • options (Hash) (defaults to: {})

    A customizable set of options.

Returns:

Raises:

Authentication:

  • Requires Basic Authentication



89
90
91
92
# File 'lib/teamsupport/rest/tickets.rb', line 89

def update_ticket(id, options = {})
  ticket_hash = ticket(id).to_h
  perform_put_with_object_from_collection("/api/json/tickets/#{id}.json", ticket_hash.merge(options), Teamsupport::Ticket, :Ticket)
end