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

ma3route-sdk

Package Overview
Dependencies
Maintainers
2
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ma3route-sdk - npm Package Compare versions

Comparing version 0.11.0 to 0.11.1

docs/ma3route-sdk/0.11.0/fonts/OpenSans-Bold-webfont.eot

8

CHANGELOG.md

@@ -10,2 +10,10 @@ # Change Log

## 0.11.1 - 2016-07-15
Fixed:
* Fix passing the body to a success callback in POST requests
## 0.11.0 - 2016-06-07

@@ -12,0 +20,0 @@

65

index.js
/**
* Node.js SDK for Ma3Route REST API
* @see https://bitbucket.org/ma3route_team/ma3route-api-documentation/wiki/Home
*/

@@ -31,9 +32,21 @@

/**
* A callback passed a collection of items such as traffic updates
* @global
* Settings for the SDK. Defaults can be found in the config.json file in root of repo.
* This is to be passed to utils.setup().
* @typedef {Object} SETTINGS
* @property {String} baseurl - API base url
* @property {Boolean} enforce_params_filter - whether to pick parameters before sending requests
* @property {Object} request - configures requests fired by SDK
* @property {Boolean} request.strictSSL - whether to enable strict ssl
* @property {Boolean} request.json - whether to return responses in JSON format
* @see https://github.com/Ma3Route/node-sdk/blob/master/config.json
*/
/**
* A callback passed a collection of items, such as traffic updates.
* @callback collectionCallback
* @param {Error} error - error object
* @param {Array} items - an array of targetted items
* @param {Object} meta - meta data concerning the data
* @param {Object} response - the original response object
* @param {Array} items - array of items
* @param {Object} meta - meta-data concerning the items
* @param {Object} response - actual response object
*/

@@ -44,8 +57,9 @@

* A callack passed a success indicator
* @global
* @callback successCallback
* @param {Error} error
* @param {Object} indicator
* @param {Object} meta
* @param {Object} response
* @param {Error} error - error object
* @param {Object} indicator - status of the operation
* @param {Boolean} indicator.success - whether the operation succeeded
* @param {Boolean} indicator.message - message from the API
* @param {Object} [indicator.object] - affected object
* @param {Object} response - actual response object
*/

@@ -55,9 +69,8 @@

/**
* A callack passed a single items
* @global
* A callack passed a single item, such as a single traffic update.
* @callback itemCallback
* @param {Error} error
* @param {Object} item
* @param {Object} meta
* @param {Object} response
* @param {Error} error -error object
* @param {Object} item - the single item
* @param {Object} meta - meta-data concerning the item
* @param {Object} response - actual response object
*/

@@ -67,3 +80,3 @@

/**
* @global
* String representing an endpoint. This is solely used internally by the SDK.
* @typedef {String} Endpoint

@@ -74,5 +87,5 @@ */

/**
* @global
* Sends a GET request to fetch an array of items.
* @typedef {Function} itemsGetRequest
* @param {Object} [params]
* @param {Object} [params] - parameters
* @param {collectionCallback} callback

@@ -83,6 +96,6 @@ */

/**
* @global
* Sends a GET request, to fetch a single item.
* @typedef {Function} itemsGetOneRequest
* @param {Number|Object} identifier
* @param {Object} [params]
* @param {Number|Object} identifier - ID of the item
* @param {Object} [params] - parameters
* @param {itemCallback} callback

@@ -93,5 +106,5 @@ */

/**
* @global
* Sends a POST request, usually for creating and updating entities.
* @typedef {Function} itemsPostOneRequest
* @param {Object} body
* @param {Object} body - parameters
* @param {successCallback} callback

@@ -102,6 +115,6 @@ */

/**
* @global
* Creates and returns a SSE Client.
* @typedef {Function} SSEClientFactory
* @param {Object} initDict
* @param {Object} initDict - initialization options
* @return {EventSource}
*/

9

lib/auth.js

