Created
April 1, 2020 03:49
-
-
Save thorpj/d602bdd8b93ff9eb9e2fe288244f1d3b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BookInPartJob < ActiveJob::Base | |
queue_as :default | |
def perform(ticket_number, message, all_parts_received, warranty_reference, vendor, title) | |
ticket = Api::Autotask::Ticket.find_by_ticket(ticket_number) | |
api_warranty_reference = ticket.warranty_reference.value | |
if api_warranty_reference.exclude? warranty_reference | |
ticket.warranty_reference = "#{ticket.warranty_reference.value} #{warranty_reference}".strip | |
end | |
if all_parts_received | |
ticket.status = ticket.status = 'Parts/Materials Received' | |
end | |
ticket_note = Api::Autotask::TicketNote.new | |
ticket_note.description = "Ref: #{warranty_reference}\n#{message}" | |
ticket_note.ticket_id = ticket.id.value | |
ticket_note.title = title | |
ticket_note.note_type = 'Task Summary' | |
ticket_note.publish = 'Internal Project Team' | |
ticket_note.create | |
ticket.update | |
ticket | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment