Module: WixAnswers::REST::Ticket

Included in:
API
Defined in:
lib/wixanswers/rest/ticket.rb

Instance Method Summary collapse

Instance Method Details

#add(options = {}) ⇒ WixAnswers::Models::Ticket

Create a ticket for the authenticated user associated with the JWT token

Parameters:

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

    A customizable set of options

  • subject (Hash)

    a customizable set of options

  • content (Hash)

    a customizable set of options

  • locale (Hash)

    a customizable set of options

Returns:

Raises:

  • (WixAnswers::Exceptions::Unauthorized)

    Error raised when supplied user credentials are not valid.

See Also:



16
17
18
# File 'lib/wixanswers/rest/ticket.rb', line 16

def add(options = {})
  WixAnswers::Models::Ticket.new(perform_request("/tickets", :post, options))
end

#add_as_agent(ticket_id, reply_id, options = {}) ⇒ WixAnswers::Models::Ticket

Create a new ticket from an existing user reply. The new ticket takes many of its details (user, priority, status, and so forth) from the existing ticket, and the new contents from the reply. After creating the ticket, Wix Answer invokes the Ticket Created webhook.

Parameters:

  • ticket_id (String)

    ticket GUID

  • reply_id (String)

    reply GUID

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

    A customizable set of options

  • subject (Hash)

    a customizable set of options

Returns:

Raises:

  • (WixAnswers::Exceptions::Unauthorized)

    Error raised when supplied user credentials are not valid.

See Also:



68
69
70
# File 'lib/wixanswers/rest/ticket.rb', line 68

def add_as_agent(ticket_id, reply_id, options = {})
  WixAnswers::Models::Ticket.new(perform_request("/tickets/#{ticket_id}/replies/#{reply_id}/createTicket", :post, options))
end

#add_as_guest(options = {}) ⇒ WixAnswers::Models::Ticket

Create a new ticket for an unauthenticated user who has provided an email address. Use this API only when a user GUID is not available, for example when an unregistered user creates a ticket on your site or widget.

Parameters:

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

    A customizable set of options

  • userEmail (Hash)

    a customizable set of options

  • subject (Hash)

    a customizable set of options

  • content (Hash)

    a customizable set of options

  • locale (Hash)

    a customizable set of options

Returns:

Raises:

  • (WixAnswers::Exceptions::Unauthorized)

    Error raised when supplied user credentials are not valid.

See Also:



52
53
54
# File 'lib/wixanswers/rest/ticket.rb', line 52

def add_as_guest(options = {})
  WixAnswers::Models::Ticket.new(perform_request("/tickets/guest", :post, options))
end

#add_callback_request(options = {}) ⇒ WixAnswers::Models::Ticket

Create a new callback request ticket to the passed phone number, for the user associated with the JWT token. Requires a line that supports outbound calls.

Parameters:

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

    A customizable set of options

  • phoneNumber (Hash)

    a customizable set of options

  • lineId (Hash)

    a customizable set of options

Returns:

Raises:

  • (WixAnswers::Exceptions::Unauthorized)

    Error raised when supplied user credentials are not valid.

See Also:



83
84
85
86
# File 'lib/wixanswers/rest/ticket.rb', line 83

def add_callback_request(options = {})
  options[:phoneNumber] = options[:phoneNumber].is_a?(WixAnswers::Models::PhoneNumber) ? options[:phoneNumber].attrs : options[:phoneNumber]
  WixAnswers::Models::Ticket.new(perform_request("/tickets/callbackRequests", :post, options))
end

#add_on_behalf(options = {}) ⇒ WixAnswers::Models::Ticket

Create a ticket on behalf of an authenticated or unauthenticated user. Use this in response to a user request where the agent creates the ticket based on that request on behalf of the user.

Parameters:

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

    A customizable set of options

  • recipientEmail (Hash)

    a customizable set of options

  • recipientId (Hash)

    a customizable set of options

  • subject (Hash)

    a customizable set of options

  • content (Hash)

    a customizable set of options

  • locale (Hash)

    a customizable set of options

Returns:

Raises:

  • (WixAnswers::Exceptions::Unauthorized)

    Error raised when supplied agent credentials are not valid.

See Also:



35
36
37
# File 'lib/wixanswers/rest/ticket.rb', line 35