@@ -35,2 +35,3 @@ /**

* @private
* @memberof auth
*

@@ -108,4 +109,4 @@ * @param {String} key - used to identify the client

/**
* Sign a URI instance. This is simply a wrapper around {@link module:auth~addSignature}
* that allows a timestamp to be added to the URI instance.
* Sign a URI instance.
* Automatically adds a timestamp to the URI instance.
*

@@ -118,4 +119,4 @@ * @public

* @param {*} body - body to used in request
* @return {URIjs} same instance of URIjs
* @throws {errors.AuthenticationRequiredError}
* @return {URIjs} same instance of URIjs, i.e. 'uri'
* @throws {errors.AuthenticationRequiredError} if 'key' or 'secret' are invalid.
*/

@@ -122,0 +123,0 @@ function sign(key, secret, uri, body) {

@@ -5,2 +5,3 @@ /**

* Handling banner adverts
* @see https://bitbucket.org/ma3route_team/ma3route-api-documentation/wiki/Banner%20Adverts
*/

@@ -7,0 +8,0 @@

@@ -5,2 +5,3 @@ /**

* Handling driving reports
* @see https://bitbucket.org/ma3route_team/ma3route-api-documentation/wiki/Reports
*/

@@ -7,0 +8,0 @@

@@ -5,2 +5,3 @@ /**

* Handling the external stream
* @see https://bitbucket.org/ma3route_team/ma3route-api-documentation/wiki/External%20Stream
*/

@@ -7,0 +8,0 @@

@@ -122,3 +122,3 @@ /**

body: body,
}, utils.passResponse(callback));
}, utils.passResponse(callback, { post: true }));
};

@@ -149,3 +149,3 @@ }

* @param {Endpoint} endpoint
* @return {SSEClientFactory|Poller}
* @return {SSEClientFactory}
* @throws Error

@@ -152,0 +152,0 @@ */

@@ -21,4 +21,5 @@ /**

* @type {itemsPostOneRequest}
* @see https://bitbucket.org/ma3route_team/ma3route-api-documentation/wiki/Contact%20Us
*/
contactUs: generate.newPostOne("contactUs", paramsConfig.contactUs.create),
};

@@ -5,2 +5,3 @@ /**

* Viewing and editing news for Ma3Route
* @see https://bitbucket.org/ma3route_team/ma3route-api-documentation/wiki/News
*/

@@ -7,0 +8,0 @@

@@ -31,2 +31,3 @@ /**

* @type {itemsPostOneRequest}
* @see https://bitbucket.org/ma3route_team/ma3route-api-documentation/wiki/Directions
*/

@@ -37,2 +38,3 @@ createDirections: generate.newPostOne("directions", paramsConfig.directions.create),

* @type {itemsGetOneRequest}
* @see https://bitbucket.org/ma3route_team/ma3route-api-documentation/wiki/Directions
*/

@@ -39,0 +41,0 @@ getDirections: generate.newGetOne("directions", paramsConfig.directions.get),

@@ -26,3 +26,3 @@ /**

* Poller Class. Inherits from events.EventEmitter. This poller
* is designed in that it polls for new updates automatically
* is designed in that it polls for new items automatically
* without having you implement `lastreadId` logic.

@@ -57,6 +57,6 @@ *

* @constructor
* @param {itemsGetRequest} getRequest
* @param {itemsGetRequest} getRequest - request function fired in each poll
* @param {Object} [options]
* @param {Object|Function} [options.params] - parameters passed to get request.
* If `options.params` is a function, it is called and it return value is
* If `options.params` is a function, it is invoked and its return value is
* assumed an object as the request params.

@@ -86,3 +86,3 @@ * If `options.params` requires to do an asynchronous action, it is passed a

/**
* Starts the poller
* Starts the poller.
*/

