How to use the parsers function from restler

Find comprehensive JavaScript restler.parsers code examples handpicked from public code repositorys.

117
118
119
120
121
122
123
124
125
126
}

function getStockProfileFromBenzinga(symbol, callback) {
  symbol = utils.normalizeSymbol(symbol);
  var options = {
    parser: restler.parsers.json
  };
  restler.get('http://data.benzinga.com/stock/'+symbol, options).on('complete', function(result) {
    var profile;
    var stock;
fork icon16
star icon26
watch icon6

18
19
20
21
22
23
24
25
26
27
};

// Get core parameters required in every API call
utils.coreParams = function(api_key, secret) {
  return {
    parser: rest.parsers.xml,
    data: {
      api_key: api_key,
      ts: this.timestamp(),
      hash: this.currentHash(secret)
fork icon7
star icon11
watch icon2

110
111
112
113
114
115
116
117
118
119
  
callback = callback || function(){};
option = option || {};
  
var restRequest = null;
var requestOption = { query : option, parser : restler.parsers.json };
requestOption.headers = {};
requestOption.headers['Authorization'] = 'GoogleLogin auth=' + self.googleAuth.getAuthId();
if (body) {
        requestOption.data = body;
fork icon6
star icon30
watch icon3

7
8
9
10
11
12
13
14
15
16
};

function req_options(obj){
  var opts = {
    headers: { Cookie: 'session='+ config.read() },
    parser: http.parsers.json
  };

  for (var i in obj)
    opts[i] = obj[i];
fork icon2
star icon3
watch icon2

26
27
28
29
30
31
32
33
34
35


WatchmouseFolder.prototype.endpoints = function(event, callback) {

  rest.get(this.apiBaseUrl + "/synth/current/" + this.wmCurrent + "/folder/" + this.wmFolder, {
    parser: rest.parsers.json
  }).on('success', function(data) {
    var respBody = {
      "code": data.code,
      "endpoints": [ ]
fork icon1
star icon1
watch icon2

28
29
30
31
32
33
34
35
36
37
if (options.data) {
  options.data = JSON.stringify(options.data);
  options.headers['Content-Type'] = 'application/json';
}

options.parser = rest.parsers.json;

rest.request(this.url(url), options).addListener('success', function(data) {
  p.emitSuccess(data);
}).addListener('error', function(data) {
fork icon0
star icon11
watch icon3