{"_id":"3scale-cm","_rev":"5-9eb3c96b957788496efe920dc62070e6","name":"3scale-cm","description":"Client for 3Scale Networks API","dist-tags":{"latest":"0.7.2"},"versions":{"0.5.1":{"name":"3scale-cm","description":"Client for 3Scale Networks API","version":"0.5.1","homepage":"http://www.3scale.net","repository":{"type":"git","url":"git://github.com/3scale/3scale_ws_api_for_nodejs.git"},"author":{"name":"3scale","email":"support@3scale.net"},"contributors":[{"name":"Carlos Villuendas","email":"carlosvillu@3scale.net"},{"name":"Michal Cichra","email":"michal@3scale.net"},{"name":"Daniel Stevens","email":"daniel.stevens@senicolabs.com"},{"name":"Chaitanya Surapaneni","email":"chaitanya.surapaneni@senicolabs.com"},{"name":"Joaquin Rivera","email":"joaquin@3scale.net","url":"joahking"},{"name":"Victor Delgado","email":"victor@3scale.net"}],"main":"lib/index.js","bugs":{"url":"http://github.com/3scale/3scale_ws_api_for_nodejs/issues"},"keywords":["api","authorization","3scale","web"],"scripts":{"prepublish":"coffee --bare -o lib -c src","test":"vows test/* --spec"},"directories":{"lib":"./lib"},"dependencies":{"libxmljs":"*","qs":"*","https-proxy-agent":"*"},"devDependencies":{"coffee-script":"1.x","nock":"0.46.0","vows":"0.8.x"},"engines":{"node":">=0.8.0","npm":">=1.4.0"},"optionalDependencies":{},"gitHead":"b6c5ad5cda18b1cc7ee03b9c98adb9397683c649","_id":"3scale-cm@0.5.1","_shasum":"ab0b7adbbd117046e46bee68f1ae08d4f59c3896","_from":".","_npmVersion":"2.15.8","_npmUser":{"name":"clubmed","email":"clubmed.front.rwd@gmail.com"},"maintainers":[{"name":"jenkins","email":"jenkins@clubmed.com"}],"dist":{"shasum":"ab0b7adbbd117046e46bee68f1ae08d4f59c3896","tarball":"https://registry.npmjs.org/3scale-cm/-/3scale-cm-0.5.1.tgz","integrity":"sha512-xgXqKHydy9ZW7bPjzxd/LQIW7VWI9mX67J6m7OzHj0z+XN/IA6iWD9jip6b2Bwqq4l3LEBXtGK4bd+Ei66Arzw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDPb764EijlldfrS+DHUfF9UTSRzrqP9C3fCvHMzpf/1QIhALxFj+TR5XCBvr0ZjecueOo+lxdTExCyckzMdHv4ghOA"}]},"_resolved":"http://moytux/sinopia/3scale-cm/-/3scale-cm-0.5.1.tgz","_nodeVersion":"4.4.7","_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/3scale-cm-0.5.1.tgz_1470216261206_0.2769873645156622"}},"0.7.2":{"name":"3scale-cm","description":"Client for 3Scale Networks API","version":"0.7.2","homepage":"http://www.3scale.net","repository":{"type":"git","url":"git://github.com/3scale/3scale_ws_api_for_nodejs.git"},"author":{"name":"3scale","email":"support@3scale.net"},"contributors":[{"name":"Carlos Villuendas","email":"carlosvillu@3scale.net"},{"name":"Michal Cichra","email":"michal@3scale.net"},{"name":"Daniel Stevens","email":"daniel.stevens@senicolabs.com"},{"name":"Chaitanya Surapaneni","email":"chaitanya.surapaneni@senicolabs.com"},{"name":"Joaquin Rivera","email":"joaquin@3scale.net","url":"joahking"},{"name":"Victor Delgado","email":"victor@3scale.net"}],"main":"lib/index.js","bugs":{"url":"http://github.com/3scale/3scale_ws_api_for_nodejs/issues"},"keywords":["api","authorization","3scale","web"],"scripts":{"prepublish":"coffee --bare -o lib -c src","test":"mocha --compilers coffee:coffee-script/register test/* -if 'Integration'","test-all":"mocha --compilers coffee:coffee-script/register test/*"},"directories":{"lib":"./lib"},"dependencies":{"es6-promise":"^3.1.2","https-proxy-agent":"^1.0.0","qs":"^5.2.0","xml2js":"^0.4.16"},"devDependencies":{"coffee-script":"^1.10.0","mocha":"^2.3.4","nock":"^3.3.2"},"engines":{"node":">=0.10.0","npm":">=2.0.0"},"optionalDependencies":{},"gitHead":"2d309cf512fd7a1f92232671414573d79ba8c84e","_id":"3scale-cm@0.7.2","_shasum":"7798e3613aabb377d6b81821e56995cbfb41d44d","_from":".","_npmVersion":"2.15.8","_nodeVersion":"4.4.7","_npmUser":{"name":"clubmed","email":"clubmed.front.rwd@gmail.com"},"dist":{"shasum":"7798e3613aabb377d6b81821e56995cbfb41d44d","tarball":"https://registry.npmjs.org/3scale-cm/-/3scale-cm-0.7.2.tgz","integrity":"sha512-bF+RQR+tmCAIBbKCNwe52/YDiWZHQ2b95+HHEmzHZBJ59uhkZ80yjCBhkq8DYBoIc7DTaPSjQACbrj1uI80d8g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCW3TJSr/2gKOuoHdp0bcJ8ejJ4ITUyoz3sHnZTuqYOJwIhALLCy7f5aJ/uF+pnpw1ULg38t09e/5D8bQKJriE10Ukr"}]},"maintainers":[{"name":"clubmed","email":"clubmed.front.rwd@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/3scale-cm-0.7.2.tgz_1470223294776_0.8503471077419817"}}},"readme":"# 3scale integration plugin for JavaScript/CoffeeScript/Node.js applications [![Build Status](https://secure.travis-ci.org/3scale/3scale_ws_api_for_nodejs.png?branch=master)](http://travis-ci.org/3scale/3scale_ws_api_for_nodejs)\n\n3scale is an API Infrastructure service which handles API Keys, Rate Limiting, Analytics, Billing Payments and Developer Management.\nIncludes a configurable API dashboard and developer portal CMS.\nMore product stuff at http://www.3scale.net/, support information at http://support.3scale.net/.\n\n## Installation\n\nThe module is delivered through the package manager npm, so that the installation should be easy as: `npm install 3scale`\n\n\n## Requirements\n\nStarting at version 0.6.0, this plugin requires using **Node.js versions 0.10.x or higher**.\n\n\n## Synopsis\n\nThis plugin supports the 3 main calls to the 3scale backend:\n\n- authrep grants access to your API and reports the traffic on it in one call.\n- authorize grants access to your API.\n- report reports traffic on your API.\n\n3scale supports 3 authentication modes: App Id, User Key and OAuth. The first two are similar on their calls to the backend, they support authrep. OAuth differs in its usage two calls are required: first authorize then report.\n\n## Usage\n\n### Authrep\n\nAuthrep is a 'one-shot' operation to authorize an application and report the associated transaction at the same time. The main difference between this call and the regular **authorize** call is that usage will be reported if the authorization is successful. Read more about authrep at the active docs page on the [3scale's support site](https://support.3scale.net/reference/active-docs).\n\nHere is an example assuming that you are using the `app_id/app_key` authentication mode:\n```javascript\nvar Client = require('3scale').Client;\n\nclient = new Client(\"your provider key\",[\"3Scale URL(default : su1.3scale.net)\"],[\"proxy URL\"]);\n\nclient.authrep({\"app_id\": \"your application id\", \"app_key\": \"your application key\", \"usage\": { \"hits\": 1 } }, function(response){\n  console.log(response);\n});\n```\n\nIn case you have your API authentication configured in 3scale to use the `user_key` mode, this would be the equivalent to the example above:\n\n```javascript\nvar Client = require('3scale').Client;\n\nclient = new Client(\"your provider key\");\n\nclient.authrep_with_user_key({ \"user_key\": \"your key\", \"usage\": { \"hits\": 1 } }, function(response){\n  console.log(response);\n});\n```\n\n### Authorize and Report\n\nYou can alternatively use the **authorize** and **report** methods to do the same in two separate calls. \nNote that the **report** method supports sending the usage for multiple transactions in a single call.\n\n```javascript\nvar Client = require('3scale').Client;\n\nclient = new Client(\"your provider key\");\n\nclient.authorize({ \"app_id\": \"your application id\", \"app_key\": \"your application key\" }, function(response){\n  if (response.is_success()) {\n    var trans = [{ \"app_id\": \"your application id\", \"usage\": { \"hits\": 3 } }];\n    client.report(trans, function (response) {\n      console.log(response);\n    });\n  } \n  else {\n    console.log(\"Error: \" + response.error_code + \" msg: \" + response.error_msg);\n  }\n});\n```\n\nHere is the same example for the `user_key` authentication pattern:\n\n```javascript\nvar Client = require('3scale').Client;\n\nclient = new Client(\"your provider key\");\n\nclient.authorize_with_user_key({ \"user_key\": \"your key\" }, function(response){\n  if (response.is_success()) {\n    var trans = [{ \"user_key\": \"your key\", \"usage\": { \"hits\": 3 }}];\n    client.report(trans, function (response) {\n      console.log(response);\n    });\n  } \n  else {\n    console.log(\"Error: \" + response.error_code + \" msg: \" + response.error_msg);\n  }\n});\n```\n\nNote that the **report** method supports sending the usage for multiple transactions in a single call.\n\n```javascript\nvar trans = [\n              { \"app_id\": \"your application id\", \"usage\": {\"hits\": 1}},\n              { \"app_id\": \"your application id\", \"usage\": {\"hits\": 1000}}\n             ]\n\nclient.report(trans, function(response){\n  console.log(response);\n});\n```\n\n### OAuth\n\nIf you set OAuth as the authentication pattern for your API in 3scale, you will need to take the separate **authorize** and **report** approach (i.e. there is no **authrep** for OAuth).\n\n```javascript\nvar Client = require('3scale').Client;\n\nclient = new Client(\"your provider key\");\n\nclient.oauth_authorize({\"app_id\": \"your application id\"}, function(response){\n  if (response.is_success()) {\n    var trans = [{\"app_id\": \"your application id\", \"usage\": {\"hits\": 3}}];\n    client.report(trans, function (response) {\n      console.log(response);\n    });\n  } \n  else {\n    console.log(\"Error: \" + response.error_code + \" msg: \" + response.error_msg);\n  }\n});\n```\n\n## To test\n\nTo run tests: `npm test` or `vows test/* --spec` from the root directory of the project.\nPlease note that you will first need to set the following environment variables using your own 3scale keys:\n\n- TEST_3SCALE_PROVIDER_KEY\n- TEST_3SCALE_APP_KEY\n- TEST_3SCALE_APP_ID\n","maintainers":[{"email":"camille.foubert.ext@clubmed.com","name":"clubmed"}],"time":{"modified":"2022-06-12T14:07:29.582Z","created":"2016-08-03T09:24:22.395Z","0.5.1":"2016-08-03T09:24:22.395Z","0.7.2":"2016-08-03T11:21:36.403Z"},"homepage":"http://www.3scale.net","keywords":["api","authorization","3scale","web"],"repository":{"type":"git","url":"git://github.com/3scale/3scale_ws_api_for_nodejs.git"},"contributors":[{"name":"Carlos Villuendas","email":"carlosvillu@3scale.net"},{"name":"Michal Cichra","email":"michal@3scale.net"},{"name":"Daniel Stevens","email":"daniel.stevens@senicolabs.com"},{"name":"Chaitanya Surapaneni","email":"chaitanya.surapaneni@senicolabs.com"},{"name":"Joaquin Rivera","email":"joaquin@3scale.net","url":"joahking"},{"name":"Victor Delgado","email":"victor@3scale.net"}],"author":{"name":"3scale","email":"support@3scale.net"},"bugs":{"url":"http://github.com/3scale/3scale_ws_api_for_nodejs/issues"},"readmeFilename":"README.md"}