def add_on_behalf(options = {})
  WixAnswers::Models::Ticket.new(perform_request("/tickets/onBehalf", :post, options))
end

#assign(ticket_id) ⇒ WixAnswers::Models::Ticket

Assign a ticket to an agent or an agent group.

Parameters:

  • ticket_id (String)

    Ticket GUID

Returns:

Raises:

  • (WixAnswers::Exceptions::Unauthorized)

    Error raised when supplied agent credentials are not valid.

See Also:



168
169
170
# File 'lib/wixanswers/rest/ticket.rb', line 168

def assign(ticket_id)
  WixAnswers::Models::Ticket.new(perform_request("/tickets/#{ticket_id}/assign", :post))
end

#assign_many(options = {}) ⇒ Array[WixAnswers::Models::Ticket]

Assign one or more tickets to an agent or an agent group.

Parameters:

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

    A customizable set of options

  • ids (Hash)

    a customizable set of options

  • assignedGroupId (Hash)

    a customizable set of options

  • assignedUserId (Hash)

    a customizable set of options

Returns:

Raises:

  • (WixAnswers::Exceptions::Unauthorized)

    Error raised when supplied agent credentials are not valid.

See Also:



184
185
186
# File 'lib/wixanswers/rest/ticket.rb', line 184

def assign_many(options={})
  perform_request("/tickets/assign", :post, options).map {|ticket| WixAnswers::Models::Ticket.new(ticket)}
end

#authenticate(ticket_id) ⇒ WixAnswers::Models::Ticket

Authenticate a ticket.

Parameters:

  • ticket_id (String)

    Ticket GUID

Returns:

Raises:

  • (WixAnswers::Exceptions::Unauthorized)

    Error raised when supplied agent credentials are not valid.

See Also:



268
269
270
# File 'lib/wixanswers/rest/ticket.rb', line 268

def authenticate(ticket_id)
  WixAnswers::Models::Ticket.new(perform_request("/tickets/#{ticket_id}/authenticate", :post))
end

#count(options = {}) ⇒ Hash

Get the number of tickets matching one or more saved filters.

Parameters:

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

    A customizable set of options

  • locale (Hash)

    a customizable set of options

Returns:

  • (Hash)

Raises:

  • (WixAnswers::Exceptions::Unauthorized)

    Error raised when supplied agent credentials are not valid.

See Also:



157
158
159
# File 'lib/wixanswers/rest/ticket.rb', line 157

def count(options = {})
  perform_request("/tickets/filtersCounts", :post, options)
end

#find_by_number(ticket_number) ⇒ WixAnswers::Models::Ticket

Get a ticket by its ticket reference number (issue ID). This requires agent privileges; to get one of your own tickets (with user privileges), see Get One of Your Tickets by ID.

Parameters:

  • ticket_number (Integer)

    Ticket Number

Returns:

Raises:

  • (WixAnswers::Exceptions::Unauthorized)

    Error raised when supplied agent credentials are not valid.

See Also:



109
110
111
# File 'lib/wixanswers/rest/ticket.rb', line 109

def find_by_number(ticket_number)
  WixAnswers::Models::Ticket.new(perform_request("/tickets/byNumber/#{ticket_number}/admin"))
end

#mark_not_spam(ticket_id) ⇒ WixAnswers::Models::Ticket

Mark a ticket as not spam

Parameters:

  • ticket_id (String)

    Ticket GUID

Returns:

Raises:

  • (WixAnswers::Exceptions::Unauthorized)

    Error raised when supplied agent credentials are not valid.

See Also:



233
234
235
# File 'lib/wixanswers/rest/ticket.rb', line 233

def mark_not_spam(ticket_id)
  perform_request("/tickets/#{ticket_id}/markHam", :post)
end

#mark_not_spam_many(options = {}) ⇒ Array[WixAnswers::Models::Ticket]

Mark one or more tickets as not spam

Parameters:

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

    A customizable set of options

  • ids (Hash)

    a customizable set of options

Returns:

Raises:

  • (WixAnswers::Exceptions::Unauthorized)

    Error raised when supplied agent credentials are not valid.

See Also:



257
258
259
# File 'lib/wixanswers/rest/ticket.rb', line 257

