<commit_before>angular
  .module('khe')
  .factory('Ticket', ['$http', 'User', function ($http, User) {

    var self = this;
    var user = new User();

    /**
    * Get a list of tickets
    */
    self.list = function () {
      var req = user.authorize({
        method: 'GET',
        url: '/api/tickets'
      });
      return $http(req);
    };

    /**
    * Get a single ticket
    * @param id The ticket ID
    */
    self.get = function (id) {
      var req = user.authorize({
        method: 'GET',
        url: '/api/tickets/'+id
      });
      return $http(req);
    };

    /**
    * Create a new ticket
    * @param ticket {subject: String, body: String, replyTo: String}
    */
    self.create = function (ticket) {
      var req = {
        method: 'POST',
        url: '/api/tickets',
        data: ticket
      };
      return $http(req);
    };

    /**
    * Update a ticket by ID
    * @param id The ticket ID
    * @param toUpdate An object containing the fields to update
    */
    self.update = function (id, toUpdate) {
      var req = user.authorize({
        method: 'PATCH',
        url: '/api/tickets/'+id,
        data: toUpdate
      });
      return $http(req);
    };

    /**
    * Delete a ticket
    * @param id The ticket ID
    */
    self.delete = function (id) {
      var req = user.authorize({
        method: 'DELETE',
        url: '/api/tickets/'+id
      });
      return $http(req);
    };

  }]);<commit_msg>Make ticket service into an object<commit_after>angular
  .module('khe')
  .factory('Ticket', ['$http', 'User', function ($http, User) {

    var Ticket = function () {

      var self = this;
      var user = new User();

      /**
      * Get a list of tickets
      */
      self.list = function () {
        var req = user.authorize({
          method: 'GET',
          url: '/api/tickets'
        });
        return $http(req);
      };

      /**
      * Get a single ticket
      * @param id The ticket ID
      */
      self.get = function (id) {
        var req = user.authorize({
          method: 'GET',
          url: '/api/tickets/'+id
        });
        return $http(req);
      };

      /**
      * Create a new ticket
      * @param ticket {subject: String, body: String, replyTo: String}
      */
      self.create = function (ticket) {
        var req = {
          method: 'POST',
          url: '/api/tickets',
          data: ticket
        };
        return $http(req);
      };

      /**
      * Update a ticket by ID
      * @param id The ticket ID
      * @param toUpdate An object containing the fields to update
      */
      self.update = function (id, toUpdate) {
        var req = user.authorize({
          method: 'PATCH',
          url: '/api/tickets/'+id,
          data: toUpdate
        });
        return $http(req);
      };

      /**
      * Delete a ticket
      * @param id The ticket ID
      */
      self.delete = function (id) {
        var req = user.authorize({
          method: 'DELETE',
          url: '/api/tickets/'+id
        });
        return $http(req);
      };

    };

    return Ticket;

  }]);
{'fraction_non_alphanumeric': 0.14716255210003207, 'fraction_numerical': 0.0, 'mean_word_length': 1.5324675324675325, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6324203', 'n_tokens_mistral': 965, 'n_tokens_neox': 945, 'n_words': 272}