Skip to content

Commit

Permalink
Merge pull request #3258 from reactioncommerce/jsdoc-meteor-plugin-co…
Browse files Browse the repository at this point in the history
…re-methods

jsdoc: more Meteor methods from Core
  • Loading branch information
spencern committed Nov 9, 2017
2 parents d46ef55 + 715105e commit d94d39e
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 17 deletions.
12 changes: 10 additions & 2 deletions imports/plugins/core/connectors/server/methods/methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,18 @@ import { Packages } from "/lib/collections";
import { Reaction } from "/server/api";
import { connectorsRoles } from "../lib/roles";

/**
*
* @namespace Methods/Connectors
*/

export const methods = {
/**
* connectors/connection/toggle
* @summary toggle enabled connection
* @name connectors/connection/toggle
* @method
* @memberof Methods/Connectors
* @example Meteor.call("connectors/connection/toggle", packageId, settingsKey)
* @summary Toggle enabled connection
* @param { String } packageId - packageId
* @param { String } connection - connection name
* @return { Number } update - result
Expand Down
31 changes: 21 additions & 10 deletions imports/plugins/core/discounts/server/methods/methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ import { Cart } from "/lib/collections";
import { Discounts } from "../../lib/collections";
import Reaction from "../api";

//
// make all discount methods available
//
/**
*
* @namespace Methods/Discounts
*/

export const methods = {
/**
* discounts/deleteRate
* @name discounts/deleteRate
* @method
* @memberof Methods/Discounts
* @param {String} discountId discount id to delete
* @return {String} returns update/insert result
*/
Expand All @@ -25,8 +29,10 @@ export const methods = {
},

/**
* discounts/setRate
* update the cart discounts without hooks
* @name discounts/setRate
* @method
* @memberof Methods/Discounts
* @summary Update the cart discounts without hooks
* @param {String} cartId cartId
* @param {Number} discountRate discountRate
* @param {Object} discounts discounts
Expand All @@ -44,9 +50,12 @@ export const methods = {
}
});
},

/**
* discounts/transaction
* applies a transaction to discounts for history
* @name discounts/transaction
* @method
* @memberof Methods/Discounts
* @summary Applies a transaction to discounts for history
* @param {String} cartId cartId
* @param {String} discountId discountId
* @return {String} returns update result
Expand All @@ -68,8 +77,11 @@ export const methods = {
{ selector: { discountMethod: discount.discountMethod } }
);
},

/**
* discounts/calculate
* @name discounts/calculate
* @method
* @memberof Methods/Discounts
* @param {String} cart cartId
* @return {Object} returns discount object
*/
Expand Down Expand Up @@ -105,5 +117,4 @@ export const methods = {
}
};

// export methods to Meteor
Meteor.methods(methods);
32 changes: 32 additions & 0 deletions imports/plugins/core/logging/server/methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,22 @@ import { check } from "meteor/check";
import { Logs } from "/lib/collections";
import { Reaction } from "/server/api";

/**
*
* @namespace Methods/Logging
*/

/**
* @name writeToLog
* @method
* @memberof Methods/Logging
* @summary Writes a log entry into log
* @param {String} logType Type
* @param {String} logLevel Level
* @param {Object} logData Data
* @param {String} [source="client"]
* @return {null}
*/
export function writeToLog(logType, logLevel, logData, source = "client") {
check(logType, String);
check(logLevel, String);
Expand All @@ -19,6 +35,14 @@ export function writeToLog(logType, logLevel, logData, source = "client") {
Logs.insert(logEntry);
}

/**
* @name logging/logError
* @method
* @memberof Methods/Logging
* @param {String} logType Type
* @param {Object} logData Data
* @return {null}
*/
function logError(logType, logData) {
check(logType, String);
check(logData, Object);
Expand All @@ -27,6 +51,14 @@ function logError(logType, logData) {
}
}

/**
* @name logging/logWarning
* @method
* @memberof Methods/Logging
* @param {String} logType Type
* @param {Object} logData Data
* @return {null}
*/
function logWarning(logType, logData) {
check(logType, String);
check(logData, Object);
Expand Down
29 changes: 24 additions & 5 deletions imports/plugins/core/shipping/server/methods/methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,39 @@ import { Shipping, Packages } from "/lib/collections";
import { Reaction } from "/server/api";
import { shippingRoles } from "../lib/roles";

/**
*
* @namespace Methods/Shipping
*/

export const methods = {
/**
* @name shipping/status/refresh
* @method
* @memberof Methods/Shipping
* @todo This is a stub for future core processing
* @summary Blank method. Serves as a place for Method Hooks,
* in other shipping packages, like Shippo
* @param {String} orderId order ID
* @return {String} order ID
*/
"shipping/status/refresh": function (orderId) {
check(orderId, String);
// this is a stub for future core processing
// it also serves as a place for Method Hooks
// in other shipping packages, like Shippo
return orderId;
},

/**
* shipping/provider/toggle
* @summary toggle enabled provider
* @param { String } packageId - packageId
* @param { String } provider - provider name
* @return { Number } update - result
* @name shipping/provider/toggle
* @method
* @memberof Methods/Shipping
* @example Meteor.call("shipping/provider/toggle", packageId, settingsKey)
* @summary Toggle enabled provider
* @param { String } packageId packageId
* @param { String } provider provider name
* @return { Number } update result
*/
"shipping/provider/toggle": function (packageId, provider) {
check(packageId, String);
Expand Down

0 comments on commit d94d39e

Please sign in to comment.