def mark_not_spam_many(options={})
  perform_request("/tickets/markHam", :post, options)
end

#mark_spam(ticket_id) ⇒ WixAnswers::Models::Ticket

Mark a ticket as spam

Parameters:

  • ticket_id (String)

    Ticket GUID

Returns:

Raises:

  • (WixAnswers::Exceptions::Unauthorized)

    Error raised when supplied agent credentials are not valid.

See Also:



222
223
224
# File 'lib/wixanswers/rest/ticket.rb', line 222

def mark_spam(ticket_id)
  perform_request("/tickets/#{ticket_id}/markSpam", :post)
end

#mark_spam_many(options = {}) ⇒ Array[WixAnswers::Models::Ticket]

Mark one or more tickets as spam

Parameters:

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

    A customizable set of options

  • ids (Hash)

    a customizable set of options

Returns:

Raises:

  • (WixAnswers::Exceptions::Unauthorized)

    Error raised when supplied agent credentials are not valid.

See Also:



245
246
247
# File 'lib/wixanswers/rest/ticket.rb', line 245

def mark_spam_many(options={})
  perform_request("/tickets/markSpam", :post, options)
end

#my_ticket(ticket_id) ⇒ WixAnswers::Models::Ticket

Get one of your tickets by its ID. The main use-case for this API is from the Help Center. If you have agent privileges, you can get any ticket by its reference number or id; see Get a Ticket by Ticket Reference Number.

Parameters:

  • ticket_id (String)

    Ticket GUID

Returns:

Raises:

  • (WixAnswers::Exceptions::Unauthorized)

    Error raised when supplied agent credentials are not valid.

See Also:



122
123
124
# File 'lib/wixanswers/rest/ticket.rb', line 122

def my_ticket(ticket_id)
  WixAnswers::Models::Ticket.new(perform_request("/tickets/byNumber/#{ticket_id}/my"))
end

#search(options = {}) ⇒ Array<WixAnswers::Models::Ticket>

Get list of tickets that match the search/filtering criteria.

Parameters:

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

    A customizable set of options

Returns:

Raises:

  • (WixAnswers::Exceptions::Unauthorized)

    Error raised when supplied agent credentials are not valid.

See Also:



133
134
135
# File 'lib/wixanswers/rest/ticket.rb', line 133

def search(options = {})
  perform_request("/tickets/search/admin", :post, options).map {|ticket| WixAnswers::Models::Ticket.new(ticket) }
end

#search_mine(options = {}) ⇒ Array<WixAnswers::Models::Ticket>

Get list of your tickets that match the search/filtering criteria. The main use-case for this API is from the Help Center.

Parameters:

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

    A customizable set of options

Returns:

Raises:

  • (WixAnswers::Exceptions::Unauthorized)

    Error raised when supplied agent credentials are not valid.

See Also:



145
146
147
# File 'lib/wixanswers/rest/ticket.rb', line 145

def search_mine(options = {})
  perform_request("/tickets/my", :post, options).map {|ticket| WixAnswers::Models::Ticket.new(ticket) }
end

#ticket(ticket_id) ⇒ WixAnswers::Models::Ticket Also known as: find_by_id

Get a ticket by its ID. This requires agent privileges; to get one of your own tickets (with user privileges), see Get One of Your Tickets by ID.

Parameters:

  • ticket_id (String)

    Ticket GUID

Returns:

Raises:

  • (WixAnswers::Exceptions::Unauthorized)

    Error raised when supplied agent credentials are not valid.

See Also:



96
97
98
# File 'lib/wixanswers/rest/ticket.rb', line 96

def ticket(ticket_id)
  WixAnswers::Models::Ticket.new(perform_request("/tickets/#{ticket_id}/admin"))
end

#transfer(ticket_id, options = {}) ⇒ WixAnswers::Models::Ticket

Transfer a ticket; this changes the user associated with a ticket. Use when an existing ticket is found to be relevant for the user, such as one opened initially for an unauthenticated user. For example, when a) an unauthenticated user is created from an email and then b) an agent moves the ticket to an existing authenticated user.

Parameters:

  • ticket_id (String)

    Ticket GUID

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

    A customizable set of options

  • targetUserId (Hash)

    a customizable set of options

Returns:

