# node-mediamath

> Node SDK for Media Math's Reporting Api

Latest version **1.0.4** (published 2016-02-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install node-mediamath
pnpm add node-mediamath
yarn add node-mediamath
bun add node-mediamath
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2016-02-29 |
| First published | 2015-04-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 (+4 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | AgencyPMG |
| Maintainers | agencypmg |
| Keywords | MediaMath, Api |

## Links

- npm: https://www.npmjs.com/package/node-mediamath
- Repository: https://github.com/AgencyPMG/node-mediamath
- Issues: https://github.com/AgencyPMG/node-mediamath/issues
- npm.io page: https://npm.io/package/node-mediamath

## Dependencies (4)

- [request](https://npm.io/package/request.md) ^2.55.0
- [underscore](https://npm.io/package/underscore.md) ^1.8.3
- [super-config](https://npm.io/package/super-config.md) 0.0.8
- [tough-cookie](https://npm.io/package/tough-cookie.md) ^0.12.1

## Alternatives

- [random-seedable](https://npm.io/package/random-seedable.md) — 27.9K weekly downloads
- [n2words](https://npm.io/package/n2words.md) — 22.2K weekly downloads
- [@stdlib/math-base-special-factorialln](https://npm.io/package/@stdlib/math-base-special-factorialln.md) — 5.7K weekly downloads
- [@stdlib/math-base-special-abs2](https://npm.io/package/@stdlib/math-base-special-abs2.md) — 1.7K weekly downloads
- [commons-math-interpolation](https://npm.io/package/commons-math-interpolation.md) — 1.4K weekly downloads

## Recent versions

- 1.0.4 (latest) — 2016-02-29
- 1.0.3 — 2015-05-18
- 1.0.0 — 2015-04-29

## README

[![Build Status](https://travis-ci.org/AgencyPMG/node-mediamath.svg)](https://travis-ci.org/AgencyPMG/node-mediamath)

# node-mediamath
Node SDK for Media Math's Reporting Api.

## Install

```
npm install node-mediamath
```

## How to use
NOTE: Even though this library will work with browserify or any client-side Javascript,
it is not recommended due to the Media Math's login system which depends on cookies
and lack of csrf protection opens up the API to XSS attacks.

NOTE: This is an unfinished Api, currently only the
reporting beta endpoint is supported. Contributions welcome!

## Advanced Setup
You can switch the defaults of the app by using the ```Base.Defaults```

```js
var mediamath = require('node-mediamath');
mediamath.Base.defaultOptions.baseUrl = 'https://t1sandbox.mediamath.com/api/';
```

All the Options:

```json
{
    "baseUrl": "https://api.mediamath.com/api/v1",
    "apiToken": "1234451231234",
    "debug": false
}
```

## Example Usage

```js
var MediaMath = require('node-mediamath');

//auth by username/password
var auth = new MediaMath.Auth('example@example.com', 'pw_goes_here');

//auth by cookie token
var auth = new MediaMath.Auth('124981290i1294081029');

var reports = new MediaMath.ReportsBeta({
    debug: true
});

reports.getListOfReports({auth: auth}, function(error, data) {
    console.log(error, data);
})

reports.getMetadataForReport(
    'https://api.mediamath.com/reporting/v1/std/geo',
    {auth: auth},
    function(error, data) {
        console.log(error, data);
});
```

## Testing
To test, some environment variables must be set
```
MEDIAMATH_API_TOKEN=123412341234
MEDIAMATH_API_USERNAME=example@example.com
MEDIAMATH_API_PASSWORD=password
```
then run ```npm test```

---
_Source: https://npm.io/package/node-mediamath · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
