Skip to content

Commit

Permalink
Merge pull request #9 from pmpkin/feature/request-methods
Browse files Browse the repository at this point in the history
Feature/request methods
  • Loading branch information
pmpkin authored Sep 26, 2016
2 parents fa73b5b + c91644e commit 60c5023
Show file tree
Hide file tree
Showing 14 changed files with 342 additions and 210 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
**/node_modules
**/test
20 changes: 20 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"extends": "formidable/configurations/es5",
"env": {
"node": true
},
rules: {
"max-len": [0, 120, 4],
"quotes": ["error", "single"],
"indent": [0, "tab"],
"space-before-function-paren": 0,
strict: 0,
curly: 0,
"max-params": 0,
"valid-jsdoc": 0,
"max-statements": 0,
"consistent-return": 0,
"no-magic-numbers": 0,
"consistent-this": ["error", "_this"]
}
}
40 changes: 0 additions & 40 deletions .jshintrc

This file was deleted.

19 changes: 19 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
language: node_js

node_js:
- "6"

notifications:
slack: pmpkin:QReL3WOed24nwQcVtqvlQyYW

script:
- |
if [ "$TEST_TYPE" = test ]; then
npm test
else
npm run $TEST_TYPE
fi
env:
matrix:
- TEST_TYPE=eslint
- TEST_TYPE=test
26 changes: 14 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# softlayer-node
[Softlayer API](http://sldn.softlayer.com/reference/softlayerapi) wrapper for node. The module provides a simple fluent interface to construct API calls.

[![Build Status](https://travis-ci.org/pmpkin/softlayer-node.svg)](https://travis-ci.org/pmpkin/softlayer-node)
[![npm version](https://badge.fury.io/js/softlayer-node.svg)](https://badge.fury.io/js/softlayer-node)

## Installation
The most simple way is to install the npm package:
```
Expand Down Expand Up @@ -50,7 +53,6 @@ This method sets the credentials
```javascript
client.auth(apiUser, apiKey);
```

##### mask()
Using this method you can add an object mask to the request. You can pass an array of mask elements, or simply string arguments to the method.
```javascript
Expand All @@ -73,8 +75,8 @@ client.headers({
'Content-Type': 'application/json'
});
```
##### get()
With get() the request is submitted. This method returns a Promise. If you prefer node callbacks, you can pass a callback to the method.
##### get(), put(), post(), delete()
Calling one of these methods, the request is submitted. This method returns a Promise. If you prefer node callbacks, you can pass a callback to the method.
```javascript
//Using Promises:
client.get()
Expand All @@ -85,11 +87,9 @@ client.get()
});
//Using node callback:
client.get(function(err,res) {

});
```
##### post(), put(), delete()
These methods are not yet implemented.
##### Chaining it all together
```javascript
var SoftLayer = require('softlayer-node');
Expand All @@ -107,19 +107,21 @@ client
```

## Tests
To run the tests open a command line and tpye
To run the tests open a command line and type
```
npm test
npm run test
```
or
## eslint
To run eslint open a command line and type
```
gulp test
npm run eslint
```
You will need to have gulp and mocha installed to run the tests. **Important:** The tests make real http requests (only GET) to an account, which has to be configured in a file called credentials.json in the test folder.

You will need to have gulp and mocha installed to run the tests. **Important:** The tests make real http requests (currently only GET) to a SoftLayer account, which has to be configured in a file called credentials.json in the test folder.
This file must have the following content:
``` json
{
"accountId": "[account id]",
"accountId": "[accountId]",
"apiUser": "[api user]",
"apiKey": "[api key]"
}
Expand Down
22 changes: 0 additions & 22 deletions gulpfile.js

This file was deleted.

Loading

0 comments on commit 60c5023

Please sign in to comment.