Skip to content

Commit

Permalink
Merge pull request #10 from ovh/upgrade_node_version
Browse files Browse the repository at this point in the history
Upgrade node version, delete proxy support (deprecated), add promise support

Signed-off-by: Jean-Tiare Le Bigot <jean-tiare.le-bigot@corp.ovh.com>
  • Loading branch information
yadutaf committed Jun 7, 2016
2 parents 2bcd324 + 7dcba97 commit 835a178
Show file tree
Hide file tree
Showing 14 changed files with 1,089 additions and 503 deletions.
3 changes: 2 additions & 1 deletion .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"asi" : false, // Tolerate Automatic Semicolon Insertion (no semicolons).
"boss" : false, // Tolerate assignments inside if, for & while. Usually conditions & loops are for comparison, not assignments.
"debug" : false, // Allow debugger statements e.g. browser breakpoints.
"eqnull" : false, // Tolerate use of `== null`.
"eqnull" : true, // Tolerate use of `== null`.
"es5" : false, // Allow EcmaScript 5 syntax.
"esnext" : true, // Allow ES.next specific features such as `const` and `let`.
"evil" : false, // Tolerate use of `eval`.
Expand All @@ -73,6 +73,7 @@
"sub" : false, // Tolerate all forms of subscript notation besides dot notation e.g. `dict['key']` instead of `dict.key`.
"supernew" : false, // Tolerate `new function () { ... };` and `new Object;`.
"validthis" : false, // Tolerate strict violations when the code is running in strict mode and you use this in a non-constructor function.
"esnext" : true,

// == Environments ====================================================
//
Expand Down
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@ language: node_js
node_js:
- '0.10'
- '0.11'
- '0.12'
- '4'
- '5'
- '6'
after_script: 'npm install coveralls && cat ./coverage/lcov.info | node_modules/.bin/coveralls'
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 2.0.0

* Support of node v5 and v6
* Remove the proxy mode with harmonies
* Add requestPromised for promise support natively

## 1.1.3

* Support zero-byte JSON HTTP bodies (#2)
Expand Down
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,17 @@ ovh.request('GET', '/me', function (err, me) {
});
```

You can also use the promised version like this:
```js
ovh.requestPromised('GET', '/me')
.then(function (response) {
//Do what you want
})
.catch(function (err) {
//Return an error object like this {error: statusCode, message: message}
});
```

## Installation

The easiest way to get the latest stable release is to grab it from the
Expand Down Expand Up @@ -129,6 +140,31 @@ You can browse the API schemas using the web consoles of the APIs:
* [Kimsufi Europe](https://eu.api.kimsufi.com/console/)
* [Kimsufi North-America](https://ca.api.kimsufi.com/console/)
## Migration from 1.x.x to 2.x.x without Proxy support
For example if you use the OVH Europe API, you'll have to check on https://eu.api.ovh.com/console/ the endpoints available for your feature.
In order to have the informations about the bill with id "0123".
+ Before in 1.x.x with Proxy:
```javascript
ovh.me.bill["0123"].$get(function (err, billInformation) {
});
```
+ Now in 2.x.x with promise:
```javascript
ovh.requestPromised('GET', '/me/bill/0123') //This route has been found at https://eu.api.ovh.com/console/
.then(function (billInformation) {
})
.catch(function (err) {
});
```
## Full documentation and examples
The full documentation is available online: http://ovh.github.io/node-ovh.
Expand Down
Loading

0 comments on commit 835a178

Please sign in to comment.