allows a protected method to be called
@param  {string} method   protected method to call
@param  {object} options  options to call function with
@return {Promise}         Promise that the called function returns
771378
function bypass(method, options) {
    // jscs:disable
    // jshint -W040
    const self = this;
    // jshint +W040
    // jscs:enable
    const shield = self.constructor.shield;

    if (!_.includes(shield.protectedMethods, method)) {
        return Promise.reject(new Error('no such protected method'));
    }
    const protectedMethod = `_${method}`;
    return shield[protectedMethod].call(self, options);
}
191950
def promise_method(func):
    
    name = func.__name__

    @wraps(func)
    def wrapped(self, *args, **kwargs):
        cls_name = type(self).__name__
        if getattr(self, '_%s__resolved' % (cls_name,)):
            return getattr(getattr(self, '_%s__wrapped' % (cls_name,)), name)(*args, **kwargs)
        return func(self, *args, **kwargs)
    return wrapped
334175
function getHandler (method, getArgs) {
  return service => {
    return function (req, res, next) {
      const { query } = req;
      const route = omit(req.params, '__feathersId');

      res.setHeader('Allow', allowedMethods(service).join(','));

      // Check if the method exists on the service at all. Send 405 (Method not allowed) if not
      if (typeof service[method] !== 'function') {
        debug(`Method '${method}' not allowed on '${req.url}'`);
        res.status(statusCodes.methodNotAllowed);

        return next(new errors.MethodNotAllowed(`Method \`${method}\` is not supported by this endpoint.`));
      }

      // Grab the service parameters. Use req.feathers
      // and set the query to req.query merged with req.params
      const params = Object.assign({
        query, route
      }, req.feathers);

      Object.defineProperty(params, '__returnHook', {
        value: true
      });

      // Run the getArgs callback, if available, for additional parameters
      const args = getArgs(req, params);

      debug(`REST handler calling \`${method}\` from \`${req.url}\``);

      service[method](...args, true)
        .then(hook => {
          const data = hook.dispatch !== undefined ? hook.dispatch : hook.result;

          res.data = data;
          res.hook = hook;

          if (hook.statusCode) {
            res.status(hook.statusCode);
          } else if (!data) {
            debug(`No content returned for '${req.url}'`);
            res.status(statusCodes.noContent);
          } else if (method === 'create') {
            res.status(statusCodes.created);
          }

          return next();
        })
        .catch(hook => {
          const { error } = hook;

          debug(`Error in handler: \`${error.message}\``);
          res.hook = hook;

          return next(hook.error);
        });
    };
  };
}
738678
function requestPromisfied(options) {
  return new Promise(function (resolve, reject) {
    (0, _request2.default)(options, function (err, res) {
      if (err) {
        reject(err);
      }
      resolve(res.body);
    });
  });
}
357976
function( object, method ) {
            return function(){
                var args = arguments;
                if ( args === undefined ){
                    args = [];
                }
                return method.apply( object, args );
            };
        }
281541
public function apiCall($method, array $args = [])
    {
        // create the request url
        $requestUrl = self::BASE_URL . $method;

        // set the api token
        $args['token'] = $this->token;

        // send a post request with all arguments
        $promise = $this->httpClient->postAsync($requestUrl, [
            'form_params' => $args,
        ]);

        // Add requests to the event loop to be handled at a later date.
        $this->loop->futureTick(function () use ($promise) {
            $promise->wait();
        });

        // When the response has arrived, parse it and resolve. Note that our
        // promises aren't pretty; Guzzle promises are not compatible with React
        // promises, so the only Guzzle promises ever used die in here and it is
        // React from here on out.
        $deferred = new Deferred();
        $promise->then(function (ResponseInterface $response) use ($deferred) {
            // get the response as a json object
            $payload = Payload::fromJson((string) $response->getBody());

            // check if there was an error
            if (isset($payload['ok']) && $payload['ok'] === true) {
                $deferred->resolve($payload);
            } else {
                // make a nice-looking error message and throw an exception
                $niceMessage = ucfirst(str_replace('_', ' ', $payload['error']));
                $deferred->reject(new ApiException($niceMessage));
            }
        });

        return $deferred->promise();
    }