@@ -145,4 +145,5 @@ Poller.prototype.start = function start() {

* interval used internally. It basically causes a 'noop' to be
* fired instead of an actual network request. This is an
* simpler implementation.
* fired instead of an actual network request. This implementation
* is simple, and also cheap if you require to pause and resume
* multiple times.
*/

@@ -165,3 +166,3 @@ Poller.prototype.pause = function pause() {

/**
* Stops the poller
* Stops the poller.
*/

@@ -168,0 +169,0 @@ Poller.prototype.stop = function stop() {

@@ -5,2 +5,3 @@ /**

* Using Server-Sent Events to continuously receive data.
* @see https://bitbucket.org/ma3route_team/ma3route-api-documentation/wiki/Server%20Sent%20Events
*/

@@ -7,0 +8,0 @@

/**
* @module trafficUpdates
* @description
* Handling traffic updates. See {@link https://bitbucket.org/ma3route_team/ma3route-api-documentation/wiki/Updates.md}.
* Handling traffic updates.
* @see https://bitbucket.org/ma3route_team/ma3route-api-documentation/wiki/Updates
*/

@@ -6,0 +7,0 @@

@@ -21,2 +21,3 @@ /**

* @type {itemsPostOneRequest}
* @see https://bitbucket.org/ma3route_team/ma3route-api-documentation/wiki/Registration
*/

@@ -27,2 +28,3 @@ createOne: generate.newPostOne("users", paramsConfig.users.create),

* @type {itemsPostOneRequest}
* @see https://bitbucket.org/ma3route_team/ma3route-api-documentation/wiki/Edit%20Profile
*/

@@ -35,2 +37,3 @@ edit: generate.newCustomPostOne("users", {

* @type {itemsGetOneRequest}
* @see https://bitbucket.org/ma3route_team/ma3route-api-documentation/wiki/Login
*/

@@ -37,0 +40,0 @@ getOne: generate.newGetOne("users", paramsConfig.users.login),

/**
* @module utils
* @description
* SDK Utilities
* SDK Utilities, used internally.
*/

@@ -49,12 +49,2 @@

// module variables
/**
* @global
* @name SETTINGS
* @description settings for the SDK. Defaults can be found in the config.json file in root of repo.
* @param {String} baseurl - API base url
* @param {Boolean} enforce_params_filter - whether to pick parameters before sending requests
* @param {Object} request - configures requests fired by SDK
* @param {Boolean} request.strictSSL - whether to enable strict ssl
* @param {Boolean} request.json - whether to return responses in JSON format
*/
var SETTINGS = _.cloneDeep(config);

@@ -83,3 +73,3 @@ var uriKeys = ["proxy"];

*
* @param {Object} settings - new SDK settings
* @param {SETTINGS} settings - new SDK settings
* @return {Object} the newly-set SDK settings

@@ -123,5 +113,5 @@ */

* Return an URI object (from URI.js) for easier URL building.
* See http://medialize.github.io/URI.js/docs.html for docs on URI.js
*
* @public
* @see http://medialize.github.io/URI.js/docs.html for docs on URI.js
*

@@ -329,5 +319,8 @@ * @param {String} [label] label - identifying the URL.

* @param {Function} callback - user's callback
* @return {Function} function to handle responses from `request` modules
* @param {Object} [options]
* @param {Boolean} [options.post] - callback is for a POST request
* @return {Function} function to handle responses from `request` calls
*/
function passResponse(callback) {
function passResponse(callback, options) {
options = options || {};
return function handleResponse(error, response, body) {

@@ -342,4 +335,6 @@ if (error) {

var err = new response.ErrorClass(response.statusCode, message);
if (options.post) return callback(err, body, response);
return callback(err, body.data, body.meta, response);
}
if (options.post) return callback(null, body, response);
return callback(null, body.data, body.meta, response);

@@ -362,3 +357,3 @@ };

* @param {Boolean} [toExclude=true] - whether to exclude keys automatically
* @return {URI} the uri with the queries appended
* @return {URIjs} the uri with the queries appended
*/

@@ -384,3 +379,3 @@ function addQueries(uri, params, toExclude) {

/**
* Allow params to be optional for user to pass to the invoking function
* Allow 'params' to be optional, thus user can pass 'callback' in its place.
*

@@ -391,3 +386,5 @@ * @public

* @param {Function} [callback] - user's callback
* @return {Object}
* @return {Object} args
* @return {Function} args.callback
* @return {Function} args.params
*/

@@ -502,3 +499,3 @@ function allowOptionalParams(params, callback) {

/**
* Retruns an object with poller options from sources
* Return an object with poller options from sources
*

@@ -505,0 +502,0 @@ * @param {Object|Object[]} sources

{
"name": "ma3route-sdk",
"version": "0.11.0",
"version": "0.11.1",
"description": "Node.js SDK for developing with the Ma3Route REST API",

@@ -5,0 +5,0 @@ "repository": {

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