lib/zendesk2/ticket.rb in zendesk2-1.11.0 vs lib/zendesk2/ticket.rb in zendesk2-1.12.0

- old
+ new

@@ -113,21 +113,10 @@ } ).body['audit']['events'].first ) end - # @return [Array<Zendesk2::User>] All users CCD on this ticket - def collaborators - collaborator_ids.map { |cid| cistern.users.get(cid) } - end - - # Update list of users to be CCD on this ticket - # @param [Array<Zendesk2::User>] collaborators list of users - def collaborators=(collaborators) - self.collaborator_ids = collaborators.map(&:identity) - end - # @return [Zendesk2::TicketAudits] all audits for this ticket def audits cistern.ticket_audits(ticket_id: identity).all end @@ -137,7 +126,27 @@ end # @return [Array<Zendesk2::TicketComment>] all comments for this ticket def comments cistern.ticket_comments(ticket_id: identity).all + end + + # @return [Array<Zendesk2::User>] All users CCD on this ticket + def collaborators + (collaborator_ids || []).map { |id| cistern.users.get(id) } + end + + def collaborators=(collaborators) + collaborators = [collaborators] unless collaborators.is_a?(Array) + + value = collaborators.map do |collaborator| + case collaborator + when Zendesk2::User + collaborator.identity + else + collaborator + end + end + + attributes[:collaborators] = value end end