668506
function loadWithPromise (options) {
  return new Promise((resolve, reject) => {
    loadWithCallback(options, (error, config) => {
      if (error) {
        reject(error)
      } else {
        resolve(config)
      }
    })
  })
}
1069155
function checkOptions(options) {
                // @TODO: should we throw an error if there are incorrect options provided?
                options = _.pick(options, permittedOptions);

                let validationErrors = utils.validateOptions(options);

                if (_.isEmpty(validationErrors)) {
                    return Promise.resolve(options);
                }

                // For now, we can only handle showing the first validation error
                return Promise.reject(validationErrors[0]);
            }
259208
function loadEnforcer(method) {
  return function () {
    for (var _len = arguments.length, rest = Array(_len), _key = 0; _key < _len; _key++) {
      rest[_key] = arguments[_key];
    }

    var FB = (0, _getGlobalFB2.default)();
    if (!FB) {
      throw new Error('FB SDK Wrapper cannot call method ' + method.name + '; the ' + 'SDK is not loaded yet. Call load() first and wait for its promise ' + 'to resolve.');
    } else {
      return method.apply(undefined, [FB].concat(rest));
    }
  };
}
721031
function checkAccess({ accessToken, id, model, method, options, ctx }) {

     return new Promise((resolve, reject) => {
         // ignore checking if does not enable auth
         if (model.app.isAuthEnabled) {
             if (!model.app.models.ACL) {
                 console.log('ACL has not been setup, skipping access check.')
                 resolve(true);
             } else {
                 model.checkAccess(accessToken, id, method, ctx,
                     ((err, allowed) => {
                         if (err)
                             reject(err);
                         else if (allowed)
                             resolve(allowed);
                         else
                             reject(`ACCESS_DENIED`);
                     }));
             }
         } else {
             resolve(true);
         }
     })

 }
905087
function validateMethod (method) {
  if (!method) {
    return option.some('HTTP method is not specified')
  }
  if (typeof method !== 'string') {
    return option.some('HTTP method should be type of string')
  }
  if (supportedMethods.indexOf(method.toUpperCase()) < 0) {
    return option.some(`Http method ${method} is not supported`)
  }
  return option.none
}
1152830
function getIntentHandler(method, options) {
  var lastEvent = null;
  var timeout = null;

  var opts = extend({
    intentDelay: 200
  }, options);

  var triggerIntent = function() {
    method(lastEvent);
  };

  var startIntent = function(evt) {
    lastEvent = evt;
    clearTimeout(timeout);
    timeout = setTimeout(triggerIntent, opts.intentDelay);
  };

  var stopIntent = function() {
    lastEvent = null;
    clearTimeout(timeout);
  };

  return {
    startIntent: startIntent,
    stopIntent: stopIntent
  };
}
1359172
function (methodName, params, execOptions) {
                var requestId = this._getRequestId(methodName, params);
                var promise = this._getRequestPromise(requestId);

                if (!promise) {
                    this._addToBatch(methodName, params);
                    promise = this._createPromise(requestId);
                    this._run(execOptions);
                }

                return promise;
            }
576483
function requestHandler (method) {
  return function (req, res, next) {
    method.call(this, req, responseHandler(res, next));
  }.bind(this);
}
343850
function(options)
	{
		options = conbo.defineDefaults(options, this.options);
		
		if (!!options.context) this.context = options.context;
		this.preinitialize(options);
		
		this._httpService = new conbo.HttpService(options);
		this._command = options.command;
		
		var resultHandler = function(event)
		{
			conbo.makeBindable(this, conbo.variables(event.result));
			conbo.assign(this, event.result);
			
			this.dispatchEvent(event);
		};
		
		this._httpService
			.addEventListener(conbo.ConboEvent.RESULT, resultHandler, this)
			.addEventListener(conbo.ConboEvent.FAULT, this.dispatchEvent, this);
		
		__denumerate(this);
		
		conbo.Hash.prototype.__construct.apply(this, arguments);
	}
721930
function _request (method, url, options, session) {
    // require options to be object
    options = requireValidOptionalObject(options)
    // set http method
    options.method = method
    // merge arguments into options
    options.uri = url
    // make request
    return request(options, session)
}
550750
function(url, options, defaults) {
            var d = Q.defer();
            options = options || {};
            options = _.extend(options, defaults, {
                "url": url
            });
            var r = new Requests(options);
            r.on("done", function(content) {
                d.resolve(content);
            });
            r.on("error", function(err) {
                var e = new Error(err.textStatus+": "+err.content);
                e.textStatus = err.textStatus,
                e.httpRes = err.content;
                d.reject(e);
            });

            r.execute();
            return d.promise;
        }