Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dynect

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dynect - npm Package Compare versions

Comparing version 0.1.5 to 0.1.6

index.js

8

package.json

@@ -8,3 +8,3 @@ {

},
"version": "0.1.5",
"version": "0.1.6",
"keywords": [

@@ -16,7 +16,7 @@ "dynect",

],
"bugs": { "url" : "https://github.com/ashleybrener/dynector/issues" },
"bugs": { "url" : "https://github.com/frisB/dynect/issues" },
"license": "MIT",
"repository": {
"type" : "git",
"url" : "https://github.com/ashleybrener/dynector"
"url" : "https://github.com/frisB/dynect"
},

@@ -26,3 +26,3 @@ "dependencies": {

},
"main": "./dynector",
"main": "./index",
"engines": {

@@ -29,0 +29,0 @@ "node": ">= 0.8.x"

@@ -9,10 +9,12 @@ Dyn DNS API connector for node.js.

``` js
var Dynect = require('dynect');
// open Dynect API session
var dynector = new Dynector('customername', 'username', 'password');
var dynect = new Dynect('customername', 'username', 'password');
dynector.on('connected', function () {
dynect.on('connected', function () {
var zone = 'example.com';
// add A record with 5 min TTL
dynector.addRecord('A', zone, 'www.example.com', {
dynect.addRecord('A', zone, 'www.example.com', {
address: '123.45.67.89'

@@ -23,7 +25,7 @@ }, 300, function (addResponse) {

//publish zone
dynector.publishZone(zone, function (publishResponse) {
dynect.publishZone(zone, function (publishResponse) {
console.log(publishResponse);
// close Dynect API session
dynector.disconnect();
dynect.disconnect();
});

@@ -33,3 +35,3 @@ });

dynector.connect();
dynect.connect();
```

@@ -42,10 +44,12 @@

``` js
var Dynect = require('dynect');
// open Dynect API session and send keepalive every 5mins
var dynector = new Dynector('customername', 'username', 'password', 300000);
var dynect = new Dynect('customername', 'username', 'password', 300000);
dynector.on('connected', function () {
dynect.on('connected', function () {
var zone = 'example.com';
// add CNAME record with default TTL
dynector.addRecord('CNAME', zone, 'www.example.com', {
dynect.addRecord('CNAME', zone, 'www.example.com', {
cname: 'example.mydomain.com'

@@ -56,3 +60,3 @@ }, 0, function (addResponse) {

// publish zone
dynector.publishZone(zone, function (publishResponse) {
dynect.publishZone(zone, function (publishResponse) {
console.log(publishResponse);

@@ -63,17 +67,11 @@ });

dynector.connect();
dynect.connect();
```
## Installation
## installation
### Installing npm (node package manager)
```
curl http://npmjs.org/install.sh | sh
npm install dynect
```
### Installing dynector
```
[sudo] npm install dynect
```
#### Author: [Ashley Brener](http://twitter.com/ashleybrener)
#### author: ashley @[frisB.com](http://www.frisb.com)
var events = require('events');
var https = require('https');
var util = require('util');
var winston = require('winston');
var logger = new (winston.Logger)({
transports: [
new (winston.transports.Console)({
colorize: true,
handleExceptions: true,
timestamp: false
})
],
levels: {
silly: 0,
verbose: 1,
info: 2,
data: 3,
warn: 4,
debug: 5,
error: 6
},
colors: {
silly: 'blue',
verbose: 'cyan',
info: 'green',
data: 'grey',
warn: 'magenta',
debug: 'yellow',
error: 'red'
}
});
var Logger = require('./logger');
function Session(customer, username, password) {
events.EventEmitter.call(this);
this.logger = new Logger('Dynect Session');
this.openTime = null;

@@ -49,3 +24,3 @@ this.customer = customer;

send(null, 'POST', '/Session/', {
this.send(null, 'POST', '/Session/', {
data: {

@@ -86,3 +61,3 @@ customer_name: this.customer,

send(this.token, 'DELETE', '/Session/', {}, function (response) {
this.send(this.token, 'DELETE', '/Session/', {}, function (response) {
//{ status: 'success',

@@ -111,3 +86,3 @@ // data: {},

send(this.token, 'GET', '/Session/', {}, function (response) {
this.send(this.token, 'GET', '/Session/', {}, function (response) {
//{ status: 'success',

@@ -140,3 +115,3 @@ // data: {},

send(this.token, 'PUT', '/Session/', {}, function (response) {
this.send(this.token, 'PUT', '/Session/', {}, function (response) {
//{ status: 'success',

@@ -164,2 +139,3 @@ // data: {},

if (this.token != null) {
// session open for 50 mins
if (Date.now() - this.openTime >= (50 * 60 * 1000)) {

@@ -170,3 +146,3 @@ this.verify(function (err) {

if (!err) {
send(self.token, method, path, options, callback);
self.send(self.token, method, path, options, callback);
}

@@ -178,3 +154,3 @@ });

else {
send(this.token, method, path, options, callback);
this.send(this.token, method, path, options, callback);
}

@@ -185,3 +161,3 @@ }

if (!err) {
send(self.token, method, path, options, callback);
self.send(self.token, method, path, options, callback);
}

@@ -192,3 +168,4 @@ });

function send(token, method, path, options, callback) {
Session.prototype.send = function (token, method, path, options, callback) {
var self = this
var opt = {

@@ -244,6 +221,6 @@ host: 'api2.dynect.net',

if (msg.ERR_CD != null) {
winston.error(msg.ERR_CD + ' (' + msg.INFO + ')\n');
self.logger.error(msg.ERR_CD + ' (' + msg.INFO + ')\n');
}
else {
winston.info(msg.INFO + '\n');
self.logger.info(msg.INFO + '\n');
}

@@ -253,3 +230,3 @@ }

else {
winston.info(response + '\n');
self.logger.info(response + '\n');
}

@@ -262,3 +239,3 @@

catch (e) {
winston.error('[request exception] ' + e.message + '\n\n' + data);
self.logger.error('request exception: ' + e.message + '\n\n' + data);
}

@@ -269,6 +246,6 @@ });

req.on('error', function (e) {
winston.error('[request] ' + e);
self.logger.error('request: ' + e);
});
winston.info(method + ' https://' + opt.host + opt.path);
this.logger.info(method + ' https://' + opt.host + opt.path);

@@ -275,0 +252,0 @@ if ((method === 'POST' || method === 'PUT') && options.data) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc