tasks/generator/Scraper.js
function(href)
    {
        var _this = this;

        return Q.nfcall(request, href).then(function(data) {
            var $ = cheerio.load(data);

            var serviceName =
	            $('.collection')
		            .first()
		            .text()
		            .trim()
		            .replace(/\./g, '');
            var serviceDescription =
                $('h1').nextAll('p').first().text();

            _this.services.push(serviceName);

            var ret = {
                serviceName: serviceName,
                description: serviceDescription,
                methods: []
            };

            // Extract method information
            $('.full_method').each(function() {
                var $el         = $(this);
                var collection  = $el.find('.collection')
                    .text().replace('.','').trim();
                var method      = $el.find('.method').text().trim();
                var description = $el.nextAll('p').first().text();
                var $table      = $el.nextAll('table.table-striped').first();

                var methodInfo = {
                    name: method,
                    description: description,
                    params: []
                };

                // Fix for documentation not having api keys
                if (serviceName == 'DiscountService')
                    methodInfo.params.push('apiKey');

                // iterate over all the paramters
                $table.find('tbody tr').each(function() {
                    var td = $(this).find('td').first().text().trim();

                    if (td != 'Key' && td != 'privateKey' && td != 'key')
                        methodInfo.params.push(td);
                    else
                        methodInfo.params.push('apiKey');
                });

                ret.methods.push(methodInfo);
            });

            return ret;
        });
    }
function(href)
    {
        var _this = this;

        return Q.nfcall(request, href).then(function(data) {
            var $ = cheerio.load(data);

            var serviceName =
	            $('.collection')
		            .first()
		            .text()
		            .trim()
		            .replace(/\./g, '');
            var serviceDescription =
                $('h1').nextAll('p').first().text();

            _this.services.push(serviceName);

            var ret = {
                serviceName: serviceName,
                description: serviceDescription,
                methods: []
            };

            // Extract method information
            $('.full_method').each(function() {
                var $el         = $(this);
                var collection  = $el.find('.collection')
                    .text().replace('.','').trim();
                var method      = $el.find('.method').text().trim();
                var description = $el.nextAll('p').first().text();
                var $table      = $el.nextAll('table.table-striped').first();

                var methodInfo = {
                    name: method,
                    description: description,
                    params: []
                };

                // Fix for documentation not having api keys
                if (serviceName == 'DiscountService')
                    methodInfo.params.push('apiKey');

                // iterate over all the paramters
                $table.find('tbody tr').each(function() {
                    var td = $(this).find('td').first().text().trim();

                    if (td != 'Key' && td != 'privateKey' && td != 'key')
                        methodInfo.params.push(td);
                    else
                        methodInfo.params.push('apiKey');
                });

                ret.methods.push(methodInfo);
            });

            return ret;
        });
    }
function ( href ) { var _this = this ; return Q . nfcall ( request , href ) . then ( function ( data ) { var $ = cheerio . load ( data ) ; var serviceName = $ ( '.collection' ) . first ( ) . text ( ) . trim ( ) . replace ( / \. / g , '' ) ; var serviceDescription = $ ( 'h1' ) . nextAll ( 'p' ) . first ( ) . text ( ) ; _this . services . push ( serviceName ) ; var ret = { serviceName : serviceName , description : serviceDescription , methods : [ ] } ; // Extract method information $ ( '.full_method' ) . each ( function ( ) { var $el = $ ( this ) ; var collection = $el . find ( '.collection' ) . text ( ) . replace ( '.' , '' ) . trim ( ) ; var method = $el . find ( '.method' ) . text ( ) . trim ( ) ; var description = $el . nextAll ( 'p' ) . first ( ) . text ( ) ; var $table = $el . nextAll ( 'table.table-striped' ) . first ( ) ; var methodInfo = { name : method , description : description , params : [ ] } ; // Fix for documentation not having api keys if ( serviceName == 'DiscountService' ) methodInfo . params . push ( 'apiKey' ) ; // iterate over all the paramters $table . find ( 'tbody tr' ) . each ( function ( ) { var td = $ ( this ) . find ( 'td' ) . first ( ) . text ( ) . trim ( ) ; if ( td != 'Key' && td != 'privateKey' && td != 'key' ) methodInfo . params . push ( td ) ; else methodInfo . params . push ( 'apiKey' ) ; } ) ; ret . methods . push ( methodInfo ) ; } ) ; return ret ; } ) ; }
Given a URL, parse all of the methods and corresponding parameter names for a Service API endpoint, return promise for node of information
Given a URL parse all of the methods and corresponding parameter names for a Service API endpoint return promise for node of information