<commit_before>'use strict';

var operations = require('./api_operations.js');
var RequestCommon = require('./request_common.js');

function Customers(auth) {
  this._auth = auth;
}

Customers.prototype = new RequestCommon('customer');
Customers.prototype.constructor = Customers;

/**
 * Subscription management for customers.
 */
Customers.prototype.updateSubscription = function(id, data, cb) {
  if (!this._requireId(id, cb)) {
    return;
  }
  this._post('/v1/customers/' + id + '/subscription', data, cb);
}

Customers.prototype.cancelSubscription = function(id, data, cb) {
  if (!this._requireId(id, cb)) {
    return;
  }
  this._del('/v1/customers/' + id + '/subscription', data, cb);
}

/**
 * Card management for customers.
 * TODO(michelle): should we maybe instead wrap the response in Customer/Charge?
 *    I don't really like that pattern for node, though.
 */
Customers.prototype.createCard = function(id, data, cb) {
  if (!this._requireId(id, cb)) {
    return;
  }
  this._post('/v1/customers/' + id + '/cards', data, cb);
}

Customers.prototype.updateCard = function(id, card, data, cb) {
  if (!this._requireId(id, cb)) {
    return;
  }<commit_msg>Discount<commit_after>'use strict';

var operations = require('./api_operations.js');
var RequestCommon = require('./request_common.js');

function Customers(auth) {
  this._auth = auth;
}

Customers.prototype = new RequestCommon('customer');
Customers.prototype.constructor = Customers;

/**
 * Subscription management for customers.
 */
Customers.prototype.updateSubscription = function(id, data, cb) {
  if (!this._requireId(id, cb)) {
    return;
  }
  this._post('/v1/customers/' + id + '/subscription', data, cb);
}

Customers.prototype.cancelSubscription = function(id, data, cb) {
  if (!this._requireId(id, cb)) {
    return;
  }
  this._del('/v1/customers/' + id + '/subscription', data, cb);
}

/**
 * Discounts for customers.
 */
Customers.prototype.deleteDiscount = function(id, cb) {
  if (!this._requireId(id, cb)) {
    return;
  }
  this._del('/v1/customers/' + id + '/discount', data, cb);
}

/**
 * Card management for customers.
 * TODO(michelle): should we maybe instead wrap the response in Customer/Charge?
 *    I don't really like that pattern for node, though.
 */
Customers.prototype.createCard = function(id, data, cb) {
  if (!this._requireId(id, cb)) {
    return;
  }
  this._post('/v1/customers/' + id + '/cards', data, cb);
}

Customers.prototype.updateCard = function(id, card, data, cb) {
  if (!this._requireId(id, cb)) {
    return;
  }
{'fraction_non_alphanumeric': 0.16535742340926946, 'fraction_numerical': 0.0027494108405341712, 'mean_word_length': 3.955252918287938, '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': '4285741', 'n_tokens_mistral': 826, 'n_tokens_neox': 826, 'n_words': 199}