Raises:

  • (WixAnswers::Exceptions::Unauthorized)

    Error raised when supplied agent credentials are not valid.

See Also:



284
285
286
# File 'lib/wixanswers/rest/ticket.rb', line 284

def transfer(ticket_id, options={})
  WixAnswers::Models::Ticket.new(perform_request("/tickets/#{ticket_id}/transfer", :post, options))
end

#unassign(ticket_id) ⇒ WixAnswers::Models::Ticket

Remove the agent or group assignment from a ticket.

Parameters:

  • ticket_id (String)

    Ticket GUID

Returns:

Raises:

  • (WixAnswers::Exceptions::Unauthorized)

    Error raised when supplied agent credentials are not valid.

See Also:



195
196
197
# File 'lib/wixanswers/rest/ticket.rb', line 195

def unassign(ticket_id)
  WixAnswers::Models::Ticket.new(perform_request("/tickets/#{ticket_id}/unassign", :post))
end

#unassign_many(options = {}) ⇒ Array[WixAnswers::Models::Ticket]

Remove the agent or group assignment from one or more tickets.

Parameters:

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

    A customizable set of options

  • ids (Hash)

    a customizable set of options

  • assignedGroupId (Hash)

    a customizable set of options

  • assignedUserId (Hash)

    a customizable set of options

Returns:

Raises:

  • (WixAnswers::Exceptions::Unauthorized)

    Error raised when supplied agent credentials are not valid.

See Also:



211
212
213
# File 'lib/wixanswers/rest/ticket.rb', line 211

def unassign_many(options={})
  perform_request("/tickets/unassign", :post, options).map {|ticket| WixAnswers::Models::Ticket.new(ticket)}
end

#update_priority(ticket_id, options = {}) ⇒ WixAnswers::Models::Ticket

Update a ticket’s priority

Parameters:

  • ticket_id (String)

    Ticket GUID

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

    A customizable set of options

  • priority (Hash)

    a customizable set of options

Returns:

Raises:

  • (WixAnswers::Exceptions::Unauthorized)

    Error raised when supplied agent credentials are not valid.

See Also:



323
324
325
# File 'lib/wixanswers/rest/ticket.rb', line 323

def update_priority(ticket_id, options={})
  WixAnswers::Models::Ticket.new(perform_request("/tickets/#{ticket_id}/priority", :put, options))
end

#update_priority_many(options = {}) ⇒ Array[WixAnswers::Models::Ticket]

Update one or more tickets’ priorities

Parameters:

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

    A customizable set of options

  • ids (Hash)

    a customizable set of options

  • priority (Hash)

    a customizable set of options

Returns:

Raises:

  • (WixAnswers::Exceptions::Unauthorized)

    Error raised when supplied agent credentials are not valid.

See Also:



336
337
338
# File 'lib/wixanswers/rest/ticket.rb', line 336

def update_priority_many(options={})
  perform_request("/tickets/setPriority", :post, options).map {|ticket| WixAnswers::Models::Ticket.new(ticket)}
end

#update_status(ticket_id, options = {}) ⇒ WixAnswers::Models::Ticket

Update a ticket’s status

Parameters:

  • ticket_id (String)

    Ticket GUID

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

    A customizable set of options

  • status (Hash)

    a customizable set of options

Returns:

Raises:

  • (WixAnswers::Exceptions::Unauthorized)

    Error raised when supplied agent credentials are not valid.

See Also:



297
298
299
# File 'lib/wixanswers/rest/ticket.rb', line 297

def update_status(ticket_id, options={})
  WixAnswers::Models::Ticket.new(perform_request("/tickets/#{ticket_id}/status", :put, options))
end

#update_status_many(options = {}) ⇒ Array[WixAnswers::Models::Ticket]

Update one or more tickets’ statuses

Parameters:

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

    A customizable set of options

  • ids (Hash)

    a customizable set of options

  • status (Hash)

    a customizable set of options

Returns:

Raises:

  • (WixAnswers::Exceptions::Unauthorized)

    Error raised when supplied agent credentials are not valid.

See Also:



310
311
312
# File 'lib/wixanswers/rest/ticket.rb', line 310

def update_status_many(options={})
  perform_request("/tickets/setStatus", :post, options).map {|ticket| WixAnswers::Models::Ticket.new(ticket)}
end