0.1.0 • Published 9 years ago

offerpop v0.1.0

Weekly downloads
3
License
MIT
Repository
github
Last release
9 years ago

Offerpop

This module is a simple, isomorphic JS library to interact with Offerpop's REST APIs. It can be used both in the browser using a bundler like Browserify or Webpack or on the server using Node.

Code Example

var Ugc = require('offerpop').Ugc;
var ugc = new Ugc('OFFERPOP_ACCESS_TOKEN');

ugc
  .getById('37152902')
  .then(function (response) {
    // do stuff
  });

Motivation

I built this library so that communication with Offerpop's Content API and Conversion Unit API could be abstracted out and easily used on the browser and server side.

Installation

npm install --save offerpop

API Reference

The module exports two classes whose instance methods return an axios Promise.

new Ugc(String accessToken)

getById (String id [,Object params])

TypeParameterDescription
Stringidid of the user generated content
Objectparamsquery params of the GET request

getCollection (String id [, Object params, Boolean collectAllPages])

TypeParameterDescription
Stringidid of the collection
Objectparamsquery params of the GET request
BooleancollectAllPagesboolean to decide whether to fetch the whole collection

new ActiateUnit(String accessToken)

getById (String id)

TypeParameterDescription
Stringidid of the activate unit

getAll ()

new Content(String accessToken)

getItems (Object params)

TypeParameterDescription
Objectparamsquery params of the GET request

Tests

To run the tests for this repo you'll need to setup an .env file with the following environment variable.

OFFERPOP_ACCESS_TOKEN=*** YOUR ACCESS TOKEN HERE ***

Then, run the following command.

npm run test-dev

Contributors

Vincenzo Merolla

Credits

Shout out to Matt Zabriskie for easing the build of this module with axios.

License

MIT

0.1.0

9 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago