Jump To …

device.js

/*
 * device.js: Instance of a single Loggly device
 *
 * (C) 2010 Nodejitsu Inc.
 * MIT LICENSE
 *
 */
 
var loggly = require('../loggly'),
    interns = require('./interns');
 
var Device = function (client, details) {
  if (!details) throw new Error("Device must be constructed with at least basic details.")

  this.client = client;
  this._setProperties(details);
};

Device.prototype = {
  addToInput: function (inputId, callback) {
    this.client.addDeviceToInput(inputId, this.id, callback);
  },
  

Sets the properties for this instance Parameters: details

  _setProperties: function (details) {

Copy the properties to this instance

    var self = this;
    Object.keys(details).forEach(function (key) {
      self[key] = details[key];
    });
  }
};

exports.Device = Device;