UNPKG

1.13 kBJavaScriptView Raw
1/**
2 * @file Defines the DeleteOneEndpoint class.
3 *
4 * @author Luke Chavers <luke@c2cschools.com>
5 * @author Kevin Sanders <kevin@c2cschools.com>
6 * @since 5.0.0
7 * @license See LICENSE.md for details about licensing.
8 * @copyright 2017 C2C Schools, LLC
9 */
10
11"use strict";
12
13const BaseEndpoint = require( "./BaseEndpoint" );
14
15/**
16 * The parent class for all DELETE ('DELETE') endpoints that delete one record
17 * based on a single ID value.
18 *
19 * @memberOf Endpoint
20 * @extends Endpoint.BaseEndpoint
21 */
22class DeleteOneEndpoint extends BaseEndpoint {
23
24 /**
25 * @param {Object} cfg - Basic endpoint settings.
26 * @param {Object} [overrides] - A configuration object that allows certain,
27 * default, behaviors to be overridden. This parameter is primarily
28 * used by testing interfaces.
29 */
30 constructor( cfg, overrides ) {
31
32 // Apply Overrides
33 cfg = Object.assign( {}, cfg, overrides );
34
35 // Set Endpoint Type
36 cfg.endpointType = "deleteOne";
37
38 // Define the default response class
39 cfg.defaultSuccessResponse = "DeleteOneResponse";
40
41 // Call Parent
42 super( cfg );
43 }
44}
45
46module.exports = DeleteOneEndpoint;