Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * @fileOverview Client for the MMX endpoint.
- */
- 'use strict';
- var assert = require('assert');
- var SERVICE = 'MMX';
- var VERSION = 1.0;
- /**
- * Creates a new MMX client instance.
- * @param endpoint The MMX endpoint.
- * @param ctx The context where the function is called.
- * @returns A MMX service instance.
- */
- function createMmx(endpoint, ctx) {
- assert(endpoint !== undefined, 'The endpoint parameter must be specified.');
- assert(endpoint !== null, 'The endpoint parameter cannot be null.');
- assert(ctx !== undefined, 'The ctx parameter must be specified.');
- assert(ctx !== null, 'The ctx parameter cannot be null.');
- function getMarketsInfoForEvent(eventId, mopId, requireRunners, requirePreSettlementInfo) {
- assert(eventId !== undefined, 'The endpoint parameter must be specified.');
- assert(eventId !== null, 'The endpoint parameter cannot be null.');
- assert(mopId !== undefined, 'The endpoint parameter must be specified.');
- assert(mopId !== null, 'The endpoint parameter cannot be null.');
- assert(typeof requireRunners === "boolean", 'The requireRunners parameter must be a boolean.');
- assert(typeof requirePreSettlementInfo === "boolean", 'The requireRunners parameter must be a boolean.');
- var params = {
- eventId: eventId,
- mopId: mopId,
- requireRunners: requireRunners,
- requirePreSettlementInfo: requirePreSettlementInfo
- };
- return endpoint.call(ctx, SERVICE, VERSION, 'getMarketsInfoForEvent', params);
- }
- return {
- /**
- * To get markets information from MMX services we need to make two services calls,
- * marketsforEvent and marketInfo
- *
- * @method getMarketsInfoForEvent
- * @memberOf MMX
- *
- * @param {String} eventId The event id
- * @param {String} mopId The mop id
- * @param {Boolean} requireRunners A flag stating if should retrieve markets with runners
- * @param {Boolean} requirePreSettlementInfo A flag stating if should retrieve the markets
- * pre-settlement info
- * @return {Promise} The return Promise
- */
- getMarketsInfoForEvent: getMarketsInfoForEvent
- };
- }
- module.exports = createMmx;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement