Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

latest recurly api uses only api_key for authorization

  • Loading branch information...
commit c0b9dbbee73dcebb2d9753701d0a9b8454b4f06a 1 parent 8d3b01b
@valorkin valorkin authored
View
2  .npmignore
@@ -0,0 +1,2 @@
+node_modules
+.idea
View
4 README.md
@@ -12,9 +12,7 @@ Installation
add a config file to your project that has contents similar to:
module.exports = {
- API_USERNAME: 'secret',
- API_PASSWORD: 'secret',
- PRIVATE_KEY: 'secret',
+ API_KEY: 'secret',
SUBDOMAIN: '[your_account]',
ENVIRONMENT: 'sandbox',
DEBUG: false
View
6 lib/client.js
@@ -1,11 +1,11 @@
(function(){
-
+'use strict';
var https = require('https'),
Xml2js = require('xml2js'),
parser = new Xml2js.Parser({explicitArray: false});
exports.create = function(config){
- config.RECURLY_HOST = 'api.recurly.com';
+ config.RECURLY_HOST = config.SUBDOMAIN + '.recurly.com';
return {
request: function(route, callback, data){
@@ -18,7 +18,7 @@ exports.create = function(config){
path: endpoint,
method: method,
headers: {
- Authorization: "Basic "+(new Buffer(config.API_USERNAME+":"+config.API_PASSWORD)).toString('base64'),
+ Authorization: "Basic "+(new Buffer(config.API_KEY)).toString('base64'),
Accept: 'application/xml',
'Content-Length' : (data) ? data.length : 0
}
View
4 test/config-example.js
@@ -1,7 +1,5 @@
module.exports = {
- API_USERNAME: '',
- API_PASSWORD: '',
- PRIVATE_KEY: '',
+ API_KEY: '',
SUBDOMAIN: '',
ENVIRONMENT: 'sandbox',
DEBUG: true,
Please sign in to comment.
Something went wrong with that request. Please try again.